Skip to content

Commit 198eab9

Browse files
Temp workaround for channel registration in Pigeon example
1 parent 971516c commit 198eab9

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

packages/pigeon/example/app/ios/Runner/AppDelegate.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,26 @@ func sendEvents(_ eventListener: EventListener) {
100100
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
101101
) -> Bool {
102102
GeneratedPluginRegistrant.register(with: self)
103+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
104+
}
105+
}
106+
107+
// TODO(stuartmorgan): Once 3.33+ reaches stable, remove this subclass and move the setup to
108+
// AppDelegate.register(...). This approach is only used because this example needs to support
109+
// both stable and master, and 3.32 doesn't have FlutterPluginRegistrant, while 3.33+ can't use
110+
// the older application(didFinishLaunchingWithOptions) approach.
111+
@objc class ExampleViewController: FlutterViewController {
112+
override func awakeFromNib() {
113+
super.awakeFromNib()
103114

104-
let controller = window?.rootViewController as! FlutterViewController
105115
let api = PigeonApiImplementation()
106-
ExampleHostApiSetup.setUp(binaryMessenger: controller.binaryMessenger, api: api)
116+
ExampleHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: api)
117+
let controller = self
107118
// #docregion swift-init-event
108119
let eventListener = EventListener()
109120
StreamEventsStreamHandler.register(
110121
with: controller.binaryMessenger, streamHandler: eventListener)
111122
// #enddocregion swift-init-event
112123
sendEvents(eventListener)
113-
114-
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
115-
116124
}
117125
}

packages/pigeon/example/app/ios/Runner/Base.lproj/Main.storyboard

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina6_12" orientation="portrait" appearance="light"/>
34
<dependencies>
45
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
68
</dependencies>
79
<scenes>
8-
<!--Flutter View Controller-->
10+
<!--Example View Controller-->
911
<scene sceneID="tne-QT-ifu">
1012
<objects>
11-
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
13+
<viewController id="BYZ-38-t0r" customClass="ExampleViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
1214
<layoutGuides>
1315
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
1416
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
1517
</layoutGuides>
1618
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
17-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
19+
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
1820
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
21+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2022
</view>
2123
</viewController>
2224
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>

0 commit comments

Comments
 (0)