Version First Edition
Platform iOS 14
Language Swift 5.3
Editor Xcode 12

For Complete Beginners!

If you’re completely new to Swift and iOS development (or need a brush-up), this is the series for you.

The iOS Apprentice is a series of epic-length tutorials for beginners where you’ll learn how to build four complete apps from scratch. Each new app will be a little more advanced than the one before, and together they cover everything you need to know to make your own apps. By the end of the series you’ll be experienced enough to turn your ideas into real apps that you can sell on the App Store. These tutorials have easy to follow step-by-step instructions, and consist of more than 1,100 pages and 500 illustrations! You also get full source code, image files, and other resources you can re-use for your own projects. If you’re new to iOS and Swift, or to programming in general, learning how to write an app can seem incredibly overwhelming. That’s why you need a guide that:

  • Shows you how to write an app step-by-step
  • With tons of illustrations and screenshots to make everything clear
  • In a fun and easygoing manner! We’ll start at the very beginning. The first tutorial assumes absolutely zero programming knowledge but still shows you how to build an entire game from scratch. The iOS Apprentice series doesn’t cover every single feature of iOS – it just focuses on the absolutely essential ones that you need to know. Instead of just covering a list of features, the iOS Apprentice series does something much more important: it explains how all the different building blocks fit together and what is involved in building real apps. You’re not going to create quick example programs that demonstrate how to accomplish a single feature. Instead, you’ll develop complete, fully-formed apps that are good enough to submit to the App Store!

Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book and more.

i

iii

Getting Started

This section introduces you to the first of the four apps you’ll build over the course of this book — Bull’s Eye.

As you progress through building the Bull’s Eye app, the section will teach you how to think like a programmer and how to plan your programming tasks. In addition, you’ll also learn how to use Xcode, Interface Builder, and even the basics of coding for iOS.

While some of the concepts in this section might seem a bit basic, please do not skip this section if you are new to iOS development – you will learn some fundamentals which act as the building blocks for what you learn later.

Welcome to The UIKit Apprentice! In this book, you're about to deep dive into the latest and greatest Swift and iOS best practices. You will build four iOS projects using Swift and UIKit. Good luck!

1

In this chapter, you will start building the initial screen for the Bullseye game.

2

Congratulations, you have a UIButton on the screen! It's time to start adding the UISlider which will be fundamental to the game.

3

Outlets

Free

In this chapter you will deal with random numbers, starting a new round of the game, and calculating the points scored.

4

It's time to calculate and display the score and the number of rounds played in this chapter.

5

Polish

Free

Add some polish to the game so that it actually looks like a game. Also, allow the user to re-start the game so that two people can play the game.

6

Let's spruce up the game UI with some fancy artwork and make your game stand out from the pack. Also, let's add an About screen with information about the game.

7

Phew! You have successfully created Bull's Eye. In the final chapter of this section you will learn about supporting different device sizes and add some beautiful animations.

8

Checklists

This section builds upon what you learnt in the previous section by introducing you to your second app. Checklists takes you from a single-screen app to a multi-screen app where you learn the concepts of navigation flow, displaying data lists, and the idea of modeling and persisting your data.

If you want to build any sort of list-based iOS app, this section is a good starting point for learning the basics. Of course, even if you aren’t building a list-based app, this section has some basic concepts such as handling the navigation flow from one screen to another (and back again) that would be very useful to an apprentice iOS developer.

Add a table view to show a list of to-do items and in the process learn about how to code navigation controllers and table views for iOS.

9

In this chapter, we'll set up a data model to represent our checklist items and then use the data model to display our to-do items.

10

All about navigation controllers — how to add them, configure them, and use them. Also learn how add a new screen to your to-do app and how to add the ability to delete to-do items.

11

Create the Add Item screen for your app and in the process, learn how to create custom table view cells, get user input, and add polish to data entry screens.

12

You'll learn about delegates and protocols, and how to use them to complete the add items functionality for your Checklists app.

13

Now that you can add items, learn how to edit added items. Also, refactor your code to optimize it.

14

Checklists works great but we can't persist our data — our to-do items are reset each time the app is re-launched. Let's learn how to persist our data between app sessions.

15

From one list to many - Checklists manages a single list of items at the moment. That's not very useful. Let's add the ability to have multiple lists of items.

16

Let's improve our data model so that we can have different to-do items for each checklist. We'll also implement a new saving strategy in the process.

17

Learn how to save application settings and other useful information between app sessions. Also, how to guard against possible crashes and to improve the first-run experience of the app so that your app looks more polished and user-friendly.

18

With the basic functionality for your Checklists app done, it's time to add some polish and functionality that makes your app stand out from the herd.

19

Learn how to add local notifications to Checklists so that you can be notified when a to-do item is due and how to manage notifications through the lifecycle of a to-do item.

20

My Locations

With this third section and the MyLocations app, you get into Swift programming in earnest.

Sure, you’ve already coded apps in the previous two sections, but this section starts off with a good review of all the Swift coding principles you’ve learned so far and adds to it by introducing some new concepts too.

In addition to that, you learn about using GPS coordinates, displaying data on maps, and using the iOS image picker to take photos using your camera or to pick existing images from your photo album. There’s a lot of valuable general information on Swift development as well as specific information about building location-aware apps.

This section also introduces you to building apps for Dark mode – a subject that you’ll do a deep-dive into in the next section.

You have made great progress! You've learnt the basics of Swift programming and created two applications from scratch. Now let's add some more Swift theory to strengthen the foundations we've built while creting those two apps.

21

This is the first chapter in this section which teaches you how to create a "location album" app. Take the first steps for creating this new app by learning how to use the Core Location framework to get your location and to display it.

22

You were able to access location data and display it in the last chapter. In this chapter, you will improve upon that code by handling GPS errors and improving the GPS accuracy. You'll also set up the app to handle different screen sizes.

23

Time for some more theory! You'll learn all about objects, classes, inheritance, and a few other object oriented principles from Swift that you need to be familiar with.

24

Time to get back to coding again. You'll learn how to build the Tag Location screen and how to set up another data entry screen for an iOS app.

25

The MyLocations app functionality is slowly taking shape now. So it's time to polish things up a bit by improving the user experience and adding some UI flourishes.

26

Learn all about how to save your locations on the device using Core Data, the object persistence framework for iOS.

27

Let's show the data that you're now able to save via Core Data as a list of locations. Learn about TableView sections, NSFetchedResults and deleting tagged locations.

28

Let's get visual! Show your tagged location on a map view using MapKit so that you can see where in the world each location is.

29

Learn how to use the built-in image picker in iOS to add images from either the camera or the photo album to your tagged locations.

30

It's time to give MyLocations a complete visual makeover! You'll change the styling for the app, add buttons for action items, add sounds, icons, and launch images.

31

Store Search

The final section of the book covers building an app which supports both Light and Dark appearances from scratch via the StoreSearch app. StoreSearch shows you how to have separate custom assets and colors for each type of iOS appearance.

But that’s not all! The app also shows you how to do custom screens both for specific orientations (landscape vs. portrait) as well as for specific platforms (iPhone vs. iPad). This section covers networking, working with remote API endpoints to fetch data needed by your app, and how to parse the fetched data, how to work with Stack Views, and how to add iPad support to your app.

If that wasn’t enough, this section also takes you through the full application life cycle – from developing the code, testing it, and all the way to submitting to Apple. So don’t skip this section thinking that you know all about iOS development after the last few sections!

Most iOS job listings say that you need to have worked with a REST API. Well, this chapter starts you on a new app which will teach you all about how to fetch data from a remote server and get you on the path to REST API mastery.

32

Learn how to display your data in a table view using custom table cells. Also change the appearnace of the app and do a bit of debugging.

33

Learn the ins and outs of making network requests to remote servers. Then, when you get a response to your request, learn how to parse the JSON response.

34

Learn why synchronous networking is bad and how to make things better by switching to asynchronous networking.

35

Learn about the powerful networking features provided by URLSession to make network requests that can be cancelled and how to download the image assets for your search results.

36

Learn how to add a detail pop-up to show more information about selected search results.

37

The detail pop-up works well but it can do with some more spit and polish to make it really shine. Learn all about adding dynamic type support, gradient backgrounds and more animations.

38

You've only dealt with a single orientation up to now. But your apps need to support both portrait and landscape orientations. Learn how to add landscape support to StoreSearch and by adding a custom interface.

39

You've made great progress with StoreSearch, but now it's time to refactor the code to smooth out a few of the rough edges. Knowing how to improve your code by refactoring it is an important skill to learn.

40

StoreSearch works great when the display language is English. But what if you wanted to support other languages? Learn all about internationalization and how to update your app to suppport multiple languages.

41

Learn how to optimize StoreSearch for iPad and to add iPad specific UI features such as split view conrollers and menu popovers.

42

After all that work, your app is finally ready. You just have one more gauntlet to run – the App Store submission process. Learn about the Apple Developer program, beta testing via TestFlight and how to submit your app for Apple approval.

43

Meet the team

Contributors

Who is this book for

This book is for anyone completely new to Swift and iOS development — or for those that just need a little brushing-up!

Concepts covered in this book

  • Working with Xcode
  • Coding in Swift
  • Building user interfaces
  • Modelling and persisting data
  • GPS and image data
  • Accessing remote APIs
  • iPad development
  • Publishing to the App Store

Version history

First Edition · iOS 14, Swift 5.3, Xcode 12

v9.0 · Oct 1 2020 · Fahim Farook & Matthijs Hollemans

Eighth Edition · iOS 13, Swift 5.2, Xcode 11

v8.3 · May 19 2020 · Eli Ganim & Joey deVilla

Eighth Edition · iOS 13, Swift 5.2, Xcode 11

v8.2 · Dec 3 2019 · Joey deVilla & Eli Ganim

UIKit Apprentice

By Fahim Farook & Matthijs Hollemans

In this iOS programming book for beginners, you'll learn how to build four complete iOS and Swift apps by following easy step-by-step tutorials.

Read for Free with an Ultimate Beginner Subscription* * Includes this and all other Beginner books in our online library See all benefits
Buy Individually $59.99 $29.99* *Includes access to all of our online reading features.
See buying options
Hide buying options

All videos. All books.
Now 50% off.

Build your mobile development skills and save! The mobile development world moves quickly — and you don't want to get left behind. Stay ahead of the rest with an Ultimate book & video subscription. Starting at just $149/year for Black Friday.