Embedding Frameworks In An App

Adding A Framework Target

Apps wishing to utilise frameworks to share code across different parts of their application, such as between an app and an app extension, need to start from the framework template appropriate for the app’s target platform. The framework target can be added to the same project as the app target, or it can be added to a separate Xcode project.

  1. Create a new Xcode target and select the framework template appropriate for your app’s target platform.
  2. Add all of the framework source files to the new target’s Compile Sources build phase.
  3. Set the visibility of header files needed by clients of the framework to Public.
  4. Add the public headers to the umbrella header file. If your framework is named YourFramework, the umbrella header is named YourFramework.h.
  5. Follow the steps in Configuring Your Project to configure the new framework target as a dependency of the app target.

Configuring Your Project

Before embedding a framework, set up your Xcode project so the app target depends on the framework target. The following sections describe how to set up this dependency for common project scenarios.

Embedding a Framework

The steps to embed a framework vary, depending on the type of app you are building. The following sections describe how to embed the framework inside the built app for the different types of apps.

Embedding a Framework in an iMessage App

  1. Open the iMessage app’s Xcode project or workspace.
  2. Go to the Build Phases for the iMessage extension target.
  3. Add the framework to the Link Binaries With Libraries list. See Figure 3.
  4. Go to the Build Phases for the iMessage app target.
  5. Add a New Copy Files Phase by selecting the Add icon, highlighted in Figure 4. Set the Destination field to Frameworks, and add the framework to the list. Ensure Code Sign on Copy is checked.

 

tn2435_imessage_extension_settings
tn2435_imessage_app_settings

Embedding a Framework in iOS, macOS, watchOS, and tvOS Apps

  1. Open the app’s Xcode project or workspace.
  2. Go to the app target’s General configuration page.
  3. Add the framework target to the Embedded Binaries section by clicking the Add icon, highlighted in Figure 5. Do not drag in the framework from Finder.
  4. Select your framework from the list of binaries that can be embedded.

tn2435_embedded_binary_list

 

 

Advertisements

About Arpit kulshrestha

Arpit K Kulshrestha Graduated in Computer Science with HONORS Degree in 2012. He is on mission to develop or to be a part of great mobile application which can enhance user experience and able to explore the world. 6 + Years of Apple Mobile Application Development Experience with a strong focus on Building Enterprise, Social Networking Applications and working with Objective-C, Xcode, Storyboard & Instruments. Working knowledge of Core iOS frameworks and skilled in debugging. He has developed apps using SOAP, REST, JSON and XML based Web Services. He is interested to pursue a career in Mobile Applications Development field and he is certain that his skills and work experience prepared him well for such role.
 He has been a specialist in Multimedia & Networking based iOS applications in these years. Have a good in depth knowledge in Network Programming models like TCP/IP. Have done several rich multimedia (Videos & Images) processing & manipulating applications in the same. 
He is accustomed to successfully juggling multiple projects and have an excellent track record of forging strong relationships with client. He work equally well in team-oriented and self-directed environments and find the challenges of the start-up setting stimulating. Specialties:- Map kit , Core Location , UIKit , Core Data , SQLite , Google API's , Facebook API's ,Cocoa 2D, Core Motion, Event Kit.
This entry was posted in iOS Development and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

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 )

Connecting to %s