var firstNavigationController = UINavigationController(rootViewController: self.mainViewController )
window?.rootViewController = firstNavigationController
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.view.backgroundColor = UIColor(white: 0, alpha: 0.5)
self.modalTransitionStyle = .crossDissolve
self.modalPresentationStyle = .overCurrentContext
}
class AppDelegate: UIResponder, UIApplicationDelegate {
var window :UIWindow?
var naviController :UINavigationController?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
naviController = window?.rootViewController as? UINavigationController ;
showSplash()
}
func showSplash(){
let vc = UIViewController.instantiateViewController(storyboard: "Sotryboard", viewController: "\(InitViewController.self)" )
window?.rootViewController = vc;
}
}
class InitViewController: UIViewController{
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
checkInit()
}
func checkInit(){
Async.serial(tasks: [
{ done in
task1 {
done(nil)
}
}
,
{ done in
task2 {
done(nil)
}
}
,
{ done in
//chage rootViewController.
UIApplication.appDelegate?.window?.rootViewController = UIApplication.appDelegate?.naviController
self.dismiss(animated: true, completion: {
done(nil)
})
}
}
}
if let vc = UIApplication.rootViewController?.presentedViewController {
vc.dismiss(animated: false) {
UIApplication.rootViewController?.present( myPopupVc, animated: true, completion: nil )
}
} else {
UIApplication.rootViewController?.present( myPopupVc, animated: true, completion: nil)
}
.rootViewController?.present( myPopupViewController, animated: true, completion: nil )
self.present( myPopupViewController, animated: true, completion: nil )
//self : SomeViewController