-
Notifications
You must be signed in to change notification settings - Fork 32
Help on implementing with SwiftUI #5
Comments
Hello there! I'm working on the SwiftUI implementation of the framework, I'll keep you in touch when it is available! Thanks for your message :) |
Any progress on this? |
Temp Fix
Configure your Then in Full code: class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
let controller = UIHostingController(rootView: contentView)
window.rootViewController = controller
self.window = window
window.makeKeyAndVisible()
}
// Make the window's root controller the presentingViewController
BMCManager.shared.presentingViewController = window?.rootViewController
}
} Then anywhere in your SwiftUI code just call |
If you're using the SwiftUI lifecycle just add this on your App's BMCManager.shared.presentingViewController = UIApplication.shared.connectedScenes.filter { $0.activationState == .foregroundActive }.map { $0 as? UIWindowScene }.compactMap { $0 }.first?.windows.filter { $0.isKeyWindow }.first?.rootViewController |
I'm fairly new to programming, but as I understand there is no
viewDidLoad
with SwiftUI. Are there any walkthroughs on getting this setup for SwiftUI? Thanks!The text was updated successfully, but these errors were encountered: