Post

Replies

Boosts

Views

Activity

Modern collection view registration with Storyboards?
Can you use modern collection view cell/view registration with custom views designed in a storyboard? I am familiar with putting a custom cell, or reusable view, inside the collection view of the storyboard, and configuring it with constraints and outlets. Then manually dequeueing the cell/view, and configuring the view. How do you do this with the new decoupled methods of cell registration and configuration? For example, if I have the following:         let headerRegistration = UICollectionView.SupplementaryRegistration         <HeaderReusableView>(elementKind: "header") { (supplementaryView, _, indexPath) in             supplementaryView.titleLabel?.text = "foo"         }         self.datasource?.supplementaryViewProvider = { (_, _, index) in             return self.collectionView.dequeueConfiguredReusableSupplementary(using: headerRegistration, for: index)         } HeaderReusableView is a UICollectionReusableView that is added to my storyboard, and the titleLabel is added, and hooked up via an outlet. When I run the code, it does not seem to make the connection, and the outlet is nil.
2
0
1.2k
Nov ’21