-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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: