Always use NSUserInterfaceValidations instead of NSMenuItemValidation

This commit is contained in:
Damiano Galassi committed 2024-07-20 12:02:15 +02:00
1 parent a50a136e86
commit 0a135b7040
5 files changed
+16 -16

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ import Cocoa
@MainActor @objc optional func collectionViewPaste(to collectionView: NSCollectionView)
}
class CollectionView: NSCollectionView, NSMenuItemValidation {
class CollectionView: NSCollectionView, NSUserInterfaceValidations {
var pasteboardTypes: [NSPasteboard.PasteboardType]
var pasteboardHasSupportedType: Bool {
@@ -104,8 +104,8 @@ class CollectionView: NSCollectionView, NSMenuItemValidation {
}
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if let action = menuItem.action {
func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
if let action = item.action {
switch action {
case #selector(delete(_:)):
if isSelectionEmpty || implements(selector: #selector(CollectionViewDelegate.collectionViewDelete(in:))) == false {