HUGE DEVELOPMENT!
@MarkHunte would probably scoff at this, but I finally got two-way communication working. That means Swift and the WKWebView can now pass data between each other.
It’s really simple too… https://www.hackingwithswift.com/example-code/wkwebview/how-to-run-javascript-on-a-wkwebview-with-evaluatejavascript
Why is this important? It means that I now can create widgets that are more powerful than just HTML alone. I can leverage data from the macOS side. Theoretically, the Dictionary widget should now be possible. WOOOOOO! Also, I thought about adding a CPU Monitor widget (Usage Percentage / Temperature). This is amazing because that’s a new widget that I would want.
Here’s a really rudimentary demo…
That time information is from Swift adding the JavaScript Date() and I’m able to read back in the changes to the element in the widget. HHHUUUUUGGGGGGEEEEE!
Dragging around widgets is almost working too. It’s very easy with Hype’s “On Drag” “Control Element Position” option… but when doing that on a group, it seems to block the Input. Heh, it’s always something. I probably can figure a solution to that. I’m going to need to, otherwise there won’t be HTML/JavaScript data to send to Swift.
HUUUUUUUGGGGGEEEEE!
OK, I think I can take a break now. It was a rough day.