1. Home
  2. Documentation
  3. After Dropsource
  4. Customizing and Extending
  5. Editing an iOS Project

Editing an iOS Project

With your source code imported into Xcode, you can make any changes you like before testing and releasing your app. Depending on what you plan to change in your project, you may need to edit a number of files located throughout the directory structure. Read on to learn about how your app design and functionality are delivered, and the key locations you’ll need to edit to make particular types of alteration.

ⓘ Note

Bear in mind that once you make changes to the downloaded code your Dropsource project will no longer be up to date, so make sure you have completed all of the steps you need in the editor before you spend any time working on your downloaded app. If you need to add functionality that isn’t currently available in Dropsource but want to continue working in the Dropsource editor later, get in touch at help@dropsource.com in case we can help you to achieve the behavior you need, for example using plugins.

Project Editor

With your project open in Xcode, selecting the root folder in the Project Navigator on the left will open the project editor, in which you can set various app-wide properties including the Capabilities, where you specify any functionality that requires additional permissions.

ios capabilities

You will typically manage the capabilities that you can include in your app via an Apple Developer Account so that you can distribute your apps through the App Store. See the official guidance for more detail.

If you plan to use external libraries in your app you may also need to edit the Build Phases section of your project settings.

Swift Code

Your iOS application logic will be written in Swift. You’ll find your Swift files named with “.swift” extension in the folder with the same name as the app.

view controller

Each page in your app is represented in the project as a View Controller, so you’ll see a Swift View Controller class file for each page you created in Dropsource, as well as some additional classes for other parts of the app functionality including any API processing.

Select a View Controller class to open its code. Inside the class file for a page you’ll find the code for the View Controller itself, and also classes for some of the Elements you added inside the page. In the page View Controller classes, you’ll see functions representing the page lifecycle Events, which you may have added Actions to inside Dropsource. For example, this excerpt of the Place Search example app shows the Place page viewDidAppear function, which runs an API request on Page Appeared:

view did appear

Certain Element classes will also contain lifecycle Event functions, such as this example, where the app carries out an Action when a View inside a Page Controller loads:

image view controller

User Interaction

You’ll find the Swift implementation for any Actions you added to user interaction Events inside the View Controller files. There will be functions for each Event your app responds to, for example this section of the Place Search app, which specifies a function for the app to execute when the touchUpInside Event fires on the website button:

button touched up

The touchedUpInsideWebsiteButton function (along with any other button touch Event functions) is listed in the same file, so you can see how they implement any Actions you added.

Certain user interaction responses in your app will employ the Delegation pattern, as in this example, which handles the user selecting a Table Cell, using didSelectRowAt:

table cell touch

Page Navigation

Throughout your app, you’ll see the code instantiateViewController used as part of the page navigation implementation, as in this part of the Place Search app, when the user taps the Comments Button and moves to the Comments page:

ios page nav swift

Notice that in this case the placeid Page Variable data is passed into the page. The detail of how the new page is actually presented to the user will vary depending on the type of transition being used – the example above uses push transition, whereas this excerpt from the GitHub IT example app uses fade:

fade transition swift

In this case the app is navigating to the Issues page, which expects a few Page Variables.

Managing Data

Any Device Variables in your app will be implemented using the User Defaults, as in this example where a variable called “name” is set with the content of a text-field:

swift set var

If you plan to extend your app to use structured data, for example with Core Data, you will implement changes in your View Controller Swift files and potentially also your app storyboard.

API Data

You’ll find any API requests in your app inside the View Controller classes too, like this example where the app is making a request to Google Places API when the user taps a Button:

swift api request

Notice that this code uses a Manager class – this class handles the details of any APIs added to the app, so you’ll find general API information such as host URL and authentication setup here:

github swift manager

If you make edits to the Swift files in your app, Xcode will prompt you with code suggestions and will highlight syntax errors as you work. Changes to your app logic will typically be made in the View Controller class files for your pages.

App Design

In the Images/xcassets directory, you’ll find any images you added to your project using the Dropsource Media modal.

xcode assets

The layout for your app is defined in Main.storyboard, which includes the design for each page.

xcode storyboard overview

Selecting an Element will allow you to edit its properties via the Attributes and Size inspectors on the right of Xcode.

xcode element properties

The structure of your storyboards will reflect the page hierarchy you created inside Dropsource using the Element Tree. If you want to make design changes you can use the controls to add Elements, to control the page structure, to set Element properties, and to see your design in different device configurations.

To add an Element to your storyboard, in the bottom right section of Xcode select the Object Library, start typing into the text-field to search for the Element type, then when it appears, drag it onto the storyboard.

object library

Testing your Changes

You can run your project from Xcode on a simulator or physical device connected to your computer at any time. Once your app is running, Xcode provides a range of features to help you debug it. You will see basic debug log messages at the bottom of the Xcode window, but you can also access a range of advanced testing and debugging settings in the navigator pane on the left.

debug navigator

Working on your App

Depending on the edits you plan to carry out, and your previous experience working with Swift, you may be able to add your enhancements quickly and easily, however if you try to make an amendment to your code and find it trickier than you expected, get in touch help@dropsource.com in case we can help by adding a plugin to your original Dropsource project.

Was this article helpful to you? Yes No

How can we help?