10 Swift Extensions I Use All the Time

Jerry PM
11 min readOct 3, 2024

In this Swift extension, I often use it as it helps a lot in organizing and speeding up project development.

Source: Autor

Swift extension allow to add functional type data etc. I often write several data type extensions type like a string, int and UIKit to make it easier for me to developing apps. Sometimes also copy from github and Stackoverflow, it really helped me.

In programming you definitely need this “extension string” which is most often used if its use is many times. Here are some examples of string extensions

1. Extension UICollectionView Setup

When working with UICollectionView, managing cells can quickly become repetitive. Developers often find themselves registering cells, dequeuing them, and writing the same boilerplate code over and over again. Fortunately, Swift’s extensions provide a clean and efficient way to reduce redundancy and streamline these common tasks.

In this article, we’ll explore a Swift extension for UICollectionView that simplifies both cell registration and dequeuing, making your code more readable and less error-prone.

You’ll notice that every time you register or dequeue a cell, you need to provide the cell’s identifier as a string. Additionally, you often have to cast the dequeued cell to the correct type…

--

--