I am new to swift and apple development in general (coming from JS world). I am trying to do a simple desktop app by wrapping WKWebView. Part where ViewController creates a webView works ok. At least it looks so: It loads a webpage :)
But when I click into any input field I am not able to write anything. There's even no cursor visible in the field.
Basically only clicking by mouse/touchpad works. But mouse cursor is not changing when hovering over elements (e.g. buttons and also the textfields). It looks to me there is some kind of mask/layer above the webpage. Clicking is propagated to page itself but not the hovers and key strokes
Is there any special project settings/rights enabling keyboard in the app? How can I make the page inputs editable?
More details:
- Clicking the textfield works (it changes e.g. border color based on focus selector)
- clicking
<a>
links in the webview works - right-mouse clicks seems to work (it shows copy/paste options etc)
- pasting by right-mouse click into the field works
code:
import Cocoa
import SafariServices.SFSafariApplication
import WebKit
class ViewController: NSViewController, WKNavigationDelegate {
@IBOutlet var ww: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
ww.navigationDelegate = self
ww.load(URLRequest(url: URL(string: "https://www.google.com")!))
view = ww
}
}
Ww
is WebKit ViewWw
covers all theView
area (drag & dropped by mouse)
THANKS for any answer or hint!