With SwiftUI, Apple created a really simple way to build user interfaces using declarative approach. Apple also introduced new UIKit APIs with iOS 13 to simplify UIKit implementations. Even, potential of SwiftUI is greater than creating simple user interfaces; New UIKit APIs are also helping to create interfaces as declarative as possible and it still shows a promise, IMO.

Using UICollectionViewDiffableDatasource, we easily manage the handling of datasource changes and defining multiple sections with different section layouts. Also, combining these features, we could add extra capabilities into our datasource wrapper.

I created this datasource wrapper to achieve to create collection…

Coordinator Pattern is one of the ways to implement a navigation control flow on iOS applications. Coordinators make it easy to test and encapsulate the navigation logic; it also helps to create reusable components, to use them on horizontal(push) or vertical(present) flows. It is a great place to implement deep linking and to provide dependencies between flows.

However, you have to be careful to handle lifecycles of the coordinators in order to avoid memory leaks. Especially back button taps, swipe back and iOS 13 dismiss gesture events can create memory leaks if those events are not handled properly.

To handle…

Combine framework was introduced at WWDC 2019 as a new way of reactive programming on Apple platforms. It has native support on all Apple platforms that runs iOS 13+, iPadOS 13+, macOS 10.15+, watchOS 6+ or tvOS 13+; however, it has a couple of fundamental problems on beta and early iOS 13 versions as Matt Gallagher mentioned in his great articles. Even they are mostly fixed on later versions, you could still encounter unexpected behaviors on iOS 14 and I will try to cover one of them.

In this article, I will explain the built-in PrefixUntilOutput AKA prefix(untilOutputFrom:) publisher operator…

Using custom initializers inside view controllers on iOS 13 or later.

StoryboardLoadable protocol

Using this protocol, we can now initialize our view controllers without the force unwrapping its properties while using storyboards.

Force unwrapping(!) is extracting the value of an optional and assuring compiler for it to have value. However this process has its downsides on runtime and crashes application if accessed value is nil.

Conforming protocol on view controller

Our view controller is inside Malignant.storyboard and its storyboard ID is same as its name which is MalignantViewController.

Define view controller

Now we could use our custom initializer to inject…

Hasan Acar

iOS Developer, waiting AI takeover. @hsncr on GitHub and LinkedIn

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