9

I have an existing project. I just like to ask if it is possible to convert it to a framework? I have tried searching but I cannot find any tutorial on how to do it.

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
MiuMiu
  • 1,905
  • 2
  • 19
  • 28
  • check [this Link Adding an Existing Project to a Workspace](http://developer.apple.com/library/ios/#recipes/xcode_help-structure_navigator/articles/adding_a_project_to_a_workspace.html). This might help you. http://developer.apple.com/library/ios/#recipes/xcode_help-structure_navigator/articles/adding_a_project_to_a_workspace.html – Siba Prasad Hota Nov 19 '12 at 07:12

4 Answers4

5

Solution for iOS7 or previous

If you want to create a framework in iOS7 you can follow this link. It explain how to create a framework starting from a static library.

http://www.raywenderlich.com/65964/create-a-framework-for-ios

Solution for iOS8

With iOS8 is possible to create framework natively. You can find a good video in the WWDC14 website called Building Modern Frameworks (you'll find both videos and pdf).

Cocoapods

From your question is not clear what you need to do with the framework. If you need to share a lib you can give a look to the cocoapods project. You can use it for both public libraries or privates. I'm using it at work for both the scenarios

Luca Bartoletti
  • 2,435
  • 1
  • 24
  • 46
  • Will creating a Cocoa touch framework using the new Xcode 6 template not work on versions older than iOS8? – Rizon Nov 25 '14 at 17:30
  • From what i know no. There are solution to workaround this problem like: Create a static library for older iOS and include the it inside a framework for iOS8 – Luca Bartoletti Nov 30 '14 at 17:10
  • is it really necessary to create a static library? Can't I just add a new framework target to an existing project? – nr5 Jun 28 '16 at 13:20
1

For iOS I would suggest CocoaPods unless you don't want to distribute the code.

Even in that case you could use CocoaPods. Especially to avoid embedding other third-party libraries or frameworks.

Rivera
  • 10,792
  • 3
  • 58
  • 102
1

For such a useful feature it baffles me that Apple has left this feature out of user's hands, unfortunately Apple in their wisdom has deemed that only OSX would get the framework treatment.

iOS frameworks are effectively packaged static libraries which follow a defined structure that XCode recognises - and hence the need for build script (as in Ray's guide) as this doesn't exist in XCode.

Depending on your mileage with XCode (and shell scripts) and it's peculiarities this project is one saving grace. ios universal framework. You do have to know what you are doing, as it works in only a majority of cases - you may fall into the other 10%.

The documentation could do with an improvement, but the real cruft of the help is here. You do have to install the 'real' and/or 'fake' frameworks, create an initial framework from the templates installed and copy over your files.

teopeurt
  • 471
  • 4
  • 10
0

You are able to create a "Framework Target" in a existing project and setup the necessary files in the "Build Phases"

You can find more examples here

yoAlex5
  • 29,217
  • 8
  • 193
  • 205