# WKWebkit and NSTextField

**URL:** <https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988>\
**Category:** Other\
**Created:** [22 August 2021 05:37 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988 "2021-08-22T05:37:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [22 August 2021 05:37 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988/1 "2021-08-22T05:37:22Z")

</div>

I have a Swift app that puts a WKWebView and NSTextfield on a window…  
The problem is… when I do, the WebView doesn’t show up… If I remove the TextField then it does, and works fine. put the TF back, the the WebView vanishes.

After a few hours of testing, and debugging, I have discovered this. When both controls are on the window, the WebView frame all of a sudden has a frame size change to 0,0. So in fact the control is still there, but only a a “dot”… WIthout the TF on the screen, the frame size remains as it should be.

This happens sometime during the whole window set up… as soon as windowDidBecomeMain event takes place, the frame size is gone… but I cannot tell what (if anything is happening just prior to this event.

If I use the now deprecated WebKit instead, it works fine…

Anyone have any clue what might be going on?

---

<div class="post-metadata">

**Author:** ![thorstenstueker](https://ifnotnil.com/letter_avatar_proxy/v4/letter/t/aca169/32.png) [@thorstenstueker](https://ifnotnil.com/u/thorstenstueker)\
**Post date:** [22 August 2021 05:40 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988/2 "2021-08-22T05:40:49Z")

</div>

use the deprecated Webkit while…Xojo?

---

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [22 August 2021 05:57 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988/3 "2021-08-22T05:57:30Z")

</div>

Apple only accepts WKWebkit since macOS 10.14… this is Swift not Xojo…

Ironically the exact same app in Xojo works…but I can;t be 100% sure what under the hood there.

---

<div class="post-metadata">

**Author:** ![thorstenstueker](https://ifnotnil.com/letter_avatar_proxy/v4/letter/t/aca169/32.png) [@thorstenstueker](https://ifnotnil.com/u/thorstenstueker)\
**Post date:** [22 August 2021 05:59 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988/4 "2021-08-22T05:59:15Z")

</div>

That’s sadly true!

---

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [22 August 2021 15:52 UTC](https://ifnotnil.com/t/wkwebkit-and-nstextfield/1988/5 "2021-08-22T15:52:57Z")

</div>

Solved… I had to embed the WKWebKit control in a hosting NSView… and delegate all the events via the NSView… don’t know why, but now it seems to work just fine
