From 6931d5e33ecddd779cce1d1b6aa70290be33c087 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Tue, 29 Oct 2019 14:20:05 -0700 Subject: [PATCH] Fixed usage of optional types in swift. (#43461) --- .../ios_host_app_swift/Host/ViewController.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dev/integration_tests/ios_host_app_swift/Host/ViewController.swift b/dev/integration_tests/ios_host_app_swift/Host/ViewController.swift index faabbf1bd7..0ad75fa0f1 100644 --- a/dev/integration_tests/ios_host_app_swift/Host/ViewController.swift +++ b/dev/integration_tests/ios_host_app_swift/Host/ViewController.swift @@ -4,7 +4,7 @@ import FlutterPluginRegistrant class ViewController: UIViewController { var flutterEngine : FlutterEngine?; - + // Boiler-plate add-to-app demo. Not integration tested anywhere. override func viewDidLoad() { super.viewDidLoad() @@ -18,10 +18,11 @@ class ViewController: UIViewController { } @objc func handleButtonAction() { - let flutterEngine = self.flutterEngine; - GeneratedPluginRegistrant.register(with: flutterEngine); + if let flutterEngine = flutterEngine as? FlutterEngine { + GeneratedPluginRegistrant.register(with: flutterEngine); - let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)!; - self.present(flutterViewController, animated: false, completion: nil) + let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil); + self.present(flutterViewController, animated: false, completion: nil) + } } }