…many years. In your own apps, you’ll often have a sizable Objective-C codebase that just doesn’t feel at home inside your Swift code or want to use some of your shiny new Swift code in your Objective-C code. In this chapter, you'll learn…
iOS & Swift
Chapter in Expert Swift
Introduction
Jun 11 2025 · Chapter
Welcome to Expert Swift. In this chapter, you’ll learn about some of the motivations behind creating the Swift language, take a short but deep dive into the Swift toolchain flow and look at Swift. You’ll develop a simple language feature, ifelse, to explore some of the facilities Swift…
iOS & Swift
Chapter in Expert Swift
Protocols
Jun 11 2025 · Chapter
…used Swift before, you’ve probably used protocols. A lot. Protocols and protocol-oriented programming are built into the DNA of Swift, and it’s hard to imagine what Swift would look like without all the power its protocols hold. Because they’re an integral part of Swift, this whole…
iOS & Swift
Chapter in Expert Swift
Generics
Jun 11 2025 · Chapter
Almost everyone using Swift — from complete beginners to seasoned veterans — has used generics, whether they know it or not. Generics power arrays and dictionaries, JSON decoding, optionals, Combine publishers and many other parts of Swift and iOS. Because you’ve already used many of these features, you know firsthand…
iOS & Swift
Expert Swift
Jun 11 2025 · Book
Master the Swift language with the Expert Swift book! Swift is a rich language with a plethora of features to offer. Reading the official documentation or entry-level books is important, but it’s not enough to grasp the true power of the language. Expert Swift is here to help…
iOS & Swift
Chapter in Expert Swift
Numerics and Ranges
Jun 11 2025 · Chapter
Swift is a platform-agnostic, general-purpose programming language that supports various numeric types with differing space, range, accuracy and performance characteristics. Building two apps (BitViewer and Mandlebrot), you’ll see how Swift simplifies programming with protocols and generics. You’ll also look at range types and how operators…
iOS & Swift
Chapter in Expert Swift
API Design Tips & Tricks
Jun 11 2025 · Chapter
…diving into specific topics, learning how they work, writing code to sharpen your instincts around them and working through real-life examples. Although using Swift and all its incredible capabilities is a wonderful skill to have, it doesn’t help much without actually shipping code with it. More often than…
iOS & Swift
Chapter in Expert Swift
Strings
Jun 11 2025 · Chapter
…proper implementation of a string type in Swift has been a controversial topic for quite some time. The design is a delicate balance between Unicode correctness, encoding agnosticism, ease-of-use and high-performance. Almost every major release of Swift has refined the String type to the awesome design…
iOS & Swift
Chapter in Expert Swift
Codable
Jun 11 2025 · Chapter
…your data. Unfortunately NSCoding, while an incredible abstraction at the time, suffers from many issues and a lack of modern touch that fits the Swift world — such as automatically synthesized encoding and decoding, support for value types and more. Enter Codable. What is Codable? Codable is a type alias combining…
iOS & Swift
Chapter in Expert Swift
Types & Mutation
Jun 11 2025 · Chapter
Types are essential to building Swift programs. The Swift compiler type checks your code to verify correctness, ensure safety and enable greater optimization. You’ll gain experience about the different nominal types and mutation with several small examples. You’ll also implement mutable value semantics for a QuadTree type using…
iOS & Swift
Chapter in Expert Swift
Sequences, Collections & Algorithms
Jun 11 2025 · Chapter
…atop a highly composable hierarchy of fundamental protocols. These protocols, which include Sequence and Collection among others, capture the essence of these types. The Swift standard library design serves as a case study in Swift generics and protocol-oriented programming that you can learn from and leverage. The concepts these…
iOS & Swift
Chapter in Expert Swift
Unsafe
Jun 11 2025 · Chapter
Swift is a memory-safe and type-safe language. In some cases, you might need your code to be extremely optimized, in which case the tiny overhead added by the safety checks from Swift might be too expensive. You might be dealing with a huge stream of real-time data…
iOS & Swift
Chapter in Expert Swift
Higher-Order Functions
Jun 11 2025 · Chapter
…more readable, a lot shorter and easier to reuse. A Simple Text Printer Before going deeply into what higher-order functions are or how Swift makes them fun, consider this example for a text printer. Create a new playground and add the following: class TextPrinter { var formatter: ParagraphFormatterProtocol init(formatter…
iOS & Swift
Chapter in Expert Swift
Conclusion
Jun 11 2025 · Chapter
…hope you learned a lot about the advanced features of Swift in this book — and had some fun in the process! With the advanced knowledge you’ve acquired, you’re ready to write better Swift code and improve your existing apps. If you want to read more, there are several…
iOS & Swift
Chapter in Expert Swift
Introduction
Jun 11 2025 · Chapter
Welcome to Expert Swift! The book for intermediate Swift developers looking to enhance their skills and understanding of the language. Swift is a powerful and wonderful language, used by many developers around the world to build iOS, macOS, tvOS and watchOS apps. If you’re reading this book, then…
iOS & Swift
Chapter in Expert Swift
Functional Reactive Programming
Jun 11 2025 · Chapter
…filter and reduce), which you learned about in the previous chapter. Many of these operators have parallels with the same name in the Swift standard library and also perform the same sort of work. An example of this is map, which transforms each element in a stream…
iOS & Swift
Chapter in Expert Swift
Instrumentation
Jun 11 2025 · Chapter
Being a great iOS software engineer isn't only about being a grandmaster of the Swift language. It's also about knowing which tools the platform puts at your disposal, how to use them to sharpen your skills and how to identify areas of improvement in your code. In this…
iOS & Swift
Chapter in Expert Swift
About the Team
Jun 11 2025 · Chapter
Discover Echo Inc. in San Diego, California. Ray enjoys learning new things and is excited about math, data, visualization, machine learning and computer vision. Swift is his problem-solving language of choice and he has been using it and teaching others about it since its 2014 public release. About…
iOS & Swift
Chapter in Expert Swift
Dedications
Jun 11 2025 · Chapter
…teaching me all of the things I thought were too hard to know.” — Marin Bencevic “To my friends and family and the Swift community of dreamers, inventors, teachers, learners and doers. You guys make this place awesome…
iOS & Swift
Chapter in Expert Swift
What You Need
Jun 11 2025 · Chapter
…installed the latest version of Xcode, be sure to do that before continuing with the book. The code covered in this book depends on Swift 6.1 and Xcode 16.3 — you may get lost if you try to work with an older version or work outside the playground environment that this…