A little bit of a UI/UX deficiency I’ve found when using Swift Package Manager in Xcode 12 β2 is that adding a Swift package to a multiplatform (iOS/macOS) SwiftUI app requires you to choose a target for the package:
That means that if you have a platform-agnostic package that you import, and try to use it for both the iOS and macOS targets, you’ll invariably run across an error ("No such module ‘ModuleName’") when you’re writing code against the target you didn’t add it to in the above step, and your project won’t build for that target.
Can someone confirm that importing a Swift package into a multiplatform SwiftUI app so that both the iOS *and* macOS targets can use it seems to be... not possible in Xcode 12b2?— Angelo Stavrow (@AngeloStavrow) July 21, 2020
To fix this, Stuart Breckenridge shared the following tip: go to the Build Phases tab for each of your targets, and make sure it’s added under Link Binary with Libraries:
Build the app, and you’ll be good to go.
I’ve filed FB8094575 to improve this user flow.