Files
Attractor/App/Utilities/UIKeyCommand+ConvInit.swift
2022-08-03 19:04:40 -07:00

36 lines
835 B
Swift

//
// UIKeyCommand+ConvInit.swift
// App
//
// Created by James Magahern on 9/21/20.
//
import UIKit
extension NSObject {
@objc fileprivate func _null() {}
}
extension UIKeyCommand {
public static func null() -> UIKeyCommand {
UIKeyCommand(modifiers: [], input: "", title: "", action: #selector(_null))
}
public func isNull() -> Bool {
return action == #selector(_null)
}
convenience init(modifiers: UIKeyModifierFlags, input: String, title: String, action: Selector) {
self.init(input: input, modifierFlags: modifiers, action: action)
self.title = title
}
public func prioritizeOverSystem() -> UIKeyCommand {
if #available(iOS 15.0, *) {
self.wantsPriorityOverSystemBehavior = true
}
return self
}
}