NSTextField problem in XCode 15.2

Because my MacOS app has a user-programmable interface, my coding creates lots of interface elements programmatically. Soon after an update to MacOS 14.3.1, I found some of these element (NSTextFields) did not draw correctly. I had not changed any code but the appearance changed for the worse (the text in the text field did not appear).

I then noticed:

  1. The problem occurs when I compile in XCode 15.2 (15C500b) Version and run on computer with Sonoma 14.3.1 (23D60)

  2. If I instead compile in XCode Version 14.1 (14B47b) on Ventura 13.0.1 (22A400) and copy the app to my computer with Sonoma 14.3.1 (23D60)all works as expected.

These results seem to imply XCode 15.2 does not compile correctly? Is this known issue or is there a fix?

Replies

These results seem to imply Xcode 15.2 does not compile correctly?

I don’t think that’s the cause. It’s more likely that the text field is changing behaviour based on a linked-on-or-later check, that is, what SDK your app was built with.

There have been significant changes in how the system handles text in recent OS releases. See the follow for the full backstory:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

As well as the possibilities mentioned by Quinn, this could also be a side effect of the clipsToBounds change in Sonoma:

https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-14#NSView

If that's what is going on here, the issue is likely not with the text fields themselves, but with some other view in your window that's drawing over the text in the text fields.