@@ -13,15 +13,15 @@ import Promises
1313import SwiftUI
1414import UIKit
1515
16- class WebDAVAuthenticationViewController : UIHostingController < WebDAVAuthentication > {
16+ class WebDAVAuthenticationViewController : UIViewController {
1717 weak var coordinator : ( Coordinator & WebDAVAuthenticating ) ?
18- private var viewModel : WebDAVAuthenticationViewModel
18+ private let viewModel : WebDAVAuthenticationViewModel
1919 private var cancellables = Set < AnyCancellable > ( )
2020 private var hud : ProgressHUD ?
2121
2222 init ( viewModel: WebDAVAuthenticationViewModel ) {
2323 self . viewModel = viewModel
24- super. init ( rootView : WebDAVAuthentication ( viewModel : viewModel ) )
24+ super. init ( nibName : nil , bundle : nil )
2525 }
2626
2727 @available ( * , unavailable)
@@ -31,6 +31,8 @@ class WebDAVAuthenticationViewController: UIHostingController<WebDAVAuthenticati
3131
3232 override func viewDidLoad( ) {
3333 super. viewDidLoad ( )
34+ setupSwiftUIView ( )
35+
3436 title = " WebDAV "
3537 let cancelButton = UIBarButtonItem ( barButtonSystemItem: . cancel, target: self , action: #selector( cancel) )
3638 navigationItem. leftBarButtonItem = cancelButton
@@ -87,6 +89,15 @@ class WebDAVAuthenticationViewController: UIHostingController<WebDAVAuthenticati
8789 @objc func cancel( ) {
8890 coordinator? . cancel ( )
8991 }
92+
93+ private func setupSwiftUIView( ) {
94+ let child = UIHostingController ( rootView: WebDAVAuthentication ( viewModel: viewModel) )
95+ addChild ( child)
96+ view. addSubview ( child. view)
97+ child. didMove ( toParent: self )
98+ child. view. translatesAutoresizingMaskIntoConstraints = false
99+ NSLayoutConstraint . activate ( child. view. constraints ( equalTo: view) )
100+ }
90101}
91102
92103#if DEBUG
0 commit comments