Mercurial > public > simoleon
diff Simoleon/ContentView.swift @ 179:7c4a789e51ba
add views
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Tue, 26 Oct 2021 18:18:36 +0200 |
parents | a1443bd115d9 |
children | 5a9430fd6b4d |
line wrap: on
line diff
--- a/Simoleon/ContentView.swift Tue Oct 26 18:18:25 2021 +0200 +++ b/Simoleon/ContentView.swift Tue Oct 26 18:18:36 2021 +0200 @@ -8,8 +8,43 @@ import SwiftUI struct ContentView: View { + @State private var tab: Tab = .convert + + private enum Tab { + case convert, favorites, settings + } + + @ViewBuilder var adjustedView: some View { + if UIDevice.current.userInterfaceIdiom == .pad { + NavigationView { + Sidebar() + ConversionView() + } + } else { + TabView(selection: $tab) { + ConversionView() + .tabItem { + Label("Convert", systemImage: "arrow.counterclockwise.circle") + } + .tag(Tab.convert) + + FavoritesView() + .tabItem { + Label("Favorites", systemImage: "star") + } + .tag(Tab.favorites) + + AboutView() + .tabItem { + Label("About", systemImage: "info.circle") + } + .tag(Tab.settings) + } + } + } + var body: some View { - Text("Hello world") + adjustedView } }