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:
- In the Navigator panel, select the Project navigator and then your project.
- 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, 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...