Files
Attractor/App/Utilities/UIKeyCommand+ConvInit.swift

36 lines
835 B
Swift
Raw Normal View History

2020-09-21 18:35:39 -07:00
//
// UIKeyCommand+ConvInit.swift
// App
//
// Created by James Magahern on 9/21/20.
//
import UIKit
2022-03-29 17:27:07 -07:00
extension NSObject {
@objc fileprivate func _null() {}
}
2020-09-21 18:35:39 -07:00
extension UIKeyCommand {
2022-03-29 17:27:07 -07:00
public static func null() -> UIKeyCommand {
UIKeyCommand(modifiers: [], input: "", title: "", action: #selector(_null))
}
2022-08-03 19:04:40 -07:00
public func isNull() -> Bool {
return action == #selector(_null)
}
2020-09-21 18:35:39 -07:00
convenience init(modifiers: UIKeyModifierFlags, input: String, title: String, action: Selector) {
self.init(input: input, modifierFlags: modifiers, action: action)
self.title = title
}
2021-06-10 21:39:32 -07:00
public func prioritizeOverSystem() -> UIKeyCommand {
if #available(iOS 15.0, *) {
self.wantsPriorityOverSystemBehavior = true
}
return self
}
2020-09-21 18:35:39 -07:00
}