UIDragItem causes memory leak when Context Menu has been initialised

65 views Asked by At

I have a CollectionView with Drag and Drop and Context Menu functionality. There's a memory leak caused by returned [UIDragItem] array in ItemsForBeginning method when I initialise cell's context menu.

Objects are being kept in memory when I pop to rootViewController. All is OK though when drag session is being happened.

I've ended up commenting out everything, keeping blank UIDragItem and problem is still there:

func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
    let dragItem = UIDragItem(itemProvider: NSItemProvider(object: "" as NSString))
    return [dragItem]
}

Does anybody experience this? Looks like it's a UIKit bug...

Please help!

0

There are 0 answers