Posts for: #Design Patterns

Delegate Pattern in Swift

Lately, I’ve been writing a lot about UIKit and I noticed I haven’t covered the delegate pattern. This pattern is not exclusive to UIKit but it’s quite used in this framework. In this post, we’ll dive into the Delegation Pattern, a fundamental design pattern in iOS development that helps in creating a well-structured codebase. What is the Delegation Pattern? The Delegation Pattern is a design pattern where one object (the delegator) hands off (or delegates) some of its responsibilities to another object (the delegate).
Read more

Builder Pattern to Simplify UIKit Object Creation

One common issue with programmatic UIKit development is dealing with the creation and configuration of UI objects. Configuring UI elements in our code can be cumbersome and hard to synchronize their behavior and style across several screens. By using the Builder Pattern, we can centralize the creation and configuration of these objects. This simplifies our codebase and decouples the creation of UI objects from our views. What is the Builder Pattern?
Read more