Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one disable third party keyboards in Swift?

Basically that's it, I haven't found a way to disable third party keyboard in my app, although I know it's possible 'cos I've seen it in apps like 1Password.

Any ideas?

like image 527
Hikarus Avatar asked Jan 18 '16 20:01

Hikarus


2 Answers

Add this code in your AppDelegate

func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool {
    if extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier {
        return false
    }
    return true
}

Swift 4:

func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
    if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
        return false
    }
    return true
}

Apple reference.

like image 186
Rashwan L Avatar answered Oct 20 '22 10:10

Rashwan L


Swift 3 :

func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
    if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
        return false
    }

    return true
}
like image 9
wuf810 Avatar answered Oct 20 '22 10:10

wuf810