Download Swift in Depth

Swift in Depth


Swift in Depth Book Details

Title: Swift in Depth
ISBN-10: 978-1617295188
Author: Tjeerd Veen
Language: English
Subject: Swift / Computers & Technology / Programming / Apple Programming
No. of pages: 376
Format: EPUB, PDF

About Swift in Depth book

Swift is a young language. At the time of writing, Swift has reached the fourth version and yet is not ABI-stable, meaning that there will be breaking changes when Swift 5 comes out. So why is this book in any position to tell you how to write your code?

You’d be right to be skeptical, but please bear with me. Even though Swift is relatively new, I think it’s fair to say that some solutions work better than others, which is even more essential to understand if you’re using Swift for real production apps.

Swift borrows a lot of important concepts from other programming languages, such as Haskell,
Ruby, Rust, Python, C#, and others. Therefore, you’d be wise to keep an eye out for these concepts.

By mixing programming paradigms with real-world experience, this book shares some very fun and useful best practices you can instantly apply to your work.

Having programmed for over a decade in multiple languages and teams, I would like to share tips, tricks, and guidelines that helped my Swift career tremendously, and I want the same for you.

Advanced IOS Mini Bundle Ray Wenderlich

WHY THIS Swift in Depth ?

Honestly, a lot of software in this world runs on “ugly” code, and that is completely normal. If your product does what it needs to do, that is—like it or not—good enough for businesses.

As a developer, you have to make sure your product works and works well. But your users won’t look under the hood and point out ugly if statements. Perfectionism is harmful to software development and the cause to large numbers of unfinished projects.

Still, there’s a large gap between “It does what it needs to do” and a project where some excellent decisions were made that pay off in the long run.
Having worked on numerous projects, one thing I highly value is writing code that your coworkers and your future self will understand clearly—because elegant code means less chance of bugs, higher maintainability, better understanding for developers who inherit code, increased programmer happiness, and many other benefits.

Another aspect I value is the robustness of code, meaning how refactor-proof some pieces are. Will it break if you sneeze on it? Or can you change code without a hassle?
In this Swift in Depth, I share my tips, tricks, and guidelines that have worked well for me and companies I’ve worked for. On top of that, it fills in significant knowledge gaps that may arise while working with Swift.
Although this is a Swift book, a lot of the principles shared here are not Swift-centric and carry over to other programming languages as well; this is because Swift borrows a lot of ideas and paradigms from other languages. After you finish this book, you may find it easy to apply concepts in other languages. For instance, you’ll learn a lot about optionals, or how to use the reduce method on arrays. Later, you may decide to learn Kotlin, where you may apply optionals and reduce—called fold—straight away. You may also find Rust—and its similar generics implementation—easier to learn.

Because of Swift’s multi-paradigm nature, this book switches without preference between object-oriented programming, functional programming, and protocol-oriented programming paradigms—although admittedly, I do favor other techniques over subclassing. Switching between these paradigms offers you many tools and solutions to a problem, with insights as
to why a certain solution works well or not. Whether you’re stuck in a rut or open to many new programming insights, this book challenges you to solve problems in different ways.

IS THIS Swift in Depth FOR YOU?

This book does assume that you have made one or more applications in Swift. Do you work in a team? Even better—this book shows you how to write good, clear code that gets appreciated in teams, and helps you improve pull requests of others. Your code will be more robust and cause less maintenance for you and your team.

This book fills in knowledge gaps for both beginner and seasoned Swift developers. Perhaps you mastered protocols but still struggle with flatMapping on types or asynchronous error handling. Or maybe you create beautiful apps but stay away from generics because they can be hard to interpret. Or perhaps you sort-of know when to use a struct versus a class but aren’t aware that enums are sometimes a better alternative. Either way, this book helps you with these topics. By the end, generics should come as naturally as for loops. You’ll be confident calling flatMap on optionals, know how to work with associated types, and you’ll gladly use reduce in your daily routine when working with iterators.

If you’re aiming to get a programming interview for a new job in the future, you’re in for a treat. You’re going to be able to answer a lot of relevant questions in regard to Swift development trade-offs and decisions. This book can even help you write elegant code in your code

If you just want an app in the app store, just keep doing what you’re doing; no need to read this book! But if you want to write code that is more robust, easier to understand, and increases your chances of getting a job, getting better at your job, or giving qualitative comments on pull requests, you’re at the right place.


This book is focused on Swift. It mostly uses framework-free examples because it isn’t about teaching Cocoa, iOS, Kitura, or other platforms and frameworks.

What does happen in this book is I often make use of Apple’s Foundation, which is hard to avoid if you want real-world examples. If you’re on Linux, you can use’s Foundation alternative to get similar results.


This book is very practical, showcasing tips and tricks you can apply straight away in your daily programming.

Don’t worry: it’s not a theory-dense book. You’ll learn a lot of theory, but only via the use of real- world problems that any Swift developer runs into sooner or later. It doesn’t, however, reach an
academic level where it discusses Swift’s LLVM representation or machine code.

Also, I made sure to avoid a personal pet peeve of mine: I do not subclass “Animal” with “Dog” or add a “Flyable” protocol to “Bird.” I also don’t add “Foo” to “Bar.” You’ll deal with real-world scenarios, such as talking to APIs, loading local data, and refactoring and creating functions, and you’ll see useful bits and pieces of code you can implement in your projects.