forked from mazzzystar/Queryable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentView.swift
More file actions
89 lines (79 loc) · 3.16 KB
/
ContentView.swift
File metadata and controls
89 lines (79 loc) · 3.16 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// ContentView.swift
// Queryable
//
// Created by Ke Fang on 2022/12/14.
//
import SwiftUI
struct ContentView: View {
@State private var goToIndexView = false
@ObservedObject var photoSearcher = PhotoSearcher()
var body: some View {
NavigationStack {
ZStack {
switch UIDevice.current.userInterfaceIdiom {
case .phone, .pad:
VStack {
Form {
SearchBarView(photoSearcher: photoSearcher)
}
SearchResultsView(goToIndexView: $goToIndexView, photoSearcher: photoSearcher)
Spacer()
}
case .mac, .unspecified, .tv, .carPlay:
VStack {
HStack {
Spacer(minLength: 300)
Form {
SearchBarView(photoSearcher: photoSearcher)
.frame(height: 45)
.font(.title2)
}
Spacer(minLength: 300)
}
HStack {
Spacer(minLength: 200)
SearchResultsViewForMac(goToIndexView: $goToIndexView, photoSearcher: photoSearcher)
.font(.title2)
Spacer(minLength: 200)
}
Spacer()
}
@unknown default:
VStack {
Form {
SearchBarView(photoSearcher: photoSearcher)
}
SearchResultsView(goToIndexView: $goToIndexView, photoSearcher: photoSearcher)
Spacer()
}
}
}
.navigationBarTitleDisplayMode(.large)
.toolbar() {
ToolbarItemGroup {
NavigationLink(destination: ConfigView().environmentObject(photoSearcher)) {
Label("Config", systemImage: "gearshape")
.labelStyle(.iconOnly)
.font(.title3)
.accessibilityLabel(Text("Config Button"))
.accessibilityHint(Text("About Queryable, privacy concerns and feedback concat"))
}
}
}
.navigationTitle("Queryable")
.accessibilityAddTraits(.isHeader)
.navigationDestination(isPresented: $goToIndexView) {
BuildIndexView(photoSearcher: photoSearcher)
}
.ignoresSafeArea(.keyboard)
}
.accentColor(.weakgreen)
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(photoSearcher: PhotoSearcher())
}
}