tweak drag setup

This commit is contained in:
Nihaal Sharma committed 2026-08-30 17:42:16 +05:30
1 parent 0284db7c80
commit 074974ecb8
4 files changed
+17 -1

No files matched your search

@@ -16,7 +16,6 @@ extension EmojiCollectionView: UICollectionViewDragDelegate {
at indexPath: IndexPath
) -> [UIDragItem] {
let emojiName = items[indexPath.row]
guard let emoji = hoarder.trie.dict[emojiName] else { return [] }
let item = NSItemProvider(item: emojiName as NSSecureCoding, typeIdentifier: UTType.utf8PlainText.identifier)
@@ -115,4 +115,19 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
button.isUserInteractionEnabled = false
edit = false
}
override func dragStateDidChange(_ dragState: UICollectionViewCell.DragState) {
self.transform = .identity
switch dragState {
case .none:
self.setEdit(to: edit, animated: false)
case .lifting:
button.alpha = 0
case .dragging:
button.alpha = 0
@unknown default:
fatalError()
}
}
}
@@ -21,6 +21,7 @@ class DownloadedViewController: UINavigationController, UINavigationControllerDe
style: .plainWithMenu
)
downloadedView.navigationItem.title = "Downloaded"
downloadedView.collectionView.dragInteractionEnabled = false
super.init(rootViewController: downloadedView)
refreshUI()
@@ -35,6 +35,7 @@ class SearchViewController: UINavigationController, UISearchControllerDelegate,
width: 75,
style: .plainWithLabel
)
(self.resultsView as! EmojiCollectionView).collectionView.dragInteractionEnabled = false
} else {
self.resultsView = EmojiTableView(hoarder: emojiHoarder, items: [])
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.