2020-06-28 21:21:43 +02:00
|
|
|
//
|
|
|
|
// SidebarView.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 6/28/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct SidebarView: View {
|
2020-06-29 00:43:20 +02:00
|
|
|
|
|
|
|
@EnvironmentObject private var sceneModel: SceneModel
|
|
|
|
@StateObject private var sidebarModel = SidebarModel()
|
|
|
|
|
2020-06-28 21:21:43 +02:00
|
|
|
var body: some View {
|
2020-06-29 13:16:48 +02:00
|
|
|
List {
|
|
|
|
ForEach(sidebarModel.sidebarItems) { section in
|
2020-06-29 13:31:50 +02:00
|
|
|
OutlineGroup(sidebarModel.sidebarItems, children: \.children) { sidebarItem in
|
|
|
|
Text(sidebarItem.nameForDisplay)
|
2020-06-29 13:16:48 +02:00
|
|
|
}
|
2020-06-29 00:43:20 +02:00
|
|
|
}
|
2020-06-29 13:16:48 +02:00
|
|
|
}
|
|
|
|
.navigationTitle(Text("Feeds"))
|
2020-06-29 13:31:50 +02:00
|
|
|
.listStyle(SidebarListStyle())
|
2020-06-29 13:16:48 +02:00
|
|
|
.onAppear {
|
|
|
|
sceneModel.sidebarModel = sidebarModel
|
|
|
|
sidebarModel.delegate = sceneModel
|
|
|
|
sidebarModel.rebuildSidebarItems()
|
|
|
|
}
|
2020-06-29 00:43:20 +02:00
|
|
|
|
|
|
|
}
|
2020-06-28 21:21:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct SidebarView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
SidebarView()
|
2020-06-29 04:17:00 +02:00
|
|
|
.environmentObject(SceneModel())
|
2020-06-28 21:21:43 +02:00
|
|
|
}
|
|
|
|
}
|