I have created swift based Cocoa Touch Framework
project named TestLib
then I have added new target for Cocoa Framework
named TestLibOSX
. When I use the framework on iOS app it seems to be working without any issue, but when I create OSX console application it XCode is complaining that it couldn't find TestLibOSX
module. Am I missing something ?
P.S This is not the same :)
EDIT: Seems this must be possible since I can see Lister is implemented that way.
If you wish to create a single dynamic framework binary, here are the steps you can follow (as outlined in http://colemancda.github.io/programming/2015/02/11/universal-ios-osx-framework/):
This should change your framework's and test unit's valid architectures and supported platforms as well. If not, then manually change them to inherit from the project's build settings.
Base SDK: I recommend OS X, but it will work with iOS too. Note that with with iOS as the base SDK, "My Mac" target is separated into 3 different targets.
Supported Platforms: macosx iphoneos iphonesimulator
Valid Architectures: arm64 armv7 armv7s i386 x86_64
Runpath Search Paths: $(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks
Framework Search Paths: $(SDKROOT) $(inherited)
This will allow you to import it as import MyFramework
instead of
#if os(iOS)
import MyFramework
#else
import MyFrameworkOSX
#endif
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