71 lines
1.9 KiB
Swift
71 lines
1.9 KiB
Swift
import SwiftUI
|
|
|
|
struct MainViewBig: View {
|
|
var body: some View {
|
|
NavigationView {
|
|
SidebarView()
|
|
Text("Master")
|
|
Text("Detail")
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SidebarView: View {
|
|
@State var selection: String?
|
|
|
|
@FetchRequest(entity: Vehicle.entity(), sortDescriptors: []) var vehicles: FetchedResults<Vehicle>
|
|
|
|
var body: some View {
|
|
List(selection: $selection) {
|
|
Section("History") {
|
|
NavigationLink(destination: VehiclesListView()) {
|
|
Label("All", systemImage: "car.2")
|
|
.badge(vehicles.count)
|
|
}
|
|
NavigationLink(destination: VehiclesListView()) {
|
|
Label("Unreconized", systemImage: "eye.slash")
|
|
.badge(vehicles.filter(\.unrecognized).count)
|
|
}
|
|
NavigationLink(destination: VehiclesListView()) {
|
|
Label("Outdated", systemImage: "wind")
|
|
.badge(vehicles.filter(\.outdated).count)
|
|
}
|
|
}
|
|
.collapsible(false)
|
|
|
|
Section("Other") {
|
|
Label("Recordings", systemImage: "waveform.path")
|
|
Label("Search", systemImage: "magnifyingglass")
|
|
}
|
|
.collapsible(false)
|
|
}
|
|
.frame(minWidth: 180)
|
|
// .toolbar {
|
|
// ToolbarItem(placement: .primaryAction) {
|
|
// Button("xxx") {
|
|
//
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
|
|
struct VehiclesListView: View {
|
|
var body: some View {
|
|
Text("Vehicles list")
|
|
.toolbar {
|
|
ToolbarItem(placement: .primaryAction) {
|
|
Button("xxx") {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct MainViewBig_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
MainViewBig()
|
|
}
|
|
}
|