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.
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.
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.
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.
Wanted to know more? …
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.
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 custom header and footer will be a story for another day. …
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 might not be as straightforward as you think. Due to the difference between value type and reference type, there will be 2 different ways to reload the table and collection view cells. …
This article is originally published at https://swiftsenpai.com on September 22, 2020.
In last week’s article, we learned how to leverage the
NSDiffableDataSourceSectionSnapshot to create an expandable list in a single-section collection view. In this article, we will pick up where we left off by modifying last week's sample app to display the same set of model objects in a multi-section collection view.
Following animated GIF showcases what we going to build in this article.
This article is originally published at https://swiftsenpai.com on September 10, 2020.
Expandable list or some might call it expandable table view, is a very common UI design that is used in a large variety of apps. Despite the fact that it is so popular, UIKit does not have any native APIs that support this kind of layout.
With the introduction of iOS 14, this is no longer true!
This article is originally published at https://swiftsenpai.com on August 22, 2020
Since the publishing of my article “UICollectionView List with Custom Cell and Custom Configuration”, a lot of my readers have been asking me whether it is possible to design the custom
UICollectionViewListCell in the interface builder.
Well, the answer is definitely yes!
UICollectionViewListCell's content view is just a
UIView subclass that conforms to the
UIContentView protocol, theoretically as long as we are able to link up the content view with the interface builder then everything should work accordingly.
After spending some time experimenting in Xcode, I have successfully created a
UICollectionViewListCell content view using interface builder. On top of that, I also discovered that you can even manipulate the cell height by adjusting the auto layout constraints within the cell's content view. …