iOS Development

SYLLABUS
9 Sections
Introduction

1Introduction

Welcome to the world of Apple’s mobile platform, you must be here to learn about the basics of iOS development. Here we will give you a guide to learn the process from the ground all the way to an experienced developer. With time and dedication, you can make it happen on your own, just make sure not to give it up before the finish line.

Nowadays, in the time of cloud computing, it’s easy to start learning even without a single Apple device. Back in the day, when Objective-C was the only way to code for iPhone, it was thought difficult to learn even the basics of iOS development.

In this syllabus we will provide sources and tips where to start learning, what courses you should complete, where to continue on, and some libraries you should get familiar with early or should try later on.

Prerequisites

2Prerequisites

Swift

At 2014 Apple introduced its new general-purpose, multi-paradigm, compiled programming language called Swift. It’s an alternative to the Objective-C language that employs modern programming-language theory concepts and strives to present a simpler syntax. During its introduction, it was described simply as “Objective-C without the C”. After version 3.0, we kinda say it’s production ready, it’s excellent for learning proposes and in-house apps, but not always sufficient for enormous corporate products on it’s own.

Left: rough percentage of Swift code used in projects. Right: current usage by sectors

For learning the basics of Swift language, you will only need a browser and the IBM Swift Sandbox where you can get familiar with the syntax and more

It’s important to learn the basics of the swift programming language before going right into building applications with user interfaces. If you already have some experience in another programming language, you may want to pick up the swift syntax real quick, and then move into developing apps

OS X – macOS

Native iOS development can only be done on macOS or formerly know OS X which is Apple’s Unix-based graphical operating systems. The easy way is buying a Macintosh computer with is preinstalled with one of the macOS versions. However they are expensive to buy, but there must be a way to get a macOS up and running, right? Well, sort of. The easiest way is to subscribe to a cloud based solution like MacInCloud, which as it’s name implies gives you a Mac in the Cloud for a monthly fee. Or if you own a powerful Intel based PC, than you can try to install it on a virtual machine or even install it directly and make your own Hacintosh. However those ways are unofficial and unstable and we not gonna disquss it any further.

Obtaining a device

Most of Apple’s sensors are only available on real devices. So, it’s highly recommended to own at least an up to date iPhone, not only for testing, but to get familiar about how a specific sensor should be used for unique features. But from now on, you can start your journey to become an iOS developer with the iOS Simulator.

Xcode

8Xcode

Apple’s integrated development environment aka IDE. It’s only available on the Mac App Store for free and include the tools, compilers and frameworks for iOS, tvOS, watchOS and macOS development.

Interface Builder

Xcode has an integrated XML Interface Builder to visually edit iOS, watchOS, tvOS and macOS interfaces stored as XIBs/NIBs and Storyboard files. Simply drag and drop windows, buttons, text fields, and other objects onto the design canvas to create a functioning user interface without writing any code. If you’re confused on some of the terminology, don’t worry! Click on the resources below this section, which will take you into the wonderful world of xCode.

Simulators

With Xcode, you can not only access iPhone simulators, but iPad, watchOS and tvOS simulators as well. You can also download older iOS versions to your simulators to test against older targets if needed. iOS has a very high adaptation rate and their devices are supported for more than 3 years, so building against oldes iOS versions are really unnecessary by default.

Instruments

Instruments is a powerful and flexible performance-analysis and testing tool that’s part of the Xcode tool set. You can hunt for memory leaks, or profile your code’s performance and more.

User Interface

9User Interface

View Controllers

The user interface will be built by static and dynamic elements. The simple elements like UILabel, UIButton, UITextfield, UITextView, UIScrollView, etc are mostly not reuseable by their own and made to present static elements, while UITableView and UICollectionView is built in mind to present reusable content efficiently. They can handle 1000 of cells and items with high performance if you fulfill some simple rules. You can find an article about smooth scrolling in the resources.

The interface is based on a Model-View-Controller design pattern, where the interface can be built using the Interface Builder without any code. Then you can connect and add the code for its corresponding view controller.

Storyboards

Introduced in iOS 5, Storyboards are an exciting feature that save time building user interfaces for your apps. It allows you to prototype and design multiple view controller views within one file, which could be a blessing and a curse. For smaller projects, it’s more than ideal, but working with multiple people or with more than a couple of view controllers, it can be a real pain.

Auto Layout

A constraint-based approach that allows you to build user interfaces that dynamically respond to both internal and external changes. Auto layout is not as difficult as some developers thought. Once you understand the basics, you will be able to use auto layout to create complex user interfaces for all types of iOS devices.

Storing User Data

9Storing User Data

Saving Data

Most of the time you need to store at least a few small details about your user, like a name, a password, a session token or a Boolean value about a fired tutorial screen. While other times you need to maintain a whole bunch of data in a complex database, or just save same draft images to the disk.

Saving Data to Shared User Defaults

The simplest way to save non-critical user data is to store in the user defaults. It’s just like a dictionary, a static collection of key-value pairs. Have you ever find some hidden toggles for an iOS app in the settings? Those values are also stored here for sure.

Saving Data to Keychain

Sometimes you have to store critical user information, most likely a password. Then it’s time to use the built-in keychain for that, but don’t forget to save yourself some headache and use one of the nice wrappers over there.

Saving Data in Files

Sometimes it’s easier to save to a file, like caching images for faster reloading, or saving a big, complex data structure of a game. Compared to Android, you can only save to your sandbox folder by default, which is not accessible by other applications.

Saving Data to Core Databases

A lot of the times you have to save and gather complex relational structures in your application, in this case you have to plan and build a database. Core Data is Apple’s database solution built on top of an SQLite database.

Notifications

9Notifications

Local Notifications

Sometimes you need to remind the user once or twice at a specific time. You can make this by secluding some local notifications which can also be repeated in specific time periods.

Push Notifications

Other times notifications triggered by remote events, like other users, or the developer tries to reach you with some information. These push notifications can contain new data and could even wake your app for a small period to fetch new information.

Libraries & Community

5Libraries & Community

Cocoa Controls

By using open source UI components, wrappers or frameworks, you can save a ton of time, therefore you can spend more time to make your app awesome. Don’t hesitate to use as many as you like. Find the most awesome ones in the resources.

CocoaPods

It’s a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. CocoaPods can help you scale your projects elegantly.

Community

If you’re stuck, you can find lot of experienced developers in StackOverflow, Reddit or at the Ray Wenderlich forums. Learn how to search efficiently and you don’t need to ask 95% of the time.

Distributing Your App

4Distributing Your App

Apple Developer Program

Once you finished your first app, you may want to distribute it to testers or to the world, right? For both you need to enroll to the Apple Developer Program, which will cost you 100$ a year. With a paid developer account, you can access all the latest beta software and can distribute to iPhone, iPad, Mac, Apple Watch, and Apple TV.

Archiving your App

To create a distributable iOS application archive aka IPA, you need to setup your code signing properly and archive your product with Xcode. The archive will contain all of your code and resources (images, fonts etc.) in one bundle. You can find your previous archives as well as your new archive in the Organizer window, where you can upload, export or validate it.

Submitting Your App to the Store

If you’ve already set up your iTunes Pages with the corresponding app id, then you are read to upload. However, if you miss something, the uploader will let you know otherwise. You can find a complete tutorial in the resources.

What’s Next?

6What’s Next?

Speed up development

After a while, you will notice that hall of your coding spend on setting up tableview for a signup form or for some dynamic data. Well, you can speed this up by making a few template Storyboards, but there must be a better way, right? Well there is, and one of the best solution is using eureka which is an elegant iOS form builder written in Swift, with built in solution for all the most popular tableview usages.

Reactive Programming

“ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming”.

In short, using RxSwift will make your code:

  • Composable <- Because Rx is composition’s nickname
  • Reusable <- Because it’s composable
  • Declarative <- Because definitions are immutable and only data changes
  • Understandable and concise <- Raising the level of abstraction and removing transient states
  • Stable <- Because Rx code is thoroughly unit tested
  • Less stateful <- Because you are modeling applications as unidirectional data flows
  • Without leaks <- Because resource management is easy

It’s a long one, and we not gonna discuss it now, but for a proper introduction, click here.

Unit and UI Testing

After a while you will probably work on a bigger project with some other folks. And working on a bigger scale, especially delivering for a huge community, you have to be 100% sure you not break someone else’s or even your previous work. Writing Unit and UI tests to automatically check your already well written parts will help you minimise accidently breaking functions. Try to exercise writing tests in-house time to time, so you keep yourself in shape for tests and will meet your clients needs better.

Laszlo Tuss
MENTOR
Freelancer iOS developer. With more than 5 years of experience in iOS Development, started with Objective-C and without ARC, all the way to Swift, watchOS and tvOS. Now I’m trying to build my client base while working on in-house projects. Feel free to contact me with any questions and good luck with your learning.