For a new SwiftUI
iOS app, I do the following in the SceneDelegate
if let windowScene = scene as? UIWindowScene {
let window =
For some animation while changing the rootview use the below code in sceneDelegate:
window.rootViewController = UIHostingController(rootView: HomeView())
// A mask of options indicating how you want to perform the animations.
let options: UIView.AnimationOptions = .transitionCrossDissolve
// The duration of the transition animation, measured in seconds.
let duration: TimeInterval = 0.3
// Creates a transition animation.
UIView.transition(with: window, duration: duration, options: options, animations: {}, completion:
{ completed in
// maybe do something on completion here
})