How to create a single shared framework between iOS and OS X

If you wish to create a single dynamic framework binary, here are the steps you can follow (as outlined in http://colemancda.github.io/2015/02/11/universal-ios-osx-framework):

1. Change the project’s valid architectures and supported platforms.

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.

Step One

  • 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

2. Change the search paths for the Unit Test bundle

Step Two

  • Runpath Search Paths: $(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks

  • Framework Search Paths: $(SDKROOT) $(inherited)

Its a better solution than having two separate targets.

Leave a Comment