metatext-app-ios-iphone-ipad/Views/RootView.swift

32 lines
803 B
Swift
Raw Normal View History

2020-08-03 17:20:51 +02:00
// Copyright © 2020 Metabolist. All rights reserved.
import SwiftUI
2020-09-01 09:33:49 +02:00
import ViewModels
2020-08-03 17:20:51 +02:00
struct RootView: View {
@StateObject var viewModel: RootViewModel
var body: some View {
2020-08-27 06:25:28 +02:00
if let tabNavigationViewModel = viewModel.tabNavigationViewModel {
TabNavigationView(viewModel: tabNavigationViewModel)
2020-08-09 07:37:04 +02:00
.id(UUID())
2020-08-07 03:41:59 +02:00
.environmentObject(viewModel)
.transition(.opacity)
} else {
AddIdentityView(viewModel: viewModel.addIdentityViewModel())
.environmentObject(viewModel)
.transition(.opacity)
2020-08-03 17:20:51 +02:00
}
}
}
#if DEBUG
2020-09-01 09:33:49 +02:00
import PreviewViewModels
2020-08-03 17:20:51 +02:00
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
2020-09-01 09:33:49 +02:00
RootView(viewModel: .mock())
2020-08-03 17:20:51 +02:00
}
}
#endif