I'm pretty confused. Usually in an iOS app I would access the settings using a url scheme. Now I found out that on MacOSX using Objective-C you can do this:
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
BOOL accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
I've tried to convert this to Swift but didn't got to a valid result. Does anyone know how to convert this or a valid method to ask for assistive access in Swift?
The kAXTrustedCheckOptionPrompt
type is Unmanaged<CFString>
so you need to access to the retained value as show below
let options : NSDictionary = [kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true]
let accessibilityEnabled = AXIsProcessTrustedWithOptions(options)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With