Post

Replies

Boosts

Views

Activity

Reply to UIContextMenuConfiguration causes retain cycle
Thanks for reply! I've ended up commenting out everything inside and issue is still the same: func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) - UIContextMenuConfiguration? {         return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { [weak self] _ in             return nil         } }
Mar ’21
Reply to UIContextMenuConfiguration causes retain cycle
Hi! My collectionView has drag and drop functionality + context menu for cells. I've discovered itemsForBeginning method is being called each time after contextMenuConfigurationForItemAt method (and context menu appearing) and I've found out that the problem is in dragItem.localObject assigning. Here's my itemsForBeginning method below:     Fetched objects container: var sheets: [Sheet]? func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) - [UIDragItem] {         guard let sheets = self.sheets else { return [] }         let itemProvider = NSItemProvider(object: sheets[indexPath.item] as NSItemProviderWriting)         let dragItem = UIDragItem(itemProvider: itemProvider)         if indexPath.item sheets.count {             dragItem.localObject = sheets[indexPath.item]             return [dragItem]         } else {             return []         }     }
Mar ’21