I'm using Xcode 9 and Swift. I've got one workspace and one iOS project. Later I added a MacOS target (Cocoa App). When I try to reference a class from the MacOS target to the iOS target, the compiler says:
Use of unresolved identifier.
How do I get Xcode to allow me to share Swift classes from target to another?
This type of Xcode workspace organization is mentioned in Apple's documentation but doesn't describe how to allow the usage of implicit dependencies within Xcode.
Use Project Navigator to find the classes you wish to share with another target. Highlight the classes. Open the inspectors (icon in the top right corner of Xcode). On the right side a panel will appear. Change the "Target Membership" to include the other (in this case, MacOS) target.
After a rebuild it should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With