Shape Shape point chapter-list Group Group Group Group Group Shape Copy 12 Shape Shape Copy 3 Shape Shape dropdown editor editor Combined Shape grid Shape Copy 4 Shape Copy 7 Shape language language Shape megaphone paperback Shape platform noun_419259-2 copy play-icon Group BS-Question-Rounded-Circle quotes noun_610406 stacked-books-1 stacked-books-2 Group Group Group Group Group Group Group Group Group Path

Swift Apprentice

$59.99 4.8/5 12 reviews · Write a Review
  • Platform iOS 13
  • Language Swift 5.1
  • Editor Xcode 11

Beginning programming with Swift! This book takes you from beginner to advanced in Swift: Apple’s modern programming language for iOS.

Developer Guide


For Beginner Developers

This book is for complete beginners to Swift and coding. No prior programming experience necessary!

This is a book for complete beginners to Apple’s new, modern programming language — Swift.

All the code in the book works inside of Xcode’s easy-to-use playgrounds. That means you can focus on core Swift language concepts, such as classes, protocols, and generics, instead of getting bogged down in the details of building apps.

This is a companion book to the iOS Apprentice; the iOS Apprentice focuses on building apps, while Swift Apprentice focuses on the Swift language itself.

We also recommend

Table of Contents

Section I: Swift Basics


Expressions, Variables & Constants

This is it, your whirlwind introduction to the world of programming! You’ll begin with an overview of computers and programming, and then say hello to Swift playgrounds, which are where you’ll spend your coding time for the rest of this book. You’ll learn some basics such as code comments, arithmetic operations, constants and variables. These are some of the fundamental building blocks of any language, and Swift is no different.


Types & Operations

You’ll learn about handling different types, including strings which allow you to represent text. You’ll learn about converting between types and you’ll also be introduced to type inference which makes your life as a programmer a lot simpler. You’ll learn about tuples which allow you to make your own types made up of multiple values of any type.


Basic Control Flow

You’ll learn how to make decisions and repeat tasks in your programs by using syntax to control the flow. You’ll also learn about Booleans, which represent true and false values, and how you can use these to compare data.


Advanced Control Flow

Continuing the theme of code not running in a straight line, you’ll learn about another loop known as the `for` loop. You’ll also learn about switch statements which are particularly powerful in Swift.



Functions are the basic building blocks you use to structure your code in Swift. You’ll learn how to define functions to group your code into reusable units.



This chapter covers optionals, a special type in Swift that represents either a real value or the absence of a value. By the end of this chapter, you’ll know why you need optionals and how to use them safely.

Section II: Collection Types


Arrays, Dictionaries, & Sets

Arrays are the most common collection type you’ll run into in Swift. Arrays are typed, as are regular variables and constants and store multiple values like a single list.


Collection Iteration with Closures

Swift has an object you can use to break up code into reusable chunks: a closure. These are particularly important when dealing with collections.



Finally, you will revisit strings, which are actually bi-directional collections of unicode characters.

Section III: Building Your Own Types



This chapter introduces structures, which are the first named type you’ll learn about. Structures are types that can store named properties and define their own behaviors.



In this chapter, you’ll learn about stored and computed properties, along with some tricks to deal with properties, how to monitor changes in a property’s value and delay initialization of a stored property.



Methods are merely functions that reside in a structure. In this chapter, you’ll take a closer look at methods and initializers.



Structures introduced you to your first named type, which lets you define your own named types. In this chapter, you’ll get acquainted with classes, which are much like structures.


Advanced Classes

This chapter introduces the finer points of classes and helps you understand how you can create, use and manage complex classes.



In this chapter, you’ll learn how enumerations work and when they’re useful. As a bonus, you’ll finally discover what an optional is under the hood.



Protocols are a type that can bridge common behaviors between structs, classes, and enums by defining an interface or template for an actual concrete type.



In this chapter, you’ll learn what generics are, learn how to write your own generic code, and loop back and look at the generic types in Swift - dictionaries, arrays, and optionals - from this new perspective.

Section IV: Advanced Topics


Access Control, Code Organization, & Testing

Swift gives you powerful tools for hiding complexity and organizing your code into easier to digest units. This chapter details how to do that.


Custom Operators, Subscripts, & Keypaths

You’ll learn how you can define your own operators and subscripts to make your types feel even more like built-in language constructs.


Pattern Matching

With pattern matching you can accomplish more — with less typing. You’ll master all of its many forms in this chapter.


Error Handling

In the real world, some errors cannot be avoided. Handling them gracefully is what sets apart mediocre code from great code.


Encoding & Decoding Types

You will learn about the type serialization system introduced in Swift 4 with particular emphasis on the JSON format.


Memory Management

This chapter digs into the details of Swift memory management examining the relation between objects. It shows you how you avoid common leaks.


Value Types & Reference Types

Value semantics have a clear advantage over reference semantics in terms of the local reasoning but can lead to inefficiency for large objects. This chapter shows you how to get the best of both worlds.


Protocol-Oriented Programming

From the standard library to user authored generics, Swift is a protocol-based language. In this chapter you’ll see how to get all of the benefits associated with object-oriented programming while being able to avoid most of the difficulties.


Advanced Protocols & Generics

Learn how to use constraints to make generic code more useful and how to hide implementation details with opaque return types.

Meet the Team

Customer reviews

Swift Apprentice

Clear tuition without guesswork or confusion. Concepts that are easy to absorb.

Rob W.

Apple's documentation is great, but it lacks the gentle approach of this book. I always have the PDF open for quick lookups!

Blaise B.

As a novice developer trying to learn Swift, this series was exactly what I needed to get started. It shows you how to build actual applications that teach you many of the fundamentals of Swift.

Seth M.

Average Rating

4.8 /5

Leave a review for this product

12 reviews

Swift Apprentice

Beginning programming with Swift! This book takes you from beginner to advanced in Swift: Apple’s modern programming language for iOS.