My goal is to display UIViewController (UIKit) on SwiftUI View.
My entire application is written in SwiftUI, but I use a library whose methods only take UIViewController's as input.
I tried to convert SwiftUI View to UIViewController by UIHostingController:
billPayVC = UIHostingController(rootView: BillPayView())
But when I try to display the library's UIViewController on my UIViewController (converted from SwiftUI View):
sdk.presentPaymentView(on: billPayVC,
acquiringPaymentStageConfiguration: .init(
paymentStage: .`init`(paymentData: paymentData)
),
configuration: viewConfigration,
tinkoffPayDelegate: nil) { [weak self] response in
self?.responseReviewing(response)
}
, where sdk is instance of class inherited from NSObject, presentPaymentView is libary's method which takes as input parameter 'on' UIViewController.
When I try to do this, I get the following message:
2022-10-02 21:23:42.454017+0300 DARS[11065:147087] [Presentation] Attempt to present <TinkoffASDKUI.AcquiringPaymentViewController: 0x7f8e88091600> on <TtGC7SwiftUI19UIHostingControllerV4DARS11BillPayView: 0x7f8e88b0c380> (from <TtGC7SwiftUI19UIHostingControllerV4DARS11BillPayView: 0x7f8e88b0c380>) whose view is not in the window hierarchy.
Could you help me, how and where can I add billPayVC (converted from BillPayView()) to the window hierarchy?