mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-18 19:56:27 +00:00
37 lines
1 KiB
Swift
37 lines
1 KiB
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import SwiftUI
|
|
import ViewModels
|
|
|
|
struct RootView: View {
|
|
@StateObject var viewModel: RootViewModel
|
|
|
|
var body: some View {
|
|
if let navigationViewModel = viewModel.navigationViewModel {
|
|
TabNavigationView(viewModel: navigationViewModel)
|
|
.id(navigationViewModel.identification.identity.id)
|
|
.environmentObject(viewModel)
|
|
.transition(.opacity)
|
|
} else {
|
|
NavigationView {
|
|
AddIdentityView(viewModel: viewModel.addIdentityViewModel())
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.navigationBarHidden(true)
|
|
}
|
|
.environmentObject(viewModel)
|
|
.navigationViewStyle(StackNavigationViewStyle())
|
|
.transition(.opacity)
|
|
}
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
import Combine
|
|
import PreviewViewModels
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
RootView(viewModel: .preview)
|
|
}
|
|
}
|
|
#endif
|