In iOS 16, Apple added UIHostingConfiguration, making it straightforward to use a SwiftUI view in instances of UICollectionViewCell and UITableViewCell. This gist shows how UIHostingConfiguration can be backported to iOS 14 by implementing a type that conforms to UIContentConfiguration.
Starting from iOS 16, we can use SwiftUI views in an instance of UICollectionView or UITableViewCell like this:
cell.contentConfiguration = UIHostingConfiguration {
ExampleCellContentView(color: Color(item.color), text: item.text)
}