For loops in Swift: a Detailed List of the Most Practical Uses

For loops are a fundamental construct of programming, and even more so of making iOS apps. If you want to become an iOS developer, they are a necessary tool you need to have in your toolbox.

But more important than simply understanding how they work, is to know how to use them for the different tasks you will meet in iOS development.

So, the aim of this article is not only to show you how Swift for loops work, but how to use them to solve the most common programming problems.

UITableview: The Essential Solution for Scrolling iOS Interfaces

Table views are a fundamental component of almost any iOS app. But most developers don’t use them when they should or get their architecture wrong. 

Table views are more versatile than you might think.

For example, many developers make their life harder using a scroll view when a UITableView would be a better choice.

Finally, architecture is crucial for table views. The code of the table view data source often ends inside view controllers when it should go into a separate class.

Even though Apple introduced SwiftUI at WWDC 2019, you won’t be able to use it in your apps until a large portion of users gets on iOS 13.

Until then, you need to know the right approach to using table views with data sources and delegates.

Functional Programming in Swift: an Unusual yet Powerful Paradigm

Since the introduction of Swift, the iOS community has been buzzing with the words functional programming.

That’s because many features of Swift were inspired by the ones you find in functional programming languages.

These features make some tasks easier. One example is easily configurable callbacks for network requests.

While Swift is not a functional language, we can draw many lessons from functional programming to write better Swift code in our iOS apps.

Unwind Segues Step-by-Step (and 4 Reasons to Use Them)

Unwind segues in iOS can be quite confusing.

Unlike their forward counterpart, they are based on a more complicated mechanism and different rules. That usually complicates their setup.

Moreover, many wonder why you should use an unwind segue when you can dismiss a view controller with a single line of code.

I will answer all these questions in this article.

Passing Data Between View Controllers in iOS: The Definitive Guide

Many iOS developers make serious architectural mistakes when passing data between view controllers.

There are many ways to do this, but they are not all good. Only a few of them are the best practices.

Quick and easy solutions like singletons often lead to severe problems you will discover only later.

If you want to be a skilled iOS developer, you need to know the architecture behind view controller communication.

In this article, I will show you the best practices to pass data both forward backward. We will also discuss some advanced techniques, and the solutions you should not use.

Swift Singletons: A Design Pattern to Avoid (With Examples)

I often recommend avoiding singletons in iOS apps, especially to pass data between view controllers.

I thought that most developers knew why the singleton pattern should be avoided and what is the correct approach.

So I was surprised when I discovered that many iOS developers don’t know this.

In this article, I’ll show you what a singleton is, why you should not use singletons in your apps and what you should use instead.

Auto Layout in iOS: A Comprehensive 7 Steps Roadmap

Auto Layout is a complex beast to tame.

Creating adaptive apps that fit the sizes and proportions of all iOS devices is a complex problem. We can only solve it with a complex solution.

But you don’t need the full power of Auto Layout all the time.

Most apps have fairly straightforward interfaces. Most of the time, you can go a long way by only using Auto Layout’s basic features in an app’s storyboard.

That’s the Pareto Principle at play: learn the 20% of Auto Layout’s functionality that covers 80% of the cases.

From there, you can expand and include the what you miss to solve the problems you have at hand.