ShapeShapeGrouppointGroupchapter-listShapeShape Copy 12ShapeShape Copy 3ShapeGroupShapedropdowneditoreditorCombined ShapegridShape Copy 4Shape Copy 7ShapelanguagelanguageShapemegaphonepaperbackShapeplatformnoun_419259-2 copyplay-iconBS-Question-Rounded-Circlequotesnoun_610406stacked-books-1stacked-books-2Shape Copy 5 Combined Shape Group Group Group Group Group
swift apprentice book cover
On Sale

Swift Apprentice

$49.99 $54.99
  • Platform iOS 11
  • Language Swift 4
  • Editor Xcode 9

Beginning programming with Swift 4.

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

Developer Guide

Beginner

for beginner ios developers
swift apprentice book cover

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

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

Everything can be done in a playground, so you can stay focused on the core Swift 4 language concepts like classes, protocols, and generics.

This is a sister book to the iOS Apprentice; the iOS Apprentice focuses on making apps, while Swift Apprentice focuses on the Swift 4 language itself.

We also recommend

Table of Contents

Section I: Swift Basics

1.

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.

2.

Types and 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.

3.

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.

4.

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.

5.

Functions

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.

6.

Optionals

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

7.

Arrays, Dictionaries, and 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.

8.

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.

9.

Strings

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

Section III: Building Custom Types

10.

Structures

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.

11.

Properties

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.

12.

Methods

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

13.

Classes

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.

14.

Advanced Classes

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

15.

Enumerations

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.

16.

Protocols

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.

17.

Generics

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: Beyond the Basics

18.

Access Control and Code Organization

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

19.

Custom Operators and Subscripts

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

20.

Pattern Matching

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

21.

Error Handling

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

22.

Encoding and Decoding Types

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

23.

Asynchronous Closures and 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.

24.

Value Types and 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.

25.

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.

Meet the authors

Janie Clayton Janie Clayton RW Team Member
Alexis Gallagher Alexis Gallagher RW Team Member
Matt Galloway Matt Galloway RW Team Member
Eli Ganem Eli Ganem RW Team Member
Ben Morrow Ben Morrow RW Team Member
Cosmin Pupăză Cosmin Pupăză RW Team Member
Steven Van Impe Steven Van Impe RW Team Member

Customer reviews

'Swift Apprentice'

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.

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.
swift apprentice book cover

Get the Swift Apprentice

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

Top