metatext/Views/RootView.swift

33 lines
850 B
Swift
Raw Normal View History

2020-08-03 15:20:51 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import SwiftUI
2020-09-01 07:33:49 +00:00
import ViewModels
2020-08-03 15:20:51 +00:00
struct RootView: View {
@StateObject var viewModel: RootViewModel
var body: some View {
2020-09-09 22:48:56 +00:00
if let navigationViewModel = viewModel.navigationViewModel {
TabNavigationView(viewModel: navigationViewModel)
.id(navigationViewModel.identification.identity.id)
2020-08-07 01:41:59 +00:00
.environmentObject(viewModel)
.transition(.opacity)
} else {
AddIdentityView(viewModel: viewModel.addIdentityViewModel())
.environmentObject(viewModel)
.transition(.opacity)
2020-08-03 15:20:51 +00:00
}
}
}
#if DEBUG
2020-09-08 02:12:38 +00:00
import Combine
2020-09-01 07:33:49 +00:00
import PreviewViewModels
2020-08-03 15:20:51 +00:00
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
2020-09-08 02:12:38 +00:00
RootView(viewModel: .preview)
2020-08-03 15:20:51 +00:00
}
}
#endif