How to add extensions to iOS apps (part 1)

iOS Development, Tutorials

App extensions allow you to perform various actions without running an app: share photos on Facebook, send files as an e-mail attachment or open an article. If you are developing an iPhone app and want to find out more, keep reading and learn how to add extensions to iOS apps!


I prepared a series of four articles that take up the issue of creating an app that serves to store and display a list of files. Maybe it doesn’t sound too fascinating, but trust me: it can be very useful.

Kickstart our iPhone app development

First we will need to create a project. To do that run the Xcode environment and select: File/New/Project…
Next, mark iOS/Application/Single View Application and click the “Next” button.

How to add extensions to iOS apps

Creating the project

Name the app and select “Swift language”. Click the “Next” button and select a localization to save your project.

App ios developer

Setting project options

After creating the project, a workspace with an open settings file should display. At this moment we don’t change anything unless we want a different Deployment Target (if so, remember that it can’t be lower than 8.0).

iOS app development

Settings

Creating the iOS application view

Now, we can create the main app view, in other words, a chart which will display saved files.
Move on to the Main.storyboard file, then add Table View controller to the already existing View controller and add all constraints with a 0 value so that the chart fills our whole view.

iOS app building

Creating the iOS application view

Open the ViewController.swift file in Assistant Editor and add an outlet to our table.

Mobile enterprise solution

Adding an outlet to the table

Now we should move on to the implementation of proper delegates to the chart and files display mode but first, prepare needed elements to fill our table.

How to add extensions to iOS apps

First off, we have to add the extension to iOS app and then we’ll enable access to the shared resources. Select from the menu File/New/Target…
A window, from which you can select the extension type, should display now. Select the first one, Action Extension, and click the “Next” button.

iPhone app development

The extension type

In the next window, choose the extension name. In my case it is the app name with added “Action” at the end of it (to suggest the extension type). If we want an individual style while using the extension, we have to leave the chosen Action Type on the Present User Interface. Click the “Finish” button to approve it.

How to add extensions to iOS apps

The extension settings

The Target we’ve added should appear in our project settings. In the explorer we can see a directory with the extension name and its files.

App iOS developer

Directory with the new extension


Next on “How to add extensions to iOS apps”:

  • enable sharing of the application resources
  • create a manager for saving and reading files

Sources:
Photo by James Broad


YOU CAN HAVE A LOOK AT THE FINISHED APP IN OUR GITHUB REPO HERE.


 

Paweł Kuźniak Mobile Developer

Paweł is an iOS developer at Zaven and a committed Rubik's cube aficionado. He can solve a 3x3x3 in a matter of seconds and you can find more complicated ones lying around on his desk (solved, obviously). His problem-solving attitude is reflected in his work, as he likes to keep himself busy with non-trivial puzzles.

Popular posts

Enhancing API Testing Efficiency with JavaScript in Postman

Enhancing API Testing Efficiency with JavaScript in Postman

API testing is essential for good software, and Postman has made it easier by letting us use JavaScript to check our work. In this article, we'll see how using JavaScript in Postman helps us make sure our software is working right, saving us time and making our testing process smoother.

Read more
Flutter application template with GitHub Actions

Flutter application template with GitHub Actions

This article explains how to create Flutter application template with GitHub Actions to save yourself time and nerves.

Read more
Augmented Reality as a trend in Mobile Development

Augmented Reality as a trend in Mobile Development

3D maps, realistic games, virtual showrooms and fitting rooms, interactive participation in a conference or concert, visiting museums and exhibitions. These are just a few examples of where Augmented Reality can be used. Applications created with the help of AR effectively combine the real world with the virtual one. Can your business also benefit from […]

Read more
Mobile Apps

Get your mobile app in 3 easy steps!

1

Spec out

with the help of our
business analyst

2

Develop

design, implement
and test, repeat!

3

Publish

get your app out
to the stores


back to top