Modern Configurations for Cells and Views After iOS 14.0

textLabel, detailTextLabel, and imageView are deprecated in iOS 14. Now we should use configurations for our cells and views.

Penny Ng
Geek Culture
Published in
3 min readDec 15, 2021

--

Photo by Kelly Sikkema on Unsplash

We used to set the content and styling of the image and text on a cell directly before UIListContentConfiguration was introduced in WWDC20.

You must be familiar with these lines of code. This is how we customised the built-in imageView and textLabel of a UITableViewCell.

cell.textLabel?.text = "Hello, World!"
cell.textLabel?.textColor = .blue
cell.textLabel?.font = UIFont.systemFont(ofSize: 16)
cell.detailTextLabel?.text = "I love Swift"
cell.imageView?.image = UIImage(named: “swift”)

But properties such as textLabel, detailTextLabel, and imageView are deprecated in iOS 14.0. You will see this warning on XCode if you try to use these properties.

How are we supposed to do after iOS 14.0?

Apple suggests we use UIListContentConfiguration instead.

What is a configuration?

There are two types of configurations:

  • Background configurations (UIBackgroundConfiguration): allow you to quickly customise the background appearances and…

--

--

Penny Ng
Geek Culture

A passionate self-taught  iOS developer. Write to record my learning and share the knowledge