TEMP
TEMP

Reputation: 235

How to toggle sidebar container for mac application development using Swift?

I am learning Mac application development. I am using Xcode 10.3 & Swift 5. I have used 2 vertical split view controller in my application. But I would like to add the functionality of hiding the middle container or view using the button in the header.

I have started from scratch to create a new project and I have only touched my Storyboard where I have used Vertical split view controller and added few constraints.

Storyboard screenshot

I would like to use that toggle button to collapse and expand the middle split view (highlighted in yellow).

Also, Is there any icon provided by Apple for showing toggling functionality or do I need to upload one into the application?

I would appreciate the help. Thank you.

Upvotes: 2

Views: 704

Answers (1)

malhal
malhal

Reputation: 30569

Yes, Apple provide NSToolbarToggleSidebarItemIdentifier which sends toggleSidebar: to the first responder (but target can be changed if necessary during toolbarWillAddItem:) and it looks like this:

enter image description here

Upvotes: 3

Related Questions