INNER CODE UNIT · Swift
showAlert
mjrusso/scoot · Scoot/AppDelegate.swift:68
func showAlert(completion: (Bool) -> Void) {
let alert = NSAlert()
alert.messageText = "Accessibility Permission Required"
alert.informativeText = "Please re-launch Scoot after authorizing."
alert.alertStyle = .critical
alert.addButton(withTitle: "View Documentation")
alert.addButton(withTitle: "Exit")
completion(alert.runModal() == .alertFirstButtonReturn)
}
showAlert { viewDocumentation in
if viewDocumentation {
self.installationHelpRequested(self)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
OSLog.main.log("Terminating because not trusted as an AX process.")
NSApp.terminate(self)
}