How to reload the expandable section header in the diffable data source
How to reload the expandable section header in the diffable data source

This article is originally published at https://swiftsenpai.com on February 21, 2021.

A couple of months ago, I have wrote an article about “ The Modern Ways to Reload Your Table and Collection View Cells “. The concept is simple, we first identify the desired data source snapshot item, update it, and then apply the changes to the data source snapshot.

When It comes to reloading an expandable list header, things get a little bit trickier. This is because we are now dealing with a diffable data source section snapshot, which is another layer deeper into the data source snapshot.

In…


Re-enabling the iOS Simulator Slow Animations Shortcut
Re-enabling the iOS Simulator Slow Animations Shortcut

This article is originally published at https://swiftsenpai.com on February 6, 2021.

As iOS developers, we always tend to use an actual device for testing during app development. A real device can provide an actual hardware environment similar to the production release, it also gives us a better idea about the UI / UX of our app.

However, there are certain times where iOS simulator truly shines, one of them is when debugging complex animation. The “Slow Animations” feature of a simulator can drastically reduce the app animation speed, allowing developers to clearly see the animation’s transition.


What you should know but Apple didn’t tell you.

The Undocumented Facts of Diffable Data Source Section Snapshot
The Undocumented Facts of Diffable Data Source Section Snapshot

This article is originally published at https://swiftsenpai.com on January 25, 2021.

The diffable data source section snapshot is an UIKit component introduced in iOS 14. It opens up new possibilities for developers to build various types of hierarchical lists using collection view declaratively.

Even though it is such a powerful component, Apple’s official documentation does not provide much information on how it works and how to use it effectively.

In this article, I would like to share with you some interesting facts about section snapshot that I recently discovered.

With all the being said, let’s get right into it!

The Visual Descriptor

When…


Replicate the Expandable Date Picker Using UICollectionView List
Replicate the Expandable Date Picker Using UICollectionView List

This article is originally published at https://swiftsenpai.com on January 10, 2021.

The expandable date picker is a very common UI component in the Apple design system. You can find it in the iOS Reminder and Calendar App. Even though it does not come out of the box with UIKit, we can easily create one using a custom cell within a table view.


Adopting it is easy, getting it right is tricky.

The Large Title UINavigationBar Glitches and How to Fix Them
The Large Title UINavigationBar Glitches and How to Fix Them

This article is originally published at https://swiftsenpai.com on December 14, 2020.

Recently I have been requested by my client to add a large title navigation bar into their app’s main screen, on top of that the large title should automatically collapse when users start scrolling.


With a simple approach recommended by the Apple engineers

Reducing Memory Footprint When Using UIImage
Reducing Memory Footprint When Using UIImage

This article is originally published at https://swiftsenpai.com on December 1, 2020.

Recently my team and I are working on an image processing app for a client. The app works pretty well on most of the aspects. Unfortunately, when we start loading HD images on screen, the app will crash occasionally due to “out of memory exception”.

In this article, I would like to share with you the problem we are facing, what is the root cause of the high memory usage and how we manage to reduce the app’s memory footprint using a simple fix recommended by the Apple engineers.

The Problem


Using built-in and custom text provider

Image for post
Image for post

This article is originally published at https://swiftsenpai.com on November 15, 2020.

It’s been awhile since I covered topics related to Lottie animation. In my previous article, “ Modifying Lottie Animation with Value Providers “, I have discussed how developers can leverage different kinds of value providers to manipulate an animation during runtime based on their own needs.

In this article, let’s take a look at another less known yet pretty useful value provider in the Lottie SDK — Text Provider. As you might have guessed, a text provider allows you to change the texts within a Lottie animation during runtime.


A declarative way to add a custom header

Image for post
Image for post

This article is originally published at https://swiftsenpai.com on November 7, 2020.

In my previous article, we had discussed how to add a declarative header and footer to the UICollectionView List. This week, let's take one step further and talk about how you can add a custom header to your collection view declaratively.

This is a continuation of my previous article “ Declarative UICollectionView List Header and Footer “, therefore do make sure to check it out before proceeding.

The Sample App


No storyboard or interface builder required.

Declarative UICollectionView List Header and Footer
Declarative UICollectionView List Header and Footer

This article is originally published at https://swiftsenpai.com on October 19, 2020.

If you have been following my work for the past couple of months, you have probably read my articles about constructing a basic and expandable list declaratively using cell registration, content configuration, and data source snapshot.

In this article, let’s take one step further and learn how you can construct a list with header and footer declaratively without the need of using storyboard or interface builder.

For simplicity’s sake, this article will only be focusing on configuring and adding a system default header and footer, ways to add a…


It might not be as straightforward as you think.

The Modern Ways to Reload Your Table and Collection View Cells
The Modern Ways to Reload Your Table and Collection View Cells

This article is originally published at https://swiftsenpai.com on October 4, 2020.

In iOS 13, Apple introduced diffable data source and snapshot, defining the modern era of table view and collection view. Prior to this, reloading a table or collection view cell can be easily done by calling one of the following functions:

reloadRows(at:with:) // For reloading table view cell reloadItems(at:) // For reloading collection view cell

For table and collection views constructed using a diffable data source, this is no longer true. If so, how should developers go about reloading their table and collection view cells?

The solution to this…

Lee Kah Seng

https://swiftsenpai.com | iOS developer since 2011 | Swift Lover | Music Addict | Anime Fan | Part-time Backpacker

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