1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-27 18:22:32 +01:00
metatext-app-ios-iphone-ipad/Views/SwiftUI/RootView.swift
Justin Mazzocchi ff8fd63e50
Organize views
2021-01-28 22:50:58 -08:00

41 lines
1.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 {
MainNavigationView { navigationViewModel }
.id(navigationViewModel.identityContext.identity.id)
.environmentObject(viewModel)
.transition(.opacity)
.edgesIgnoringSafeArea(.all)
} else {
NavigationView {
AddIdentityView(
viewModelClosure: { viewModel.addIdentityViewModel() },
displayWelcome: true)
.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