metatext/Views/RootView.swift
Justin Mazzocchi 182ecb5b91
Refactoring
2020-09-09 15:48:56 -07:00

32 lines
850 B
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 {
AddIdentityView(viewModel: viewModel.addIdentityViewModel())
.environmentObject(viewModel)
.transition(.opacity)
}
}
}
#if DEBUG
import Combine
import PreviewViewModels
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
RootView(viewModel: .preview)
}
}
#endif