Created
December 8, 2020 12:15
-
-
Save AbedElazizShe/0f49ad594b357c994c9894143e397250 to your computer and use it in GitHub Desktop.
Splash View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Lottie | |
public class SplashViewController: UIViewController { | |
private var animationView: AnimationView? | |
public override func viewDidAppear(_ animated: Bool) { | |
animationView = .init(name: "splash_screen") | |
animationView!.frame = view.bounds | |
animationView!.contentMode = .scaleAspectFit | |
animationView!.loopMode = .playOnce | |
animationView!.animationSpeed = 1.00 | |
view.addSubview(animationView!) | |
animationView!.play{ (finished) in | |
self.startFlutterApp() | |
} | |
} | |
func startFlutterApp() { | |
let appDelegate = UIApplication.shared.delegate as! AppDelegate | |
let flutterEngine = appDelegate.flutterEngine | |
let flutterViewController = | |
FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil) | |
flutterViewController.modalPresentationStyle = .custom | |
flutterViewController.modalTransitionStyle = .crossDissolve | |
present(flutterViewController, animated: true, completion: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment