Post

Replies

Boosts

Views

Activity

UICollectionViewDiffableDataSource crash
Why does returning nil from UICollectionViewDiffableDataSource<FeedElement, Entity>(collectionView: collectionView) {             (collectionView: UICollectionView, indexPath: IndexPath, entity: Entity) -> UICollectionViewCell? in result n "the collection view's data source did not return a valid cell from" Isn't the UICollectionViewCell optional?
Topic: UI Frameworks SubTopic: UIKit Tags:
5
0
2.6k
Dec ’21
UICollectionViewDataSourcePrefetching & UICollectionViewDiffableDataSource
I can't seem to get UICollectionViewDataSourcePrefetching working with DiffableDatasource, my delegate methods are not being called. Do these work together? 		func viewDidLoad() 				....         collectionView.prefetchDataSource = self         collectionView.isPrefetchingEnabled = true 		} extension ViewController: UICollectionViewDataSourcePrefetching {     func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) {         let urls: [URL] = indexPaths.compactMap { indexPath in             guard let displayableItem = dataSource.itemIdentifier(for: indexPath),                 let itemViewModel = displayableItem.item as? ViewModel,                 let image = itemViewModel.firstImageURL else {                     return nil             }             return image         }         ATHLogging.log.critical("prefetching: \(urls)")         preheater.startPreheating(with: urls)     }
2
0
2.5k
Feb ’21
Widget not taking over full height
There is a black bar at the top of my Widget and I can't seem to figure out how to get rid of it. struct A1EntryView : View {     var entry: Provider.Entry     var body: some View {         Text("Temp")             .frame(maxHeight: .infinity)             .background(Color(.red))             .ignoresSafeArea(.all)     } }
0
0
643
Sep ’20