I am having issues loading my model from a Swift Package with the following structure: | Package.swift | Sources | - | SamplePackage | - | - Core | - | - | - SamplePackageDataStack.swift | - | - | - DataModel.xcdatamodeld | - | - | - | - Model.xcdatamodel ( <- is this new? ) As mentioned, I am not required to list the xcdatamodeld as a resource in my Package manifest. When trying to load the model in the main app, I am getting CoreData: error: Failed to load model named DataModel Code: In my swift Package: public class SamplePackageDataStack: NSObject { public static let shared = SamplePackageDataStack() private override init() {} public lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: DataModel) container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) return container }() /// The managed object context associated with the main queue. (rea
Search results for
[tags:wwdc20-10170]
15 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello, I am struggling with providing assets via Swift Package Manager and an assets folder. I have a swift package A that has an assets folder with a image. I am able to build a preview and see the image in SPM A. 👍🏻 Now I have a swift package B that depends on A. In B I would like to have access of the image. When I build and preview in B I get the following error: Fatal error: unable to find bundle named [redacted]: file [redacted]/resource_bundle_accessor.swift, line 27 😢 please help. I am exposing the image via a public var that returns Image(image, bundle: .module)
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Xcode Previews
Asset Catalog
Swift Packages
wwdc20-10169
It’s great to have SPM managing resources and localization! I would still like to have my library available with other dependencies managers (can I mention CocoaPods here?), so I would need to detect if Bundle.module is available at compile time. Otherwise, I’ll just get an error like this: Type 'Bundle' has no member 'module' Is there something like if @available(SPM), or if Bundle.hasMember(.module)? Any other solution?
I created a brand new swift package, added a simple SwiftUI view, and opened the canvas to view the preview. This all worked great. Then I added a dependency to my package. After adding the dependency previews stop working. Here is my final Package.swift // swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( ttname: MyTestPackage, ttplatforms: [ tttt.iOS(.v14), tttt.macOS(.v10_15) tt], ttproducts: [ tttt// Products define the executables and libraries a package produces, and make them visible to other packages. tttt.library( ttttttname: MyTestPackage, tttttttargets: [MyTestPackage]), tt], ttdependencies: [ tttt.package(url: https://github.com/pointfreeco/swift-composable-architecture, from: 0.6.0) tt], tttargets: [ tttt// Targets are the basic building blocks of a package. A target can define a module or a test suite. tttt// Targets can depend on other targets in this package, and on products
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Swift Packages
WWDC20
Xcode Previews
wwdc20-10169
I get a ton of compile errors when I compile in Release mode (i.e. Archive) my swift package that contains my CoreData .xcdatamodel file. Works fine in debug mode, but when archiving, I get tons of “error reading dependency file…unexpected character in prerequisites at position…” errors. Same errors as this issue: https://developer.apple.com/forums/thread/657264 If I move the .xcdatamodel to the main project (out of the package), then it's all good again, but I'd like to keep the database model file inside the package if possible.
I see that Apple developer use Bundle.module in Resources and localization session, but it doesn't seem to be available in Xcode 12. Is that an unreleased addition, or a private extension of some sort?
Hi, I Want to access resources from spm dependency in unit tests target. When I use Bundle.module I get this error: Fatal error: unable to find bundle named ... It's error in my code, or it's error in spm? thanks
I can't seem to get my SwiftUI preview to work in a Swift Package created with the Multiplatform Swift Package Xcode 12 template. Does this feature require macOS 11+? I'm currently on Catalina with the Xcode 12 beta. Here's what I get from the SwiftUI Preview Diagnostics on macOS: HumanReadableNSError: connectToPreviewHost: Failed to connect to 2247: Error Domain=com.apple.dt.ProcessAttachUtilities Code=0 Failed to get task for pid 2247: 0 UserInfo={NSLocalizedDescription=Failed to get task for pid 2247: 0} com.apple.dt.xcodepreviews.service (17): and on iOS: 'SwiftUIView_Previews' is not a member type of 'NoiseKit' CompileDylibError: Failed to build SwiftUIView.swift Compiling failed: 'SwiftUIView_Previews' is not a member type of 'NoiseKit' /Users/rudedogg/Library/Developer/Xcode/DerivedData/NoiseKit-gefbuwplfdnsqkghveaurldpgavw/Build/Intermediates.noindex/Previews/NoiseKit/Intermediates.noindex/NoiseKit.build/Debug-appletvsimulator/NoiseKit.build/Objects-normal/x86_64/SwiftUIView.2.preview-thunk.swift:22:4
Hi, I have a SPM Library where I add some resources. But I can't load them within the package because I got this error. Type 'Bundle' has no member 'module' Am I missing something ? I'm using Xcode 12. I add the ressource this way in the Package.swift file tt.target( tttname: MyPackage, tttresources: [.copy(Mocks)] tt),
It's great that SPM added support for bundles! I went ahead and added SPM support for a library that I'm working on - https://gitlab.com/SkedGo/iOS/TGCardViewController/-/tree/spm which includes several .xib files and also an en.lproj. This worked well - running both in the simulator and on device. So far so good. Next, I had a look if it's possible to already use this in a TestFlight build. Unfortunately that failed as App Store Connect responded with: ERROR ITMS-90535: Unexpected CFBundleExectuable Key ... consider removing the CFBundleExectuable key from its Info.plist and using a CFBundlePackageType of BNDL. Inspecting the built products, I can indeed see that build product of my app contains .bundle for my library (as expected) and digging into that I can confirm that it has a CFBundleExecutable with the same name as the bundle file (without file extension) and that CFBundlePackageType is already set to BNDL. I wonder how to resolve this. Did I miss a step along the way, is this an issue with SPM or is A
How do you get previews working in a swift package? This talk shows this working, however the following steps do not work. Using Xcode 12 create a new Swift Package Add a simple view with a preview to that swift package (See code below) Attempt to run the preview. See errors Code: #if os(iOS) import SwiftUI @available(iOS 14.0, *) public struct TestView: View { public init() { } public var body: some View { Text(Hello World) } } @available(iOS 14.0, *) struct NoDataView_Previews: PreviewProvider { static var previews: some View { TestView() } } #endif Error: Build input file cannot be found:...TestPackagePreview.o' (in targ SchemeBuildError: Failed to build the scheme TestPackagePreview Build input file cannot be found: ...TestPackagePreview.o' (in target 'TestPackagePreviewTests' from project 'TestPackagePreview' Link TestPackagePreviewTests (x86_64): error: Build input file cannot be found: ...TestPackagePreview.o' (in target 'TestPackagePreviewTests' from project 'TestPackagePreview') Note I have added ...
I didn’t see in the video if .module was a new convenience or the only real way to access the bundle. Is Bundle(for: Class) usable? Apologies if I’ve misremembered the exact call.
I added *.lproj folders and Localizable.strings files and building in Xcode 12 is successful when opening Package.swift But I observed that *.lproj folders and Localizable.strings file do not get added to Xcode project file when generating such with swift package generate-xcodeproj Building module from Xcode project file results in error Type 'Bundle' has no member 'module' Is this a bug or limitation? Reproduce with https://github.com/MarcoEidinger/cloud-sdk-ios-fiori/tree/xcode12 when building for iOS simulator
I have this open source library https://github.com/amraboelela/CLevelDB Which is in c++, and have a C umbrella header https://github.com/amraboelela/CLevelDB/blob/master/CLevelDB/CLevelDB.h What is the right Package.swift format which can work in Xcode for this library, so it can be imported by other swift packages? This is the current one I have: https://github.com/amraboelela/CLevelDB/blob/master/Package.swift
Starting with 5.3 version of Swift, we can bundle our resources within the Swift package. Following that, I included an xcassets catalog with my colors in a helper UI Swift Local Package. When running in Dark Mode and applying the colors via IB Storyboard, it always shows the one for Any Appearance instead of the one set for Dark Appearance, even if both are discoverable and visible from IB. I am using // swift-tools-version:5.3 and Xcode Version 12.3 (12C33). There is a fix for this issue?