I do still see navigationContoller is nil. AnyIdea?
@objc fileprivate func handleChangeStartLocation() {
let vc = UIViewController()
vc.view.backgroundColor = .yellow
let button = UIButton(title: "BACK", titleColor: .black, font: .boldSystemFont(ofSize: 14), backgroundColor: .clear, target: self, action: #selector(handleBack))
vc.view.addSubview(button)
button.fillSuperview()
print(navigationController)
navigationController?.pushViewController(vc, animated: true)
}
truct DirectionsPreview: PreviewProvider {
static var previews: some View {
ContainerView().edgesIgnoringSafeArea(.all)
// .environment(\.colorScheme, .light)
}
struct ContainerView: UIViewControllerRepresentable {
func makeUIViewController(context: UIViewControllerRepresentableContext<DirectionsPreview.ContainerView>) -> UIViewController {
return UINavigationController(rootViewController: DirectionsController())
}
func updateUIViewController(_ uiViewController: DirectionsPreview.ContainerView.UIViewControllerType, context: UIViewControllerRepresentableContext<DirectionsPreview.ContainerView>) {
}
}
}