NSTextView invisible in app, visible in Debug View Hierarchy

After upgrading to Sonoma and Xcode 15, some of the NSTextViews in my app no longer show up. However, if entering Debug View Hierarchy, you can see them just fine.

This only seems to happen with certain views that are created programmatically.

Accepted Reply

Basically, it is caused by the fact that NSView clipToBounds is set to NO by default in Sonoma, but in Debug View Hierarchy it is still drawn as if clipToBounds were set to YES. This is obviously an Xcode bug.

  • Thinking more about this, it might in fact not be a bug, but working as intended. As the Debug View Hierarchy is focused on the hierarchy (no surprise there), it is more useful to show the actual bounds of each view, rather than exactly matching the final app display. Showing stuff a view draws outside its bounds might only make things confusing.

Add a Comment

Replies

If you can show this behavior in a small demo Xcode project, I think this would be a good issue to raise as a support incident with DTS.

Seems that the image view at the top is for some reason drawn over the textview at the bottom. If I remove the image view, the text view is visible again.

Basically, it is caused by the fact that NSView clipToBounds is set to NO by default in Sonoma, but in Debug View Hierarchy it is still drawn as if clipToBounds were set to YES. This is obviously an Xcode bug.

  • Thinking more about this, it might in fact not be a bug, but working as intended. As the Debug View Hierarchy is focused on the hierarchy (no surprise there), it is more useful to show the actual bounds of each view, rather than exactly matching the final app display. Showing stuff a view draws outside its bounds might only make things confusing.

Add a Comment