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

Software development leaders at the forefront of the latest in technology. Whether implementing updates or integrating with existing technology; developing products that push the bleeding edge of the latest in tech; or developing open-source products, paving the way of future tech, kodmunki™ inspires innovation, elevates quality, and drives value to production. kodmunki™ are experts in web, mobile, and hybrid solutions development; local and distributed team management and collaboration; and fast, quality, successful product delivery, offering R&D, training, consulting, and development services. Contact us at info@kodmunki.com. Let's discuss your vision.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

kodmunki™ Tweets

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

%d bloggers like this: