We are happy to give you free online access to our best book to start building iOS apps: the iOS Apprentice! Available for a limited time as part of the raywenderlich.com Community Care project.

iOS Apprentice

Eighth Edition

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

By Eli Ganim & Joey deVilla

5/5 9 Ratings

Version

  • Eighth Edition · Swift 5.2, iOS 13, Xcode 11

Who is this for?

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

Covered concepts

  • 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

Before You Begin

i

iii

Getting Started with UIKit

Welcome to **The iOS Apprentice!** In this book, you're about to deep dive into the latest and greatest Swift and iOS best practices. Throughout this six-section book, you will build six iOS projects using both UIKit and SwiftUI. Good luck!

1

In this chapter, you will start building Bullseye using UIKit, Apple's existing way of building UI for iOS apps.

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

You'll be well on your way of noticing the differences between building an app using SwiftUI and now UIKit. In this chapter you will deal with random numbers, adding rounds to the game and calculating the points scored.

4

It's time to start calculating the score for the gameplay in this chapter.

5

Polish

Free

In this chapter, we will add some UIKit polish to the app and show an alert to the user.

6

The look of your app is super important now as many apps flood the App Store. In this chapter, we're going to spruce up the UI with some fancy artwork.

7

Phew! You have successfully created Bullseye using UIKit. In this final chapter of this section you will learn about supporting different device sizes and add some beautiful animations.

8

Checklists

We're going to look at UITableView and UINavigationController in this Chapter. The majority of your apps in the future will be using these key frameworks provided by Apple.

9

In this chapter, we're going to introduce you to MVC (a programming design pattern) widely used in the Apple ecosystem. We will also separate our data logic into models.

10

A UINavigationController is super important to control the flow of the navigation in our apps. We'll introduce you to it here and start building out the navigation stack ready for the next chapter.

11

A to-do list app is no good if we can't add an item, right? In this chapter we'll create a new screen to do just that.

12

In this chapter we'll introduce you to Delegates and Protocols and the concepts within. Again these are widely used across iOS development.

13

Edit Items

Free

You've tackled adding a new item, we're now going to build out the functionality of our to-do list app with editing existing items in our list.

14

Our app is looking great, but every time you launch the app the data will be lost! Let's fix this by exploring how to save data and show a loading HUD.

15

Lists

Free

Our app currently only manages one list of to-do list items. Let's explore having multiple lists in this chapter.

16

In this Chapter, we're going to improve our data model and make our app more scalable for the future. 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.

17

UserDefaults is a very popular framework provided by Apple and can be seen in many apps. Let's explore UserDefaults and why it will fit this project perfectly.

18

In this Chapter, we're going to make some vital UI improvements

19

To finish Checklists it's time to explore LocalNotifications and their use.

20

My Locations

You have made great progress. You have built your first app using UIKit which is some achievement. Whilst we have been writing the apps using Swift, you will need some additional theory to level up your knowledge. In this chapter, we will go into details about some of the Swift language, such as Variables, Constants, Types, Methods & Functions, Loops, and Objects.

21

Are you ready for the final app challenge? In this chapter, you will commence the final app MyLocations. It's all about using the Core Location framework and displaying using MapKit.

22

You've learned about getting GPS coordinate information. Now it's time to deal with GPS errors, improving GPS results and testing on real devices to mimic real-world scenarios.

23

This question will most likely crop up in your next iOS interview. It's time to put the toolbox down and learn some theory. Expect to learn about classes, inheritance, overriding methods and casting an object.

24

In this chapter, you will be picking up the toolbox again and building our tag location screen. This involves building out some TableViewCells, displaying location info and adding a category picker.

25

Who doesn't love adding a bit of polish? It's time to start making it look more like an app ready for the App Store. We will improve the experience of the app and add a loading 'HUD'.

26

At this point, you have an app that obtains GPS coordinates and allows the user to tag the location. We're going to be deep-diving into Core Data, the object persistence framework for iOS apps.

27

Now that you can persist the data to Core Data, we're going to explore displaying this data in the TableView. Learn about TableView sections, NSFetchedResults and add functionality to delete tagged locations.

28

Maps

Free

Showing a list of locations is great, but not very visually appealing. In this chapter, you will learn about MapKit, the awesome map view control giving in the iOS toolbox.

29

UIKit comes with a built-in view controller, UIImagePickerController that lets users take new photos or select existing ones. In this chapter explore this controller and how best to display the image on the screen.

30

You have made it this far! It's time to give MyLocations a complete makeover. Prepare your pixel paintbrush for this chapter and let's get your creative flair at the ready. In this chapter you will cover the map screen improvements by adding icons, polishing the main screen and adding some cool effects to the app.

31

Store Search

Search Bar

Free

One of the most common tasks for mobile apps is to talk to a server. In this final UIKit app you will build StoreSearch. In this chapter, you will build the first screens, add fake searches and create the data models.

32

Before your app can search the iTunes store for real, we need to make the app look visually appealing. In this chapter, you will cover custom table view cells and nibs. Learn a little more about using git and the debugger right inside Xcode.

33

Networking

Free

Networking you say? Start querying the iTunes web service by using HTTP requests. An introduction to JSON and best to convert them into data models and finally look at how best to sort results.

34

Phew! You will rarely want to block the main thread with a network request. In this chapter, we will explore asynchronous networking and finally showing an activity indicated to let the user know something is loading.

35

URLSession

Free

The iOS toolbox and the Swift language has many tools for our disposal, including URLSession. In this chapter, we will explore URLSession and it's many benefits. Downloading the iTunes artwork and how best to merge your git changes.

36

In this chapter, we will create a detail pop-up view when a user taps a row in the TableView. We don't want to display too much information now, do we?

37

We're about to get the polish back out again. The detail pop-up view is working well but we can display the information better. Learn about dynamic types, gradients for the background and let's explore adding some more animations.

38

Landscape

Free

Users expect apps to work in both portrait and landscape. They also expect the app to look great in both orientations. In this chapter, we will learn about adding a completely different user interface for landscape vs. portrait.

39

The final app is looking great. You should put your feet up and grab a coffee! Programming is all about building new pretty features but when you join an existing company with an existing code-base you have to learn about the best ways to refactor existing code. Let's go!

40

So far our app works great in English. But if you want your app to go international you must support multiple languages and formats. In this chapter, you will explore adding support for a new language and look at regional settings.

41

The iPad

Free

Even though the app works _OK_ on the iPad, but it's not exactly optimized for the iPad. In this chapter, we're going to explore universal apps, the split view controller functionality, and dark mode support.

42

Are you ready to ship to the App Store? Finally, you will learn the key fundamentals on how to ship the app to the App Store, including the Apple Developer Program, beta testing using TestFlight and finally submitting to the App Store.

43

Getting Started with SwiftUI

Take the first step of building a SwiftUI game by creating your iOS project, add some interactivity with a UIButton and learn all about the anatomy of an app.

44

Bullseye is all about the slider, get sliding in this chapter by using the Slider control and start constructing the first steps of a working game.

45

Apps are known for their clean and simple UI. We will spice up the artwork in this chapter and make it look like a *real* game. We will also make improvements to landscape orientation.

46

Checklists

It's time to start your next iOS project. Are you ready for the challenge? In this chapter, we will commence our next app using SwiftUI, Checklists. Before we dive into building Checklists this chapter will cover a Playgrounds project and explore some core concepts.

47

List Views

Free

It's time to start your next iOS project. Are you ready for the challenge? In this chapter, we will commence our next app using SwiftUI, Checklists. Prepare for NavigationView, Arrays, Loops and removing items from the list.

48

A Checklist app without being able to tick off the items? In this chapter, you will add the toggle for a Checklist item.

49

You have eagerly made great progress on creating a TODO list app by adding the checked status. In this chapter, you will start adding more features and start thinking about iOS design patterns.

50

Your goal in this chapter is to start adding new items to your TODO list app. It also included learning about CRUD (Create, report, update and delete).

51

Congratulations! You can now add new items to your TODO list app, in this chapter, it's time to start editing your list and changing the text.

52

In this final chapter for your TODO list app, you will learn about data persistence. Right now all the items are hardcoded so it's time to persist and go!

53

Conclusion

Free

54

Contributors