Category: UIKit

  • Clean, Reusable Swift Code Using DRY Principle

    Clean, Reusable Swift Code Using DRY Principle

    Hey Switfers! đź‘‹Today we will explore the DRY principle to make our Swift code clean and reusable. So have you ever written a function, copy-pasted it somewhere else, tweaked a line or two, and thought, this looks kinda familiar? If so, you have probably broken a rule we all learn (and forget) early on The…

  • Swift’s withoutActuallyEscaping: Escape Without Escaping?

    Swift’s withoutActuallyEscaping: Escape Without Escaping?

    Hi Switers 🙂, In this article, we will explore withoutActuallyEscaping function in Swift. Let’s say you have just started getting comfortable with closures in Swift. You’ve wrapped your head around things like @escaping, and you know it’s needed when a closure might stick around and run later, after the function it was passed to has…

  • The Delegation Pattern in Swift

    The Delegation Pattern in Swift

    The delegate pattern is a cornerstone of iOS development in UIKit, enabling a class to delegate specific tasks to another object. This pattern promotes clean and modular code by adhering to the single responsibility principle, making your apps easier to maintain and extend. If you’ve ever worked with UITableView, UICollectionView, or UITextField, you’ve already encountered…

  • Separate UITableView/UICollectionView DataSource from a View Controller in Swift

    View controllers can get really massive in some cases when you place the data source and delegate methods inside it when using a tableView or a collectionView. To overcome that you can separate them out. In this article we will take a look at how we can separate the data source of tableView. A data…