Mastering Swift 5.3

Over the years, Mastering Swift has proven itself among developers as a popular choice for an in-depth and practical guide to the Swift programming language. This sixth edition in this series comes with the latest features, an overall revision to align with Swift 5.3, and two new chapters on building swift from source and advanced operators.  From the basics of the language to popular features such as concurrency, generics, and memory management, this in-depth guide will help you develop your expertise and mastery of the language.


As you progress through this book, you will gain practical insights into some of the most sophisticated elements in Swift development, including protocol extensions, error handling, and closures. The book will also show you how to use and apply them in your own projects. In later chapters, you will understand how to use the power of protocol-oriented programming techniques to write flexible and easier-to-manage code. Finally, you will learn more advance techniques like adding the copy-on-write feature to your custom value types, along and how to avoid memory management issues caused by strong reference cycles.

By the end of this Swift book, you will have mastered the Swift 5.3 language and developed the skills you need to effectively use its features to build robust applications.

What you will learn

·       Understand core Swift components, such as operators, collections, control flows, and functions

·       Identify how and when to use classes, structures, and enumerations

·       Use protocol-oriented design with extensions to write easy-to-manage code

·       Leverage design patterns with Swift to solve commonly occurring design problems

·       Apply copy-on-write for your custom value types to improve performance

·       Add concurrency to your applications using Grand Central Dispatch and operation queues

·       Implement generics to write flexible and reusable code


Who this book is for

This book is for developers of all skill levels ranging from beginners with a basic understanding of programming to experienced developers looking to learn Swift programming. If you are already familiar with Swift programming but want to dive deeper into the language this book is definitely for you.  Familiarity with Apple's tools will be beneficial but not mandatory. All examples should also work on the Linux and Windows platforms.

Table of Contents
  1. Taking the First Steps with Swift – This chapter will introduce you to the Swift programming language and discuss what inspired Apple to create Swift. We'll also go over the basic syntax of Swift and how to use Playgrounds to experiment and test Swift code.  

  2. Swift Documentation and Installing Swift – This chapter will introduce the user to the and sites and how the swift development process works.  We will go through the complete process of building swift from source and installing it on both the Linux and Mac platforms.

  1. Learning about Variables, Constants, Strings, and Operators -  This chapter will introduce you to variables and constants in Swift and when to use them. There will be brief overviews of the most common variable types with examples on how to use them. Tuples will be covered near the end of this chapter.  We'll conclude this chapter by showing examples of how to use the most common operators in the Swift language

  2. Optional Types – This chapter will explain what optional types really are, what are the various ways we can unwrap them, and optional chaining.

  3. Using Swift Collections – This chapter will explain Swift's array, set, and dictionary collection types and show examples on how to use them.

  4. Control Flow – This chapter will show you how to use Swift's control flow statements. These include looping, conditional, and control transfer statements.

  5. Functions - This chapter is all about functions and how to define and use them

  6. Classes, Structures, and Protocols – This chapter is dedicated to Swift's classes and structures. We'll look at what makes them similar and what makes them different. We'll also look at access controls and object-oriented design.

  7. Protocols and Protocol Extensions – This chapter will cover both protocols and protocol extensions in detail since protocols are very important to the Swift language, and having a solid understanding of them will help us write flexible and reusable code as well as understand how the language, with its libraries, are designed.

  8. Protocol-Oriented Design – This chapter will cover the best practices of Protocol Oriented Design with Swift.  It will be a brief overview of what is covered in my Protocol Oriented Programming book.

  9. Generics – This chapter will explain how Swift implements generics. Generics allow us to write very flexible and reusable code that avoids duplication. 

  10. Error Handling and Availability - will cover error handling in depth as well as the new availability feature which is available when writing iOS, macOS and watchOS apps.

  11. Custom Subscripting – This chapter will discuss how we can use custom subscripts in our classes, structures, and enumerations enabling us to write cleaner code. 

  12. Working with Closures – This chapter will teach us how to define and use closures in our code. We will conclude this chapter with a section on how to avoid strong reference cycles with closures

  13. Advanced and Custom Operators – This chapter will show how to use bitwise and overflow operators. It will also look at how we can create custom operators for our custom types.

  14. Concurrency and Parallelism in Swift - will show how to use both Grand Central Dispatch and Operation Queues to add concurrency and parallelism to our applications. Understanding and knowing how to add concurrency and parallelism to our apps can significantly enhance the user experience

  15. Custom Value Types - This chapter will cover some advance techniques that the reader can use when they are creating their own custom value types like copy-on-write and implementing the equatible protocol.

  16. Memory Management - This chapter will cover items like how Automatic Reference Counting (ARC) works, how much faster value types are as compared to reference types, strong retain cycles, weak vs strong references

  17. Swift Formatting and Style Guide – This chapter will define a style guide for the Swift language that can be used as a template for enterprise developers who need to create a style guide

  18. Adopting Design Patterns in Swift -  This chapter will show you how to implement some of the more common design patterns in Swift in a protocol oriented way. A design pattern identifies a common software development problem and provides a strategy for dealing with it.


You can purchase this book on Amazon here.

I am always looking for ways to improve the next edition of the Mastering Swift series.  If you have any ideas or suggestions please place a comment on this page or use the contact page to contact me directly.