Vatsal Manot Vatsal Manot - 9 months ago 34
iOS Question

Embedding a framework within a framework (iOS 8+)

iOS applications built with Xcode 6 or higher allow embedding dynamic iOS frameworks within them. I am building a shared framework and would like to embed a sub-framework. (This is possible, as demonstrated by CocoaPods).


Found the answer. Here's how it's done:

  • Navigate to Target > Build Phases
  • Click the small "+" icon and select "New Run Script Build Phase"
  • Paste the following:

    mkdir $PROJECT_NAME.framework/Frameworks &>/dev/null
    for framework in *.framework; do
        if [ $framework != $PROJECT_NAME.framework ]; then
            cp -r $framework $PROJECT_NAME.framework/Frameworks/ &>/dev/null