How to remove, update, or replace the WKWebView inputAccessoryView
Many others, including myself, have been trying to safely modify the WKWebView.inputAccessoryView. Now in iOS 13+, you can do it!
TL;DR; The WebKit team update the code, Apple updated their dependency in iOS 13.
Swift code sample:
In another class somewhere:
Because WebKit is a library that iOS uses (like SQLite), I assumed that Apple would update that dependency as well for iOS 13, since the change was resolved around June 2019.
References:
My original SO answer here: https://stackoverflow.com/a/58001395/344591
Working code example: https://github.com/cbess/RichEditorView/commits/master
TL;DR; The WebKit team update the code, Apple updated their dependency in iOS 13.
Swift code sample:
import WebKit class RichEditorWebView: WKWebView { var accessoryView: UIView? override var inputAccessoryView: UIView? { // remove/replace the default accessory view return accessoryView } }
In another class somewhere:
// set accessory view to replace it, if left untouched, then it will be removed let webView = RichEditorWebView() webView.accessoryView = SomeAwesomeInputAccessoryView()
Because WebKit is a library that iOS uses (like SQLite), I assumed that Apple would update that dependency as well for iOS 13, since the change was resolved around June 2019.
References:
- https://trac.webkit.org/changeset/246229/webkit#file1
- https://bugs.webkit.org/show_bug.cgi?id=198631
My original SO answer here: https://stackoverflow.com/a/58001395/344591
Working code example: https://github.com/cbess/RichEditorView/commits/master
Comments