Post

Replies

Boosts

Views

Activity

XCode preview crashes when using resources accessed in another Swift Package
Context I have a package shared by multiple projects. It contains localized strings. Localization works, as the tests, when run in French language, all pass. public struct MySubLibrary { 	public static var helloWorld: String { 		return NSLocalizedString("HELLO_WORLD", bundle: .module, comment: "Hello world sentence") 	} } I have another package which contains SwiftUI Views, and which depends on the shared package. It also contains resources, such as images. Text(MySubLibrary.helloWorld) Bug When I use a localized string from the shared package, preview crashes. The underlying error is: Fatal error: unable to find bundle named MySubLibrary_MySubLibrary: file MySubLibrary/resource_bundle_accessor.swift, line 27 More details, diagnostics and screenshots You can find example packages, along with the full details and diagnostics report in my xcode-preview-spm-resources-bug - https://github.com/RemiBardon/xcode-preview-spm-resources-bug GitHub repository.
1
0
2.8k
Feb ’21