I'm debugging code to see why a WKWebView's instance doesn't become the firstResponder by doing the following:
override func becomeFirstResponder() -> Bool {
let becomeFirstResponserResponse = super.becomeFirstResponder()
print(becomeFirstResponserResponse, self.isFirstResponder)
return becomeFirstResponserResponse
}
This prints out true, false. I've also verified that the web view's window property isn't nil.
As per Apple's documentation, becomeFirstResponder returns true if this object is now the first responder; otherwise, false.. So I'd expect self.isFirstResponder to be true. What am I understanding incorrectly?
Because you haven't even finished returning from
becomeFirstResponderyet! If you were to do your print inside a half-seconddelayyou would find that we are in fact now returningtruefromisFirstResponderas well.