Hoffman | Mastering Swift 6 | E-Book | www2.sack.de
E-Book

E-Book, Englisch, 378 Seiten

Hoffman Mastering Swift 6

Modern programming techniques for high-performance apps in Swift 6.2
7. Auflage 2025
ISBN: 978-1-83620-368-1
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection

Modern programming techniques for high-performance apps in Swift 6.2

E-Book, Englisch, 378 Seiten

ISBN: 978-1-83620-368-1
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection



This seventh edition of Mastering Swift 6 is your ultimate guide to harnessing the full power of Swift. Whether you're aiming to optimize the performance of your applications or looking to explore the exciting new features in Swift 6.2, this book has you covered. The author distills his 28 years of experience in the Engineering and IT fields to help you dive deep into advanced concepts and techniques, such as concurrency, memory management, and Generics, all essential for creating high-performance applications.
The chapters take you on a flexible journey, covering Swift 6.2's newest features alongside advanced programming topics such as reflection, concurrency, and Generics. Packed with best practices, testing strategies, and modern programming techniques, this book equips you with the skills to develop scalable, high-performance applications with confidence.
Whether you're looking to stay competitive or simply want to excel in Swift 6, this book provides the tools and knowledge you need to succeed.

Hoffman Mastering Swift 6 jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


Preface


Since its surprise debut at WWDC in June 2014, Swift has rapidly redefined how we build software, combining safety, speed, and a clear, concise syntax to power everything from iOS, macOS, watchOS, and tvOS apps to server-side services on Linux and, since September 2020, native Windows development. Born from Chris Lattner’s vision of a modern successor to Objective-C, Swift’s modern features, such as optionals, generics, and closures, combined with its powerful type inference system, have made code more expressive, reliable, and enjoyable to write. While Apple’s decision to open-source the language in 2015 and stabilize its ABI in Swift 5 has created a vibrant community around swift.org. In this book, we’ll explore some of Swift’s most advanced features to help you take your development to the next level, writing cleaner, more powerful, and highly optimized applications.

Who this book is for


This book is written for developers with an understanding of the Swift programming language who are looking to elevate their skills by exploring advanced topics and techniques. The examples provided are compatible with application development across all Apple platforms, including macOS, iOS, iPadOS, visionOS, and watchOS, as well as Linux and Windows development, unless otherwise specified.

What this book covers


, , highlights the evolution of the Swift language, showing how its history shaped the features and design choices that developers use today. It also introduces swift.org, a key resource providing documentation, collaboration opportunities, and support for the Swift community.

, , introduces closures, which are self-contained blocks of code that can capture and retain references to variables from their surrounding context. Additionally, we will look at result builders, a feature that allows developers to create custom Domain-Specific Languages (DSLs) used for defining complex data structures.

, , explores protocols, highlighting how they can be used as full-fledged types that enable polymorphism through the unified interface they provide. It also introduces protocol extensions, which help reduce code duplication by offering default implementations for methods and properties. Additionally, the chapter covers the use of  to represent an instance of any type, and , which allows storing any value that conforms to a specific protocol.

, , explores generic types, which serve as the foundation for many types in the Swift standard library. Real-world examples demonstrate how to create and use generics effectively. Additionally, the chapter covers topics such as generic subscripts and associated types, illustrating how generics can enhance the flexibility of our code.

, , explains the differences between value types and reference types in Swift. This chapter includes practical examples of structures and classes, covering features such as copy-on-write for optimizing performance with large value types and recursive data types for reference types. Additionally, we will look at dynamic dispatch, which, while introducing some performance overhead, enables the flexibility needed for class hierarchies.

, , looks at Swift enumerations and what makes them more powerful than enumerations in other languages. We will also look at how to use raw values and how pattern matching can simplify our code. Additionally, we will see how associated values allow Swift enumerations to represent complex data structures.

, , looks at what reflection is and how the Mirror API in Swift enables it. We will demonstrate how to use the Mirror API to inspect structures and classes, revealing details such as property names, values, and type information.

, , looks at Swift’s error handling mechanisms and how errors are defined using types conforming to the Error protocol. We will demonstrate how to throw errors in functions using the  keyword and handle them with  blocks. Additionally, we will discuss Swift’s and attributes for conditional code execution based on platform versions.

, , explores the power of regular expressions for pattern matching and text manipulation, from simple searches to complex data extraction. The chapter shows how Swift supports regular expressions with regular expression literals and the type. Additionally, is introduced, which offers a clearer, more intuitive way to define patterns, and we will look into advanced features such as transforming and capturing matches using references.

, , explores how incorporating subscripts into custom types can improve readability and usability. We will examine how to create multi-parameter subscripts and discuss how to use subscripts appropriately, consistent with the Swift language itself.

, , explores how property observers and wrappers automatically respond to changes in property values, which improves the responsiveness of our applications. We will examine how property observers trigger actions while property wrappers abstract property management into reuseable types.

, , explores how dynamic member lookups allow properties to be resolved at runtime. Additionally, we will examine how key paths offer a type-safe way to access and manipulate properties using the syntax.

, , explores the difference between concurrency and parallelism. We will see how Grand Central Dispatch uses both serial and concurrent queues to handle task execution. Additionally, we will highlight how it has tools for managing UI updates and scheduling tasks effectively.

, , explores how async and await offer intuitive ways to handle asynchronous tasks, allowing functions to pause and resume without blocking the main thread. We will examine how tasks and task groups further control and coordinate asynchronous operations. Additionally, we will look at actors and the role they play in managing state safety.

, , examines how Swift uses Automatic Reference Counting (ARC) to manage memory for reference types such as classes. We will discuss how to use weak and unowned references to avoid strong reference cycles, which can hinder ARC from deallocating reference types, causing memory leaks.

, , explores advanced bitwise operators, such as the AND, OR, XOR, and NOT operators, for manipulating variable bits and the right and left shift operators for shifting bits. We will also look at how to add operator methods to our custom types.

, , looks at how access controls are used to ensure code security by restricting access to specific parts of the code base. We will examine the five access levels that Swift provides and how to apply them effectively. Additionally, we will see how applying the principle of least privilege will ensure that only the necessary parts of our code are accessible.

, , looks at Swift Testing, which is a powerful new testing framework introduced in Swift 6. We will explore the key building blocks, such as the attribute and the and macros, as well as the use of traits for adding metadata.

, , looks at object-oriented programming and how its design principles can be effectively applied with Swift to create structured and reusable code.

, , explores the core principles of protocol-oriented programming with Swift and how it differs from traditional object-oriented programming. Additionally, we will examine how Swift’s standard library is built with a protocol-oriented approach.

, , looks at Swift’s support for functional programming concepts such as immutability, pure functions, and first-class functions. We will also explore advanced techniques such as function composition, currying, and recursion to manage complex operations effectively.

To get the most out of this book


To get the most out of this book, you will need a basic understanding of the Swift language and a basic understanding of modern development techniques. All code examples have been tested using Xcode 26 on a Mac; however, all examples should also work using Swift on Linux or Windows.

Download the example code files


The code bundle for the book is hosted on GitHub at...



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.