this post was submitted on 05 Aug 2025
2 points (100.0% liked)

Swift

433 readers
3 users here now

This group focus on the content related to the development of Apple Eco-system software. So feel free to share and talk about, for example;

founded 2 years ago
MODERATORS
 

I'm using Xcode 16.4 (16F6) and whatever version of SwiftUI that comes with it (as an aside, where can I look up the Swift/SwiftUI versions for my version of Xcode?). I want to create an interface that uses a static (always visible) sidebar with buttons, and a collapsable detail view similar to what's in Postman where there is a toolbar that spans the sidebar and detail views when the detail view is visible, but turns into a button when collapsed.

I've found NavigationSplitView, and in combination with a HStack+VStack for the static sidebar, it gets me 95% of the way to what I am looking to do. I am just not sure how can I make the toolbar that spans between the sidebar and the split view having the toolbar where Postman has the "My Workspace" and New/Import buttons.

Here is the code I've got so far:

HStack(alignment: .top, spacing: -2) {
    VStack(alignment: .leading, spacing: 2) {
        Button {
        } label: {
            VStack {
                Image(systemName: "folder")
                    .font(.title2)
                    .padding(3)
                Text("Collections")
            }
            .frame(maxWidth: .infinity, maxHeight: 60)
        }
        .buttonStyle(.plain)
        .cornerRadius(4)

        Button {
        } label: {
            VStack {
                Image(systemName: "folder")
                    .font(.title2)
                    .padding(3)
                Text("History")
            }
            .frame(maxWidth: .infinity, maxHeight: 60)
        }
        .buttonStyle(.plain)
        .cornerRadius(4)
    }
    .font(.caption)
    .padding(3)
    .frame(maxWidth: 80)

    NavigationSplitView {
        ContentUnavailableView {
            Text("Hello, World")
                .font(.body)
        }
    } detail: {
        ContentUnavailableView {
        } description: {
            Text("Select an action on the left to begin.")
        }
    }
}

I don't know what I don't know, so if NavigationSplitView is not the way, I'm open to using different mechanisms.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here