tokenary/Tokenary iOS/Extensions/UIApplication.swift

14 lines
502 B
Swift
Raw Normal View History

2021-12-07 20:35:14 +03:00
// Copyright © 2021 Tokenary. All rights reserved.
import UIKit
extension UIApplication {
func replaceRootViewController(with viewController: UIViewController) {
guard let window = (connectedScenes.first?.delegate as? SceneDelegate)?.window else { return }
(connectedScenes.first?.delegate as? SceneDelegate)?.window?.rootViewController = viewController
UIView.transition(with: window, duration: 0.15, options: .transitionCrossDissolve, animations: {})
}
}