How To Create Custom iOS Frameworks

Finding a means to create custom iOS frameworks, though not impossible, is not the easiest thing to find on the web. Here is what I did, and the resulting frameworks have been working very well me.

To Create the project

  1. Install iOS-Universal-Framework
  2. Restart Xcode
  3. Create your project
  4. Add a “Run” script to the Unit Test Target and copy and paste the following into the Shell content:
    "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 1> /tmp/RunUnitTests.out
  5. In your Build Settings, set Deployment -> Skip Install = YES for both Debug and Release
  6. Update Test Target Build Settings ‘Framework Search Paths’ to include
    $(inherited)
    

    and

    "$(SRCROOT)/${PRODUCT_NAME}.framework"
  7. In your project Target Build Phases, Disable the Second Run Script by adding the following lines to the beginning of the Shell content:
    # Disable this script
    exit 0
  8. In your project Target Build Phases, add a Run Script to the build process:
    rsync --delete -a "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework" "${PROJECT_FILE_PATH}/../_Artifacts/"

To Install the Custom Framework

  1. Add -ObjC to Target Build Settings -> Linking -> Other Linker Flags
  2. Add -ObjC to Test Target Build Settings -> Linking -> Other Linker Flags
  3. Update Target ‘Framework Search Paths’ to include:
    $(inherited)

    and

    "$(SRCROOT)/[PathToProduct][PRODUCT NAME*].framework"
  4. Update Test Target ‘Framework Search Paths’ to include:
    $(inherited)

    and

    "$(SRCROOT)/[PathToProduct][PRODUCT NAME*].framework"
That should do it!
Please, comment on and share this post with others if you enjoy it; follow @kodmunki on Twitter for regular updates on new developments, deployments, articles, and tools; and check out kodmunki™ on Github for cool, managed, and tested kodmunki™ projects.
Thank you for reading, and as always, happy coding :{)}
Advertisements

Architect, engineer, and deliver, intentional, quality, valuable software. Interested in working together? Let's chat. info@kodmunki.com

Posted in iOS, XCode
2 comments on “How To Create Custom iOS Frameworks
  1. […] How To Create Custom iOS Frameworks: a step-by-step guide for decoupling common iOS functionality from applications and creating standalone Frameworks that can be developed and maintained as independent, reusable, unit tested, projects. […]

Enjoy the read? -- Let us know.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

kodmunki™ Tweets

Enter your email address and receive notifications of new kodmunki™ posts by email.

%d bloggers like this: