Do we need the Command Pattern? Not if we use Swift
Jun 2, 2021, 7:32 AM
Explore the the new way of designing applications in Swift, with powerful value types used to model the domain, which enables us to enjoy the benefits of the Command Pattern, and more, without the complexity and boilerplate code, keeping...
What Are Swift Optionals and How They Are Used
Dec 1, 2020, 3:22 PM
This article explains what Swift optionals are, why Swift has them, how they are implemented, and how Swift optionals can be used to better model real-world domains and write safer and more expressive code.
The post What Are Swift...
A Protocol-Oriented Approach to Associated Types and Self Requirements in Swift
Sep 16, 2020, 10:11 AM
Use protocol-oriented programming to avoid having to use associated types in many situations but also to effectively use associated types and Self requirements, where appropriate, to leverage their benefits while avoiding the pitfalls.
Retroactive Modeling With Protocols in Swift
Mar 4, 2020, 10:27 AM
Harness the power of protocol-oriented programming to free yourself from the need to build inheritance hierarchies and inflexible abstractions. Start with concrete code and retroactively introduce abstractions to enable new use cases for...
Rethinking Design Patterns in Swift: Command Pattern
Sep 16, 2019, 11:16 AM
Command pattern implementation in Swift, with a detailed case study to explore ways in which the pattern can make code more flexible and extensible. We also tap into the power of Swift to see how closures can be used to implement basic...
Encapsulating Domain Data, Logic and Business Rules With Value Types in Swift
Jan 30, 2019, 12:19 AM
Leverage the power of Swift value types to manage domain complexity by creating rich domain-specific value types to encapsulate domain data, logic and business rules, keeping classes lean and focused on maintaining the identity of entities...
Rethinking Design Patterns in Swift: State Pattern
Dec 6, 2018, 2:20 PM
The State pattern, made simpler and more flexible with the power of Swift, with a detailed worked example to illustrate handling of new requirements, also looking at key design and implementation considerations and the benefits and...
Programming Safely and Effectively With Optionals in Swift (Part Two)
Aug 6, 2018, 2:28 PM
Covers a host of powerful Swift language features and associated techniques that enable us to use optionals in a completely safe manner, also looking briefly at unsafe practices that are best avoided when dealing with optionals.
Programming Safely and Effectively With Optionals in Swift (Part One)
Aug 6, 2018, 2:26 PM
Looks at how optionals in Swift can help us better model real-world domains and write more robust and expressive code, covering why Swift has optionals, basic optional syntax, how optionals are actually implemented and practical uses of...
Conditional Logic With and Without Conditional Statements in Swift
Apr 20, 2018, 8:45 AM
Shows how to implement conditional logic using conditional statements as well as data structures, types and flow control mechanisms such as loops, balancing simplicity and clarity with flexibility and future-proofing.
The post Conditional...
Better Generic Types in Swift With the Numeric Protocol
Mar 21, 2018, 3:26 PM
Covers use of the Numeric protocol as a constraint on type parameters of generic types to ensure that certain type parameters can only be used with numeric types, using protocol composition to add relevant functionality as required.
Understanding, Preventing and Handling Errors in Swift
Feb 26, 2018, 3:16 PM
Examines the likely sources of errors in an application, some ways to prevent errors from occurring and how to implement error handling, using the error handling model built into Swift, covering the powerful tools, associated techniques...
When and How to Use Value and Reference Types in Swift
Nov 26, 2017, 10:26 AM
Explores the semantic differences between value and reference types, some of the defining characteristics of values and key benefits of using value types in Swift, leading into a discussion on how value and reference types play a...