Swift

Learn the fundamentals of Swift 3, the fast growing programming language used for iOS, OS X, and server side development.

Lessons

Each lesson focuses on a single aspect of building the project, like modeling the data, building a GraphQL server in Elixir, or building a mobile client for it in Flutter.

free

The Swift Programming Language

Introduction to the Swift Programming Language.

free

Playgrounds & Built-in Types

Learn code quickly using Xcode Playgrounds without building an entire app.

free

Details of Built-in Numeric Types

Bitwise concerns of Swift's numeric types.

free

More-Built_in-Types

We're going through built-in types in Swift.

free

Practice using Arrays and Dictionaries

Put `Any`thing in an array, and key by types other than `String`s.

Introduction to Flow Control

Swifter `if`, `while` and `for`.

free

Basic Flow-Control

Change flow based on Optionals.

Whitespace & Operators

How to let Swift know whether your operator is prefix, postfix or infix.

Functions Syntax

Argument names, labels and mutability.

Practice writing a function

An exercise exploring basic function construction.

Deeper on Control Flow and Functions

Finish off our reference on control flow.

`guard`, `while` and `??`

Turning an Optional into a sure thing.

Default Argument Values

Making a single function easy & configurable.

Rounding Out Control Flow

Ranges, For-in, & tuples for multiple return.

Guarding Against Crashes

Using `guard`, and an Optional tuple to avoid crashing

Structs: Composite Values

Getting started with composite value types.

Structs: Properties

Storing and initializing properties.

Read/Write Computed Properties

Accessing your properties in a different way.

Instance Methods & Mutability

Fine-grained control over mutability on properties & methods.

Practicing Structs

Writing multiple initializers for a struct.

Introduction to Classes

The differences between a struct and a class.

Behaviors of a Class

Inheritance, substitution, mutability & identity of reference types.

Type Checking

Checking a class's dynamic type and conditional downcasting.

Class Initializers

Swift enforces Obj-C's convention of a "designated initializer"

Practicing Subclassing

Creating initializers for related types.

Classes in Practice

Memory Management and Encapsulation.

free

Memory Management for Classes

Using Automatic Reference Counting to your advantage

Property Observers

The basis for reactibility.

Encapsulation

How to lock down property access and overrides

Practice a Struct Owning a Class

Writing your own copy-on-write optimization.

Introduction to Enums

Representing mutually-exclusive cases.

Enum and Switch

Defining enum types, and using them in switch.

Integers as Enum RawValues

Several ways to back an enum with integers.

Associated Values

Storing different values in enum cases & writing failable initializers.

Practicing Enums

Associating custom types with enum cases.

Introduction to Closures

Functions as a type.

Writing Closures

Associating custom types with enum cases.

Lazy Stored Properties

Using a closure to initialize a property only when needed.

Good Closures

Avoiding retain cycles in @ecaping closures and writing small, clean closures.

Practice Handling Closures

Writing a type that owns and uses a closure.

Introduction to Protocols

Swift is a protocol-oriented language

Protocol Fundamentals

Using protocols as a type.

Default Arguments

Making a function precise and easy at the same time.

free

Extensions & Protocols

Extending types, and simulating diamond inheritance with protocols.

Practice a Protocol Extension

Add conformance to the Equatable protocol to an enum.

Introduction to Errors

When the normal flow just won't work

Error Types & Syntax

Defining and catching errors.

Protocols and Throws

How to conform to protocols with `func`s that throw or not.

Convenient Throwing

Other keywords that work well with `throws` for clean control flow.

Practice Errors

Create your own error type, throw it and catch it

Introduction to Statics

Defining methods and properties on types

Static Functions

Declaring type-members instead of instance-members.

Nested Types

Creating types within types.

Making Use of Statics

Dynamic initialization, and OptionSets.

Practicing Statics

Realistic `init` using statics.

Introduction to Generics

Preserving concrete type information

Reading & Using Generic Types

Preserving concrete type information

Working around Hashable with AnyHashable

Type erasure as a strategy.

Simple Generic Constraints & Conformances

Limiting our generic to only support specific types

Practice Generics

Writing generic type, method and closures

Introduction to Associated Types

Abstractions depending on abstractions

Declaring and Conforming to Associated Types

Abstractions depending on abstractions

No Circular Requirements

Decomposing associated types into a hierarchy.

Generics and Associated Types

Protocol associated types and generics were made for each other

Practice writing an associated type

Parallel problems ask for parallel solutions

Introduction to Foundation

Types that are fundamental to computing, but not the language

Common Foundation Types

URLs, Dates and their Components

Date Formatters

From `Date` to `String` and back again

Data

A common type for abstracting operations on arrays of bytes

Practice Foundation

End-to-end `Data` and `Date`s

Introduction to the Swift Package Manager

Setup your development environment for package management

Module Layouts

Building our own modules with the Swift Package Manager.

Developing for different platforms

Platform-specific platform directives.

Package Dependencies

What makes the Swift Package Manager a "package manager.”

Practice Using Swift PM

Tying together our own modules, automatic dependency downloading and command line apps.

Introduction to Concurrency in Swift

The Dispatch module.

Serial and Concurrent Queues

Accessing a model with concurrent-read / serial-write.

When FIFO queues aren't FIFO

Avoiding synchronization errors when returning to the synchronization queue.

free

Combining Concurrent Work

Synchronizing asynchronous work without blocking.

Practicing Concurrency

Combining multiple recipes into a realistic app

Introduction to Foundation Networking

Using a `URLSession`

Networking with URLSession

Configurations, requests, tasks, and responses.

Survey of Server Side Swift

Addressing incompletions on Linux and unsuitability of the Dispatch and Foundation architectures for servers.

Common Network File Formats

Parsing JSON and XML files with Foundation types.

Practice Networking

Round tripping JSON from Swift objects to Data to a server and back.

Intro to Xcode 9

A brief introduction covering the major features of Xcode 9

Xcode 9's Source Editor

Learn how the Source Editor works in Xcode 9

Xcode 9's Project Editor

Exploring the Project Editor inside of Xcode 9

Debugging, Tests, and Automatic Tabs in Xcode 9

Learn how to run Xcode 9s debugger, test systems, and manage automatic tabs

Xcode 9's Source Control Navigator

Using the Git SCM navigator inside of Xcode 9

Authors

The code in the applications was produced by:

./ben spratling

Ben Spratling

The day the iPhone app store opened, 3 of its apps were written by Ben, who earned his Ph.D. improving the performance of algorithms for aerospace applications. He’s contributed to lots of apps, from a handful of startups to Wolfram and DOMO. And when he’s not coding, he’s volunteering at his church.

Featured Lessons

Our content library is pretty great, here are a few lessons we think you might like.

What our Superusers are Saying!

Some other people were willing to publicly state that they like us!

Taylor Dolezal

Software Architect

Smooth Terminal has easily been one of the most helpful resources on my journey to better understand Elixir and the Phoenix web framework.

James Edward II

Developer

With any language there are so many details to learn. What functions are built-in? How should I structure my code? What tools are available for improving my workflow? It’s rare to find one source that can answer so many of these questions, but Smooth Terminal does this and more.

Rex Van Der Spuy

Game developer

Smooth Terminal is by far the best resource for learning Elm anywhere, and among the very best online learning platforms, period.