Data Sharing Between App and App Extensions
Before we start, we need to understand how App extensions work. An App extension is an App, created by extending from extension and resides into Containing App. A Containing App is our main app, which we ship along with extensions. To run these extensions, Apple has preinstalled Apps. These Apps called the Host App(ex. Messager App for Sticker Pack extension).
A Containing apps(the app we are creating) sandbox look like the following:
An App cannot access data outside the sandbox due to privacy and security reasons. To support App extensions Apple provides shared resources called App group.
App Group only works when we enable it in Containing App, App extension as well as App Developer Portal.
How to create App groups?
Select App or App Extension => signing & capabilities => Click +