yattee/Shared/ContentView.swift

35 lines
885 B
Swift
Raw Normal View History

2021-06-09 20:51:23 +00:00
import SwiftUI
struct ContentView: View {
2021-07-11 20:52:49 +00:00
@StateObject private var navigationState = NavigationState()
2021-07-29 22:34:13 +00:00
@StateObject private var searchState = SearchState()
2021-07-07 22:39:18 +00:00
2021-07-11 20:52:49 +00:00
#if os(iOS)
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
#endif
2021-06-11 21:11:59 +00:00
2021-06-09 20:51:23 +00:00
var body: some View {
2021-07-11 20:52:49 +00:00
Section {
#if os(iOS)
if horizontalSizeClass == .compact {
AppTabNavigation()
} else {
AppSidebarNavigation()
2021-06-11 21:11:59 +00:00
}
2021-07-11 20:52:49 +00:00
#elseif os(macOS)
AppSidebarNavigation()
#elseif os(tvOS)
TVNavigationView()
#endif
2021-07-29 22:34:13 +00:00
}
.environmentObject(navigationState)
.environmentObject(searchState)
2021-07-07 22:39:18 +00:00
}
2021-06-09 20:51:23 +00:00
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}