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

@@ -0,0 +1,37 @@
//
// CompactNavigationView.swift
// Multiplatform iOS
//
// Created by Stuart Breckenridge on 29/6/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
struct CompactSidebarContainerView: View {
@EnvironmentObject private var sceneModel: SceneModel
@StateObject private var sidebarModel = SidebarModel()
var body: some View {
SidebarView()
.environmentObject(sidebarModel)
.navigationBarTitle(Text("Feeds"))
.listStyle(PlainListStyle())
.onAppear {
sceneModel.sidebarModel = sidebarModel
sidebarModel.delegate = sceneModel
sidebarModel.rebuildSidebarItems()
}
}
}
struct CompactSidebarContainerView_Previews: PreviewProvider {
static var previews: some View {
CompactSidebarContainerView()
.environmentObject(SceneModel())
}
}