An app extension on iOS 8 and OSX is something that allows you to extend the functionality of an existing app by customizing it with content beyond its original programming. Extensions let you customize your usage of certain apps, making expanding or changing their use to suit a particular function. Developing extensions is an incredibly important part of using apps for businesses and other uses, because creating extensions is what will personalize their functionality in a way that supports whatever you’re doing- in the way you want the app to do it. This article is an overview of the process of creating an app extension, and takes a step-by-step approach for walking a new developer through the process.
When you create it, an app extension uses your coding to enable a specific task that you assigned when you wrote the extension, perhaps broadening its original functionality to include something new. Perhaps extending its usefulness to another topic within its existing functionality. For example, an extension to a social media app could enable sharing of posts and content directly on your website, saving you a step of re-posting or linking between different social networks.
When creating an app extension, it’s important to remember that users experience apps and their extensions in different contexts. This makes it very tempting to try to make an extension that’s a “magic bullet” and serves every function of the app. Apps cover a variety of tasks and features, but extensions are often quite limited in how they interact with the app and with users. At their best, they streamline one particular and focused use of the app.
Trying to make them apply generally over the app’s entirety doesn’t play to the strength of an extension, and will probably only confuse users and defeat the purpose of streamlining anything at all. When designing an extension, it’s really in your best interest to limit your vision for what you want the extension to do, and make sure it does that thing very well. More than anything, that’s the key to a successful app extension.
Create an app extension
The process for creating an app extension seems intimidating at first, but is really quite simple. Apple has always designed with user-friendliness in mind, and this really does show through in the process for creating app extensions. The following are the eight steps that go into creating an app.
Step 1: Choose the extension point
Your first job is to find the extension point, which is place where the app’s original functionality ends and your app plans to begin. This point has to support what you plan to do with the extension, but it also has to make sense from a user perspective. Take some time to consider whether your extension point is intuitive enough that new and returning users of the app will be able to pick up your extension and immediately use it.
App extension templates are skeletons that you can easily build an extension over. Each of them includes a list of properties, a view controller class, and a default user interface. Choosing one of these makes the rest of your job a lot easier, and they offer plenty of tools for customization, as well.
Step 3: Answer host apps request.
The host app is the app your extension expands on. When a user chooses an extension within a host app, the host app issues a request, the extension receives the request, helps the user perform a task, and then completes or cancels the request, according to what the user commands. Using the “beginRequestWithExtensionContext:” command, you can set up how exactly this works within the host app. Using the extension point you’ve chosen, you can set up how the extension triggers and how it presents itself to users.
Step 4: Optimization
As mentioned previously, app extensions should really be streamlined. Using an app should feel fast, lightweight, and polished. To that end, memory limits for running extensions are dramatically lower than they are for apps or other programs. If an extension launches too slowly, the system will terminate the process and the extension won’t work. Similarly, if it starts edging toward a data limit while the app is running, the system will automatically shut down peripheral processes like extensions aggressively until the requisite memory is freed up. For these reasons, it’s very important to design with memory limits in mind.
Step 5: Streamline UI design
Although it’s more of an aesthetic consideration, a streamlined UI is just as important as memory optimization. Most extension points require a customized UI to control the app extension as it’s firing, so there will almost always be an aspect of this in designing an extension. Start with the basics and make sure everything is easy to differentiate from other things. Make sure you have an icon for your app, as well, in order to access settings and features from outside the extension point.
Step 6: Test on all devices
Something a lot of new creators of app extensions forget is that apps are available on a variety of devices with different architecture. An extension that works perfectly on a smartphone might crash a laptop computer or a tablet. Make sure your testing process takes considerations of different devices into account and ensures that it will function no matter what the user is activating it on.
Step 7: Debug, profile, and test
The debugging stage of any tech endeavor is always tedious, but it’s also very necessary. Bugs can occur in any stage of development, so its important to check your work regularly to make sure things are working properly. Xcode is a useful tool for debugging, and using it to debug an app extension is about the same as using it for any other code. Once debugging is complete, create a profile for the app extension. This is also done using Xcode, which registers an extension that was built and then debugged.
Step 8: Distribute
The final step of creating an app is to release it to the wider world. This can be done in two ways. If the app you extended was open-source or you have property rights for the app itself, you can bundle them together and release it all in one package. If not, then you’ll have to release your extension individually and then provide installation instructions. Bear in mind that if you are developing for iOS, your extension must be submitted to the Apple Store. If you are developing for OSX, it’s not required, but it is definitely still recommended.