UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

MacOS SwifUI - View/Window size control with 2 sidebars (Left and right sides)

Forums > macOS

I want to layout a window that works in the same way Xcode works. By this I mean it has a sidebar on both sides and a document view in the middle.

The left sidebar is the "master" and the document and right sidebar will display data based on the master item selected.

That all works, and the user can adjust the size of the two side bars.

The problem is the size of the side bars as set by the user dragging is overridden when a new master item is selected or when the window is resized by the user.

The left side bar is working as expected, the right side bar is self adjusting when the window size is changed by the user.

I have implemented it with a NavigationView on the left side bar and a second navigation view on the center document view and the left sidebar displayed in it.

And I have tried using a NavigationView around the left sidebar with HSplitview around the Document and right side view.

How do I get the window width adjustment to ONLY affect the document view, and the size of the sidebars to be adjustable by the User only, the way it works in XCode.

Here is the project on GitHub if anyone would like to look and make suggestions:

Hermes

TIA,

Frank

4      

Maybe a clearer way to state this is - I want the user to be able to adjust the width of the rightside sidebar, and I do not want a change in the window width to affect it. The only document (center view) should expand or shrink in response to changes in the window width.

ANY suggestions will be appreciated.

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.