Design pattern

Design pattern

20 posts

Lenses and prisms in Swift


Beginner's guide about optics in Swift. Learn how to use lenses and prisms to manipulate objects using a functional approach.

Swift visitor design pattern


The visitor design pattern in Swift allows us to add new features to an existing group of objects without altering the original code.

Event-driven generic hooks for Swift


In this article I am going to show you how to implement a basic event processing system for your modular Swift application.

Modules and hooks in Swift


Learn how to extend your application with new functionalities using a loosely coupled modular plugin system written in Swift.

Swift init patterns


The ultimate guide how to init your Swift data types, with the help of designated, convenience, failable intitializers and more.

Lazy initialization in Swift


Learn how to use lazy properties in Swift to improve performance, avoid optionals or just to make the init process more clean.

Swift object pool design pattern


In this quick tutorial I'll explain & show you how to implement the object pool design pattern using the Swift programming language.

Iterator design pattern in Swift


Learn the iterator design pattern by using some custom sequences, conforming to the IteratorProtocol from the Swift standard library.

Swift adapter design pattern


Turn an incompatible object into a target interface or class by using a real world example and the adapter design pattern in Swift.

Swift dependency injection design pattern


Want to learn the Dependency Injection pattern using Swift? This tutorial will show you how to write loosely coupled code using DI.

Swift delegate design pattern


The delegate design pattern is a relatively easy way to communicate between two objects through a common interface, protocol in Swift.

Swift command design pattern


This time I'm going to show you a behavioral pattern. Here is a little example of the command design patten written in Swift.

Swift prototype design pattern


The prototype design pattern is used to create clones of a base object, so let's see some practical examples written in Swift.

Swift abstract factory design pattern


Let's combine factory method with simple factory voilá: here is the abstract factory design pattern written in Swift language!

Swift factory method design pattern


The factory method design pattern is a dedicated non-static method for hiding the creation logic of an object. Let's make it in Swift!

Swift simple factory design pattern


This time let's talk about the simple factory design pattern to encapsulate object creation in a really simple way using Swift.

Swift static factory design pattern


In this article I'll teach you about the static factory design pattern and show some use cases using the Swift programming language.

Swift builder design pattern


Learn how to implement the builder pattern in Swift to hide the complexity of creating objects with lots of individual properties.

Swift singleton design pattern


Singleton is the most criticized design pattern of all time. Learn the proper way of using Swift singleton classes inside iOS projects.

UIKit init patterns


Learn about the initialization process of the two well known classes in UIKit. Say hello to UIViewcontroller, and UIView init patterns.