Vicente Garcia
Vicente Garcia

Reputation: 6390

NSView stopped clipping to bounds on macOS 14

I have a macOS app with AppKit that when building on the latest Xcode, Xcode 15 and testing on macOS 14 many elements of the UI seem wrong.

At first glance it seems as if they views stopped clipping to bounds when the used to do it, as in some cases I relied on this behaviour to show/hide buttons from a toolbar.

Upvotes: 1

Views: 321

Answers (1)

Vicente Garcia
Vicente Garcia

Reputation: 6390

Clip to bounds

Starting on macOS 14 and Xcode 15 NSView has a new property: clipsToBounds, similar to the one on UIView for iOS, but the difference is that on NSView there was nothing like this before.

Even if the documentation says this is available since macOS 10.9+ I'm sure this was not there a few months ago, and behaviour changes too.

From the documentation:

By default this value is false. In macOS 13 and earlier, the default value is true.

Not sure if this was covered on the WWDC and I just overlooked the update, but I can predict this will be breaking many AppKit apps.

To fix it and adopt the old behaviour is simple:

myNSView.clipsToBounds = true

Upvotes: 1

Related Questions