Минимальная целевая версия проекта: iOS 15.0
Код: Выделить всё
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
Код: Выделить всё
extension UIViewController {
func navigateHostingView(
_ hosting: UIHostingController,
hidesBottomBarWhenPushed: Bool = true,
setNavigationBarHidden: Bool = true,
pushAnimation: Bool = true
) {
hosting.hidesBottomBarWhenPushed = hidesBottomBarWhenPushed
navigationController?.setNavigationBarHidden(setNavigationBarHidden, animated: false)
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
navigationController?.pushViewController(hosting, animated: pushAnimation)
}
}
Код: Выделить всё
func navigateToMySwiftUIView(myData: MyData, questions: [QuestionModel]) {
let hosting = UIHostingController(
rootView: MySwiftUIView(
myData: myData,
questions: questions, onDismiss: { [weak self] isThankyou in
self?.showThankyouScreen(isThankyou)
})
.environment(\.navigationController, navigationController)
)
navigateHostingView(hosting)
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... it-to-swif