Post

Replies

Boosts

Views

Activity

SwiftUI TextField inside UIViewController
Hello everyone, I'm trying to integrate a SwiftUI TextField component into a UIViewController. But any kind of tutorial I've seen, have this implementation: let childView = UIHostingController(rootView: SwiftUIView()) addChild(childView) childView.view.frame = frame view.addSubview(childView.view) childView.didMove(toParent: self) But, when I do this, my Navigation Bar disappear. But when I remove the "addChild" peace of code, everything works well. Is this a wrong thing to do? Can I remove this part of code?
3
0
1.2k
May ’21
UIHostingController is loading before didFinishLaunchingWithOptions
Hello everybody, I've been implementing new SwiftUI screens in my project integrated with my storyboard. I have one main storyboard with an UITabBarController and some others UIViewControllers as Root ViewControllers. Now, I'm creating a new view, with SwiftUI and HostingViewController, but I realised this view is called before the didFinishLaunchingWithOptions from AppDelegate. I initialise my SwiftUI View in required init inside the HostingViewController like some tutorials, but how can I create this screen without this problem? I tried initialise this view outside of init, but I've received other errors.
1
0
844
Sep ’20