Skip to main content

Swift In Depth

A detailed guide aimed at helping Swift developers master the language, combining best practices, advanced techniques, and real-world scenarios to enhance coding skills and application development.

Details

URL: 🔗 https://www.oreilly.com/library/view/swift-in-depth/9781617295188/

Published: 2019

Authors: Tjeerd in ’t Veen

Tags:
Swift, iOS Development, Advanced Programming, Best Practices, Functional Programming

Key Points

  • Comprehensive coverage of advanced Swift programming concepts
  • Practical examples and real-world scenarios
  • Emphasis on best practices for writing clean, maintainable, and efficient Swift code
  • Detailed discussions on functional programming, protocol-oriented programming, and generics
  • Guidance on handling Swift's unique features and overcoming common challenges

Summary of Contents

  • Preface and Introduction:

    • Overview of the author's experience and motivation for writing the book
    • Importance of mastering Swift for real production apps
  • Chapter 1: Introducing Swift in Depth

    • Brief overview of Swift’s popularity and supported platforms
    • Benefits and subtle downsides of Swift
    • What readers will learn in the book
  • Chapter 2: Modeling Data with Enums

    • Using enums as an alternative to subclassing
    • Enums for polymorphism and data modeling
    • Safe handling of enums with raw values
    • Converting structs to enums for better data modeling
  • Chapter 3: Writing Cleaner Properties

    • Choosing the right type of properties for different situations
    • Creating clean computed properties and stored properties with behavior
    • Best practices for using lazy properties
  • Chapter 4: Making Optionals Second Nature

    • Thorough exploration of optionals in Swift
    • Best practices for handling optional values in various scenarios
    • Tips and tricks to boost day-to-day Swift code
  • Chapter 5: Demystifying Initializers

    • Understanding Swift's initializer rules for structs and classes
    • Writing less initialization code for cleaner codebases
    • Subclassing and initializer rules
  • Chapter 6: Effortless Error Handling

    • Best practices for synchronous error handling
    • Throwing errors, handling errors, and maintaining good state
    • Propagating errors and bridging to NSError
  • Chapter 7: Generics

    • Understanding and applying generics in Swift
    • Creating generics functions and types
    • Constraining generics with protocols for specialized functionality
  • Chapter 8: Putting the Pro in Protocol-Oriented Programming

    • Applying protocols in useful ways
    • Protocols vs. generics, and associated types
    • Static and dynamic dispatch with protocols
  • Chapter 9: Iterators, Sequences, and Collections

    • Implementing custom data structures with Sequence and Collection protocols
    • Useful iterator patterns and lazy sequences
    • Practical examples of custom data structures
  • Chapter 10: Understanding map, flatMap, and compactMap

    • Key concepts of map, flatMap, and compactMap in Swift
    • Cleaning up code with map and flatMap on optionals
    • Mapping over dictionaries, arrays, and other collection types
  • Chapter 11: Asynchronous Error Handling with Result

    • Using Result for asynchronous error handling
    • Transforming traditional error handling to Result-based handling
    • Mapping and flatMapping with Result for clean and elegant error propagation
  • Chapter 12: Protocol Extensions

    • Modeling data with protocols vs. subclasses
    • Using protocol inheritance and composition
    • Extending protocols for highly reusable code
  • Chapter 13: Swift Patterns

    • Modern approaches to common programming problems
    • Mocking APIs with protocols and associated types
    • Conditional conformance and type erasure
  • Chapter 14: Delivering Quality Swift Code

    • Writing clean, easy-to-understand code
    • Establishing naming conventions, adding documentation, and using SwiftLint
    • Transforming large classes into smaller, generic components
  • Chapter 15: Where to Swift from Here

    • Next steps for continued Swift learning
    • Encouragement to explore further and apply learned concepts in real projects

Conclusion

  • Encouragement to apply best practices and advanced techniques in Swift development
  • Emphasis on the importance of clean, maintainable, and efficient code for long-term project success
Link to Book