This post presents a contemporary take on a classic, the Command pattern. Starting with a brief history of design patterns and their relevance in modern software development, the Command Pattern is covered in detail, including the classic implementation, a modern makeover, two brief case studies, benefits and practical applications, closing with a brief commentary on the merits of designing with patterns.
This post 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. It then looks at when to use value and reference types when designing applications.
This is Part Two of a two-part post. This part uses type erasure to implement equality comparisons and Equatable conformance at the protocol level, allowing us to program to abstractions using protocol types while being able to safely make equality comparisons and also use functionality provided by the Swift Standard Library which is available only to types that conform to Equatable.
This is Part One of a two-part post. This part demonstrates how making protocols conform to Equatable renders us unable to use the protocols as types and why trying to implement equality functions on protocols, even without Equatable conformance, can lead to erroneous results in some cases and is impossible in others.