How to animate NSSegmentedControl on macOS 26?

I noticed that in Xcode 27 Beta 1 on macOS 27 Beta 1, changing the selection of the segmented control used to switch between the Sidebar and Inspector tabs is animated.

However, the standard segmented controls used by NSTabView/NSTabViewController, as well as a regular NSSegmentedControl, do not appear to have any such animation on macOS 27.

I also tried using the animator proxy:

segmentedControl.animator().selectedSegment = index

but this did not change the behavior.

How can I implement the same kind of segmented control selection animation that Xcode uses? Is there a public API for this, or is it achieved through a different mechanism?

Answered by 1024jp in 893652022

I found the answer myself and was able to resolve this.

It turns out this was actually introduced as a new feature/API in macOS 27, and I had simply overlooked it. The animation can be enabled by assigning one of the new NSSegmentedControl.Role values.

Since I’ve already solved the issue, no further replies are necessary.

Accepted Answer

I found the answer myself and was able to resolve this.

It turns out this was actually introduced as a new feature/API in macOS 27, and I had simply overlooked it. The animation can be enabled by assigning one of the new NSSegmentedControl.Role values.

Since I’ve already solved the issue, no further replies are necessary.

How to animate NSSegmentedControl on macOS 26?
 
 
Q