Reputation: 440
I want to create an umbrella framework in iOS SDK. My requirements are:
I have a framework called "Framework A", I want to create another framework called "Framework B". I want to add "Framework A" into "Framework B" as a sub-framework and users only need to import "Framework B" in their project to use both "Framework A" and "Framework B". In other words, "Framework B" will work as a wrapper for "Framework A". I read out from Apple via following link regarding framework creations:
but it doesn't expose the way to create an umbrella framework.
Please suggest step by step method to create an umbrella framework.
Upvotes: 22
Views: 23721
Reputation: 2405
We all know that creating umbrella framework is highly discouraged by Apple. But apple also says it’s possible via Xcode. https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/CreationGuidelines.html#//apple_ref/doc/uid/20002254-BAJHGGGA
I achieved creating umbrella framework via these simple approach on Xcode 5.1. We just need to do take care of some special configuration to linking sub-framework to umbrella framework. Here was my approach:-
Static iOS Framework
on Xcode 5.1 from the method described here:- https://github.com/kstenerud/iOS-Universal-Framework.Now the ‘Static iOS Framework’ can be created using the new option in Xcode.
Static iOS Framework
and change the Target-> Build Settings-> Architectures-> Architectures
settings to Standard architectures. This will create the framework with all the Standard Architectures.Target-> Build Phase-> Copy Headers
. We can set the header file visibility here.Target->Build Phase -> Link Binary With Libraries
. We may also need to link other standard framework depending on our use.
Target-> Build Phase-> Copy Bundle Resources
if we need.-ObjC
to Target-> Build Settings->Linking-> Other Linker Flag
, as we may need to load a large subFramework where there are many categories to load or need to load additional frameworks also.Copy File
using Target-> Build Phases-> +-> New Copy File Build Phase
.Frameworks
and add SubFramework.framework there. This will copy SubFramework to Umbrella Framework.
iOS Device
and Archive the UmbrellaFramework project from Menu->Product->Archive
. This will create our umbrella framework and that’s all.Upvotes: 39
Reputation: 1656
To create a Swift based Umbrella Framework that contains a Sub-Framework you can follow the step-by-step guide written down here: Umbrella framework
Upvotes: 2