xcodeproj and Swift package localization

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

Code Block swift
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

Replies

Please file feedback about the issue you’re running into.

Note that you no longer need to generate an Xcode project from a Swift package; you can use
Code Block
$ cd path/to/SomePackage
$ xcodebuild -scheme SomePackage

to build it with Xcode, which includes support for Xcode’s resource file types.

Thanks, I filed feedback: https://feedbackassistant.apple.com/feedback/7763715

With regards to the recommendation to use xcodebuild. I am aware that I can use xcodebuild to build even platform-specific, e.g.

Code Block swift
xcodebuild -scheme SomePackage -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11' build

but I was under the impression that Xcode project might still be required in certain situations?!? For example testing may lead to error like the following

xcodebuild: error: Scheme SomePackage is not currently configured for the test action.

which I don't encounter when building with -project SomePackage.xcodeproj option
If you open your package in Xcode and bring up the scheme's test action, does it show any tests? Does Xcode show tests in the test navigator for your package? xcodebuild test should work with packages, so you shouldn't need to use Xcode project generation for that.
I believe a Xcode project is also commonly used for other scenarios, e.g. developing demo/test apps using local package in a common workspace.

Back to your question: No, xcodebuild test does not work for me. My package is for iOS platform only.

P.S.: Yes, Xcode show tests in the test navigator for my package and can execute them successfully when running them against iOS simulator