-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
ContentView.swift
53 lines (44 loc) · 1.47 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// ContentView.swift
// Example
//
// Created by Philip Niedertscheider on 23.06.20.
// Copyright © 2020 techprimate GmbH & Co. KG. All rights reserved.
//
import SwiftUI
import Combine
import TPPDF
class ContentViewModel: ObservableObject {
@Published var url: URL?
@State var selectedFactory = Examples.defaultFactory
}
struct ContentView: View {
@ObservedObject var viewModel = ContentViewModel()
var body: some View {
NavigationView {
List {
ForEach(Examples.factories, id: \.header) { section in
Section(header: Text(section.header)) {
ForEach(section.examples, id: \.name) { example in
NavigationLink(example.name, destination: DetailView(example: example))
}
}
}
}
.frame(minWidth: 100, idealWidth: 200, maxWidth: 300,
minHeight: 0, maxHeight: .infinity,
alignment: .topLeading)
.listStyle(SidebarListStyle())
DetailView(example: viewModel.selectedFactory)
.frame(minWidth: 0, maxWidth: .infinity,
minHeight: 0, maxHeight: .infinity,
alignment: .topLeading)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}