Move your back-end services to a private framework so that they can be used by your app and your app extensions.
An app extension is an agent that acts on behalf of your app, vending services or providing information to the system when asked. Because they extend your app’s behavior, app extensions often need access to the same back-end services and data that your app uses.
If your app and app extension share services, consider structuring your code in the following way:
Implement your core services in a private shared framework. A private shared framework lets you place the code for accessing your services in one code module and use that code from multiple targets. Shared frameworks minimize the size of both executables and make testing easier by ensuring that each executable uses the same code path.
Use a shared container to store common resources. Put relevant images and data files into a shared container so that they can be accessed by both your app and app extension. You enable shared container support in the Capabilities tab of each target.