What is Extension?
In general terms, Extension is a special program that allows you to spread client functions and content outwith your application and make it accessible to consumers or to the system while they’re applying other applications. As iOS 8 was released, it enabled programmers to do their own Extensions which was an opportunity to develop something brand new. Extensions allow to perform a specific tasks inside an application such as dividing some content directly to social networks or using a client fingerboard instead of the system fingerboard, as it was previously possible in Android, or adding client info to Notification Center.
Extensions can give your applications a completely new view and features while making them clearer and easier to use. They can improve user experience and assist you to increase the upload rate of your app. As for developers, Extensions offer a new horizon for exploring and the opportunities to deliver new functions.
As an Extension setup may not be very simple, and users do not yet consider them something familiar, putting a setup guide or consumer manual into a Containing App will do your Extension more user-friendly and increase the chance that it will not be removed after the first minute of usage due to acomplexity.
One possible solution is to copy the code twice, but it is definitely not the desired option. More professional way to solve the issue is to put simultaneous code into Cocoa Touch Framework. In this case, the code is located in one place which does it easier to work with and at the same time it can be applied on both sides simply by connecting the framework to the Application and to the Extension.
Relationship: Next level
Even if you divide code using Cocoa Touch Framework, it doesn’t provide an opportunity to exchange data immediately among the Containing Application and Extension which is often a vital necessity.
However if you desire to divide files, you require to read the data from file and write it into a divided AppGroup container on one side, then read data from divided App Group container and write it into the file on the other. But we can more likely get URL or path to our App Group container divided directory by using method containerURLForSecurityApplicationGroupIdentifier(_:)of NSFileManager class.
So, if you need to handle more than one request, for instance, one to look purchases and one to look some detailed information, you should create two URL schemes, and open a correct view due to URL paramether in URL handling method, that is described above.