metatext-app-ios-iphone-ipad/Views/SwiftUI/View Controller Representables/MainNavigationView.swift

31 lines
855 B
Swift
Raw Normal View History

2021-01-21 00:33:53 +01:00
// Copyright © 2021 Metabolist. All rights reserved.
import SwiftUI
import ViewModels
struct MainNavigationView: UIViewControllerRepresentable {
let viewModelClosure: () -> NavigationViewModel
@EnvironmentObject var rootViewModel: RootViewModel
func makeUIViewController(context: Context) -> MainNavigationViewController {
MainNavigationViewController(
viewModel: viewModelClosure(),
rootViewModel: rootViewModel)
}
func updateUIViewController(_ uiViewController: MainNavigationViewController, context: Context) {
}
}
#if DEBUG
import PreviewViewModels
struct MainNavigationView_Previews: PreviewProvider {
static var previews: some View {
2021-01-26 01:06:35 +01:00
MainNavigationView { NavigationViewModel(identityContext: .preview) }
2021-01-21 00:33:53 +01:00
.environmentObject(RootViewModel.preview)
}
}
#endif