Since embedded binaries were introduced in iOS 8, I would like to pass a lot of my common code into the framework. I decided to wait one year before doing this, and this year, with Xcode 7 Beta and iOS 9, I am starting to do it this way.
I started a Cocoa Touch framework project in Xcode 7, and I want to compile it into a useful framework. I can get it to compile my project in .framework, but there are a few problems; namely, the structure does not seem to be imported into new projects (I will describe the steps that I took to do this in the near future). Because of this, I'm not sure if there are visible characters in my wireframe.
Here is what I did to create the Framework:
- Created my platform as Cocoa Touch Framework.
- I went to my target build phase, went to Headers and added all my Swift files to the "Public" section, in the hope that I would export all my symbols without having to mark them as
public . - I tried to archive my project as a framework. Currently, it seems that Xcode 7 Beta 3 has an error (about to report it later today) in which it creates corrupted archive files. For this reason, I could not get my framework from the "Organizer" window. To get around this, I changed the Run action scheme in Xcode from Debug to Release, built it, and grabbed the generated
.framework from my build/iphoneos-release project. It was a quick test, so I do not need frameworks created for emulators.
And here is what I did to try to add the framework to a new project:
- Created the โFrameworksโ group (for organizational purposes) and dragged the framework there, selecting โyesโ when he asked me if I want to copy the file to the project directory.
- I went to my target settings, deleted my framework from the "Linked Libraries" (it was added there automatically), instead, added it to the built-in binary files. This again added the structure to Linked Libraries, so I had to remove it from it twice. Leaving the framework in Linked Libraries causes a linker error (cannot find the framework - I donโt know why, but I think this is not related to my problem and something that I should report to Apple as well), but as soon as you remove it from there, compile when you add it to the embedded binaries.
- I tried to import my framework into a file. Xcode complains that "there is no such module."
Unfortunately, despite the fact that the built-in frameworks exist for about a year, I can not find many letters on this topic.
So my question is: am I building the framework correctly, allowing my framework / something else to fail due to a Beta Xcode 7 error? Or is there another procedure for creating a framework that I want to use as an embedded binary? I should probably mention that I want to make this library open source, and I think that distributing a simple .framework file to people who want to use it would be neat.
ios xcode swift2 xcode7-beta3
Andy ibanez
source share