Refactor the SidebarView list into its own View so to reduce code duplication

This commit is contained in:
Maurice Parker
2020-06-29 13:14:03 -05:00
parent ba5e9cfaec
commit 0886cffcff
6 changed files with 109 additions and 96 deletions

View File

@@ -14,25 +14,17 @@ struct SceneNavigationView: View {
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
#endif
@ViewBuilder var sidebar: some View {
#if os(iOS)
if horizontalSizeClass == .compact {
CompactNavigationView()
} else {
SidebarView()
}
#else
SidebarView()
#endif
}
var body: some View {
NavigationView {
#if os(macOS)
sidebar
RegularSidebarContainerView()
.frame(minWidth: 100, idealWidth: 150, maxWidth: 200, maxHeight: .infinity)
#else
sidebar
if horizontalSizeClass == .compact {
CompactSidebarContainerView()
} else {
RegularSidebarContainerView()
}
#endif
#if os(iOS)