Use UIControl.performPrimaryAction instead of SPI on iOS 17.4
This commit is contained in:
parent
d37c5dde2f
commit
8a3acc6889
|
@ -332,10 +332,14 @@ class CustomAlertActionsView: UIControl {
|
||||||
if action.handler == nil,
|
if action.handler == nil,
|
||||||
case .menu(_) = action.style,
|
case .menu(_) = action.style,
|
||||||
let interaction = button.contextMenuInteraction {
|
let interaction = button.contextMenuInteraction {
|
||||||
|
if #available(iOS 17.4, *) {
|
||||||
|
button.performPrimaryAction()
|
||||||
|
} else {
|
||||||
let selector = NSSelectorFromString(["Location:", "At", "Menu", "present", "_"].reversed().joined())
|
let selector = NSSelectorFromString(["Location:", "At", "Menu", "present", "_"].reversed().joined())
|
||||||
if interaction.responds(to: selector) {
|
if interaction.responds(to: selector) {
|
||||||
interaction.perform(selector, with: recognizer.location(in: button))
|
interaction.perform(selector, with: recognizer.location(in: button))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
action.handler?()
|
action.handler?()
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
|
Loading…
Reference in New Issue