Skip to content

Instantly share code, notes, and snippets.

@joseph
joseph / WKWebViews+keyboardRequiresUserInteraction.swift
Last active October 23, 2017 16:03 — forked from Pranit-Harekar/WKWebViews+keyboardRequiresUserInteraction.swift
Add keyboardRequiresUserInteraction to WKWebViews
import WebKit
// This swizzle allows JavaScript to set the focus on an input, not just when a user is interacting.
//
extension WKWebView {
private typealias StartAssistingNodeMethodType = @convention(c) (Any, Selector, UnsafeRawPointer, Bool, Bool, Any) -> Void
private typealias StartAssistingNodeClosureType = @convention(block) (Any, UnsafeRawPointer, Bool, Bool, Any) -> Void
func focusInputsWithoutUserInteraction() {