Creating a framework 

Since all of our code for data was created in our iOS app, it does not make sense to rewrite it for our iMessages app. We can create what is known as a framework to share our data between our iOS and iMessage apps.

Using frameworks along with app extensions allows us to put shared code in one place. That means less code and more efficiency, because you will not need to update code in multiple places when you have to make a change. Let's get started with creating our framework:

  1. In the Navigator panel, select the Project navigator and then your project.
  2. Find the TARGETS area and click on the + button at the bottom of that area.
  3. Under the iOS tab, scroll to the bottom to Framework & Library, select Cocoa Touch Framework ...

Get iOS 12 Programming for Beginners - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.