I have a Storyboard lifecycle application which has a UIViewController as window root view controller.
When I am trying to add the UIHostingController(SwiftUI view wrapped inside) to this root view controller as child view controller, the buttons and text fields in swiftUI view do not respond.
But when I am adding this UIHostingController as window root view controller or Navigation view controller's top view controller, then the swiftUI views respond in this case.
Please help me if I am missing anything
Below is the code that is used for adding the UIHostingController as child view controller which doesn't work
This is the code that works (in delegate)
OR this code
When I am trying to add the UIHostingController(SwiftUI view wrapped inside) to this root view controller as child view controller, the buttons and text fields in swiftUI view do not respond.
But when I am adding this UIHostingController as window root view controller or Navigation view controller's top view controller, then the swiftUI views respond in this case.
Please help me if I am missing anything
Below is the code that is used for adding the UIHostingController as child view controller which doesn't work
Code Block objective-c [self addChildViewController:hostingController]; [self.view addSubview:hostingController.view]; [hostingController didMoveToParentViewController:self];
This is the code that works (in delegate)
Code Block objective-c [window setRootViewController:hostingController];
OR this code
Code Block objective-c UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:hostingController]; [window setRootViewController:navController];