1

I am trying to accessing the Storyboard View Controller in SwiftUI by using UIViewControllerRepresentable. I want to hide the UIKit Tabbar which we applied on ItineraryViewController by using the planDetailViewController.hidesBottomBarWhenPushed = true But that solution not working.

  let eventGroup : EventGroup?
  func makeUIViewController(context: Context) -> UIViewController {
    guard let planDetailViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: "ItineraryViewController") as? ItineraryViewController else {
      fatalError("ViewController not implemented in storyboard")
    }
    planDetailViewController.userActionMode = .viewOnly
    planDetailViewController.itinerary = eventGroup!.event
    planDetailViewController.shouldDisableCalendarVC = true
    planDetailViewController.hidesBottomBarWhenPushed = true
    return planDetailViewController
  }
  func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
  }
}```

1 Answers1

0

Your UIViewControllerRepresentable won't get pushed into a UINavigationController like in UIKit so hidesBottomBarWhenPushed will not be respected.

The best way to do this is using Introspect like in this answer: https://stackoverflow.com/a/64182729/3393964

Casper Zandbergen
  • 3,419
  • 2
  • 25
  • 49