gh-XcodesOrg-XcodesApp/Xcodes/Frontend/Common/NavigationSplitViewWrapper.swift
khcrysalis d1b77b94aa chore: add max sidebar width
having it expandable to infinity is a bit of an issue if you somehow accidentally expand it full width of the window, though this issue does not happen when you have an Xcode version selected.
2024-11-09 23:12:08 -08:00

35 lines
825 B
Swift

//
// NavigationSplitViewWrapper.swift
// Xcodes
//
// Created by Matt Kiazyk on 2023-12-12.
//
import SwiftUI
struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, Detail: View {
private var sidebar: Sidebar
private var detail: Detail
init(
@ViewBuilder sidebar: () -> Sidebar,
@ViewBuilder detail: () -> Detail
) {
self.sidebar = sidebar()
self.detail = detail()
}
var body: some View {
NavigationSplitView {
if #available(macOS 14, *) {
sidebar
.navigationSplitViewColumnWidth(min: 290, ideal: 290, max: 700)
} else {
sidebar
}
} detail: {
detail
}
.navigationSplitViewStyle(.balanced)
}
}