[Pitch] Swift Projects

Some additional problems we've run into since I wrote the above message:

  • @objc APIs declared in a Swift package cannot be used by Objective C code in a consuming module that's declared via an Xcode project because SPM/Xcode fails to add the appropriate Headers folder to the framework it builds. Swift forum link (bug report link to bugs.swift.org is provided in that post).
  • A resources bundle that's inside a Swift Package cannot be directly accessed by consumers. This seems to be a known issue mentioned by Apple in the WWDC talk about using resources in a Swift package. The workaround is for the package to provide public accessor methods that provide the resources from the bundle to consumers. However, because you cannot have mixed Swift/Obj.C SPM targets, and because of the above issue where @objc code in a Swift SPM target can't be used by actual Obj. C code in modules declared in Xcode projects, no SPM target can provide resources to both Objective C code and to Swift code, making it not really worthwhile to try migrating Xcode projects that vend resources to being Swift packages, costing us a lot of wasted time in trying but failing to do so.
3 Likes