Would like public api for how the sidebar button in Notes.app tracks the split view

Originator:todd.thomas
Number:rdar://24403996 Date Originated:28-Jan-2016 09:20 PM
Status:Open Resolved:
Product:OS X SDK Product Version:10.11
Classification: Reproducible:Always
 
Summary:
I was tasked with building something like Notes.app with the split view and sidebar button in the toolbar. After two days I gave up trying to animate the sidebar button when the split view collapsed/uncollapsed I found out there was private api that does this though. Since using private api is frowned upon in Mac App Store apps I sent a note to DTS (included below). Their response was ' Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.'

So I guess I'd like something like that to become public api in a future OS version. :-)

Original note to DTS:
I’ve spent the last two days trying to duplicate how the Notes app on 10.11 animates the sidebar toolbar item nicely when collapsing/uncollapsing the split view. Finally I got mad and class-dumped the app and then AppKit. Of course it had to be using private api. Sigh. So my question is how can I duplicate the functionality without using -setTrackedSplitView: on NSToolbarFlexibleSpaceItem?

The biggest obstacle seems to be animating whatever spacing needs to be animated at the same time as the split view collapse/uncollapse animation. I assume that the split view animation is done via constraints. It also seems like you can’t use or change constraints for NSToolbarItems (I tried messing with a width constraint and nothing happened). 
I also tried to set min and max size for my own space item and then do spaceItem.view.animator.frame = newFrame to get the space to animate from collapsed to uncollapsed. That also didn’t work. Is there any public way at all to animate a toolbar item’s size?

So I guess I’m looking for tips that’ll help me achieve the same thing as I’d get by using private api (since our new app will be destined for the Mac App Store).

Steps to Reproduce:
There aren't any steps to reproduce since I'm just asking for the general way Notes.app is handling the animation. But here's some steps to follow to show what I'm interested in:
1. Open Notes.app on Mac
2. In the toolbar the leftmost button will show/hide sidebar.
3. Click it.
4. Notice how the space left of the item is growing/shrinking along with the splitview collapse/uncollapse animation.
5. Ponder how that could possibly be done without private api.
6. Then open AppKit source code and search for setTrackedSplitView:
7. all the magic is private api. Makes me sad.
8. Please help. :-)

Expected Results:
n/a

Actual Results:
n/a

Version:
Xcode Version 7.2 (7C68)

Notes:
DTS Follow-up: 635213253


Configuration:
10.11.3 (15D21)/MacBook Pro Retina 2012


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!