Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. @UIApplicationMain
  2. @objc class AppDelegate: FlutterAppDelegate {
  3. override func application(
  4. _ application: UIApplication,
  5. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  6. ) -> Bool {
  7.  
  8. let controller : FlutterViewController = self.window?.rootViewController as! FlutterViewController
  9. let scannerChannel = FlutterMethodChannel(name: "scanner_activity",
  10. binaryMessenger: controller.binaryMessenger)
  11. scannerChannel.setMethodCallHandler({
  12. (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
  13. switch(call.method){
  14. case "startNewActivity":
  15. let mainStoryBoard = UIStoryboard(name: "Main", bundle: nil)
  16. let flutterViewController = mainStoryBoard.instantiateViewController(withIdentifier: "FlutterViewController")as! FlutterViewController
  17. self.window?.rootViewController = flutterViewController
  18.  
  19. controller.navigationController?.pushViewController(ScannerViewController(), animated: true)
  20. break
  21. default:
  22. return
  23. }
  24. })
  25.  
  26. FirebaseApp.configure()
  27. GeneratedPluginRegistrant.register(with: self)
  28.  
  29. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement