Advanced Swift Hero Image

Updated for Swift 5.6

Advanced Swift

A deep dive into Swift’s features, from low-level programming to high-level abstractions.

by Chris Eidhof, Ole Begemann, Florian Kugler, and Ben Cohen

In this book, we'll write about advanced concepts in Swift programming. If you have read the Swift Programming Guide, and want to explore more, this book is for you.

Swift is a great language for systems programming, but also lends itself for very high-level programming. We'll explore both high-level topics (for example, programming with generics and protocols), as well as low-level topics (for example, wrapping a C library and string internals).

Book Contents

  • Concurrency

    How to use Swift's structured concurrency system.

  • Collections

    How to use Swift's built-in collection types and how to build your own.

  • Optionals

    Improve the safety and clarity of your code.

  • Generics

    Write functions and methods that work on multiple types.

  • Protocols

    Use protocols to simplify your code.

  • Strings

    How to use strings and how they work with unicode.

  • Enums

    Use enums to model your data precisely.

  • Mutability

    Use Swift's powerful features to control mutability.

  • Memory Management

    Learn how value types and reference types interact.

  • Error Handling

    Understand Swift's built-in error handling.

  • Interoperability

    Wrap calls to C libraries and present them in Swift using a natural API.

Video Episodes (Full Table of Contents)

  • C Interoperability  1h12min

    Advanced C interop when wrapping the Cairo graphics library.

  • String Parsing  1h

    We extend the CSV parser from the book to be a maintainable, high-performance parser.

  • Collection Protocols  58min

    We show how to create a custom sorted array data structure and work with collection protocols.

  • Functions  36min

    We show how to leverage first-class functions and generics to build a validation library.

  • Encoding & Decoding Graphs  46min

    We show how to represent cyclical data structures that work with Codable.

Formats & Extras

Buy Book

Choose a Format
Choose a Format

You’ll need to confirm team size at checkout.

Choose a Format

You’ll need to confirm team size at checkout.

Choose a Format

You’ll need to confirm team size at checkout.

About the Authors