Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/pigeon/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ Register the handler with the generated method.
<?code-excerpt "ios/Runner/AppDelegate.swift (swift-init-event)"?>
```swift
let eventListener = EventListener()
StreamEventsStreamHandler.register(
with: controller.binaryMessenger, streamHandler: eventListener)
StreamEventsStreamHandler.register(with: binaryMessenger, streamHandler: eventListener)
```

### Kotlin
Expand Down
25 changes: 5 additions & 20 deletions packages/pigeon/example/app/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,16 @@ func sendEvents(_ eventListener: EventListener) {
}

@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

// TODO(stuartmorgan): Once 3.33+ reaches stable, remove this subclass and move the setup to
// AppDelegate.register(...). This approach is only used because this example needs to support
// both stable and master, and 3.32 doesn't have FlutterPluginRegistrant, while 3.33+ can't use
// the older application(didFinishLaunchingWithOptions) approach.
@objc class ExampleViewController: FlutterViewController {
override func awakeFromNib() {
super.awakeFromNib()
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)

let api = PigeonApiImplementation()
let binaryMessenger = engineBridge.applicationRegistrar.messenger()
ExampleHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: api)
let controller = self
// #docregion swift-init-event
let eventListener = EventListener()
StreamEventsStreamHandler.register(
with: controller.binaryMessenger, streamHandler: eventListener)
StreamEventsStreamHandler.register(with: binaryMessenger, streamHandler: eventListener)
// #enddocregion swift-init-event
sendEvents(eventListener)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Example View Controller-->
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ExampleViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
Expand Down
Loading