Posts

Showing posts from September, 2019

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: 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 It was too difficult to find the answer, s