mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Add plugin and host registration to multiple_flutters example (#942)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import Flutter
|
||||
import FlutterPluginRegistrant
|
||||
import Foundation
|
||||
|
||||
/// A FlutterViewController intended for the MyApp widget in the Flutter module.
|
||||
@@ -16,6 +17,7 @@ class SingleFlutterViewController: FlutterViewController, DataModelObserver {
|
||||
init(withEntrypoint entryPoint: String?) {
|
||||
let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||
let newEngine = appDelegate.engines.makeEngine(withEntrypoint: entryPoint, libraryURI: nil)
|
||||
GeneratedPluginRegistrant.register(with: newEngine)
|
||||
super.init(engine: newEngine, nibName: nil, bundle: nil)
|
||||
DataModel.shared.addObserver(observer: self)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user