Creating a framework
Since all of our code for data has already been created in our iOS app, it does not make sense to rewrite our code for our iMessages app. We can create what is known as a framework in order to share our data between our iOS and iMessages 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 creating our framework:
- In the Navigator panel, select the Project navigator and, then, your project again as we did earlier.
- Find the Targets area and click on the + button at the bottom of that area.
- Under the iOS tab, scroll to the bottom to Framework & Library and select Cocoa Touch Framework and, then, hit Next:
- Under Product Name, type
LetsEatDataKit
and, then, hit Finish. - You should now see the following folder and files in the
Products
folder in your Navigator panel: - Select the LetsEatDataKit...