Design pattern

Design pattern

20 posts

· 5 min read

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.

· 3 min read

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.

· 5 min read

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.

· 4 min read

Modules and hooks in Swift


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

· 6 min read

Swift init patterns


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

· 4 min read

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.

· 1 min read

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.

· 4 min read

Iterator design pattern in Swift


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

· 2 min read

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.

· 5 min read

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.

· 1 min read

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.

· 1 min read

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.

· 1 min read

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.

· 1 min read

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!

· 1 min read

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!

· 1 min read

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.

· 2 min read

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.

· 3 min read

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.

· 4 min read

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.

· 2 min read

UIKit init patterns


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