Image via Undraw

This is a cross-post from my blog on Advanced Swift Development. Click below to directly open this article 👇.

  • ❓ Does callAsFunction() have any real use cases other than offering yet another syntactic sugar convention?

Programmatically laying out your views

Photo by SpaceX on Unsplash

Interface Builder (IB) has been in Xcode as long as anyone can recall [1]. It initiated the disputes about developing user interface in code vs IB which continue today. However, with the release of SwiftUI, Apple has made programmatic layout the mainstream approach.

Why didn’t this happen before? The folklore tells us that constructing UI in code is slower than in Interface Builder. In this article, I’ll show that not only is the opposite true, but also that programmatic layout is more scalable, maintainable, and future-proof when using the five techniques of effective programmatic auto layout.

This is not an…


Each view undergoes a series of events from its birth to its death, which is referred to as a lifecycle. Understanding it is essential when building apps in SwiftUI. In this article, we will explore the three phases of the SwiftUI view lifecycle.

Before we talk about lifecycle, we need to agree on what a view is.

Understanding SwiftUI Views

To describe what’s displayed onscreen, we create a graph of views.

View is a definition of a piece of UI. [1].

SwiftUI uses this definition to create an appropriate rendering.

To update UI, we don’t mutate the view graph directly. Instead, we modify…


Networking is an integral part of most iOS applications. A common network-related task is Internet connectivity detection. Typically, it appears in three scenarios:

  • Disabling or enabling app features based on network connectivity status.
  • Attaching constraints to network operations, e.g., disabling large file download via cellular.

The most popular answers on how to detect network connectivity status on iOS suggest using SCNetworkReachability. In this article, let's discuss why this solution is less than optimal, and lay out best practices of working with the Internet connection recommended by Apple.

Checking Connectivity Before Firing a Request

In its documentation, Apple says that…


This is a cross-post from my blog on Advanced Swift Development. 👉 Click here to directly open this article.

In this article, we’ll implement a paginated list with endless scroll using SwiftUI, Combine, and the MVVM architecture. Complete source code included 👍.


Illustration by unDraw

Pointers are one of the most complex features in the Swift language. First, the concept of pointers is hard by itself. Second, using them incorrectly could lead to memory leaks and undefined behavior. Third, Swift exposes pointers through a set of thirteen types, which may seem overwhelming. The goal of this article is to put Swift pointers in a systematic way: what they are, when to use, and what you can get from them.

What is Memory

Memory is a long list of bytes. Every byte has a number, called memory address, and can hold a content. …


Understanding one of Swift’s newest features

illustration by Ouch.pics

Functions builders are the language feature first introduced in Swift 5.1. It powers SwiftUI declarative DSL, which allows us to construct heterogeneous user interface hierarchies in a readable and concise way. In this article, we will learn how to utilize them in our code, covering the following topics:

  • How do function builders work on the Swift compiler level?
  • How to implement a custom Swift function builder

Understanding Swift Function Builders

A function builder is a type that implements an embedded DSL for collecting partial results from the expression-statements of a function and combining them into a return value [1].

The…


This is a cross-post from my blog on Advanced Swift Development. 👉 Click here to directly open this article.

The number of mechanisms available to pass data between SwiftUI views can first seem overwhelming. But once we put them in a systematic way, they all have unique requirements and usage cases.

In this article, we’ll break down view communication patterns into 5 scenarios and take a look at each:

  • From parent to distant child
  • From child to direct parent
  • From child to distant parent
  • Between children

The reason why I am not posting the full article here is that I don’t want Medium to sell my articles. I am giving all my content for free and that’s how it’s going to stay. As a reader you’ll also get better experience with code highlight and formulae.


This is a cross-post from my blog on Advanced Swift Development. 👉 Click here to directly open this article.

Implement a SwiftUI ViewModifier that manages a keyboard when it covers a text field:

  • 🚀 Take care of over-scrolling.
  • 👨‍💻 Complete source code included.

The reason why I am not posting the full article here is that I don’t want Medium to sell my articles. I am giving all my content for free and that’s how it’s going to stay. As a reader you’ll also get better experience with code highlight and formulae.


This is a cross-post from my blog on Advanced Swift Development. 👉 Click here to directly open this article.

With the introduction of SwiftUI and Combine, MVVM has become a new industry standard. In this article we’ll cover:

  • 🚀 The flow of data and dependencies.
  • 💡 Unidirectional data flow over of two-way bindings.
  • 🔁 Representing the UI as a finite-state machine.
  • 👨‍💻 Complete source code included.

The reason why I am not posting the full article here is that I don’t want Medium to sell my articles. I am giving all my content for free and that’s how it’s going to stay. As a reader you’ll also get better experience with code highlight and formulae.

Vadim Bulavin

Senior iOS Software Engineer at Pluto TV. Creator of Yet Another Swift Blog https://www.vadimbulavin.com/. Coding for fun since 2008, for food since 2012.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store