mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Maintenance updates for platform_view_swift (#151)
This commit is contained in:
@@ -8,36 +8,36 @@ import Flutter
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate, PlatformViewControllerDelegate
|
||||
{
|
||||
var flutterResult: FlutterResult?
|
||||
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
|
||||
let channel = FlutterMethodChannel.init(name: "samples.flutter.io/platform_view_swift", binaryMessenger: controller)
|
||||
|
||||
channel.setMethodCallHandler({
|
||||
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
|
||||
if ("switchView" == call.method) {
|
||||
self.flutterResult = result
|
||||
|
||||
let platformViewController = controller.storyboard?.instantiateViewController(withIdentifier: "PlatformView") as! PlatformViewController
|
||||
platformViewController.counter = call.arguments as! Int
|
||||
platformViewController.delegate = self
|
||||
|
||||
let navigationController = UINavigationController(rootViewController: platformViewController)
|
||||
navigationController.navigationBar.topItem?.title = "Platform View"
|
||||
controller.present(navigationController, animated: true, completion: nil)
|
||||
} else {
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
});
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
func didUpdateCounter(counter: Int) {
|
||||
flutterResult?(counter)
|
||||
}
|
||||
var flutterResult: FlutterResult?
|
||||
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
|
||||
let channel = FlutterMethodChannel.init(name: "dev.flutter.sample/platform_view_swift", binaryMessenger: controller.binaryMessenger)
|
||||
|
||||
channel.setMethodCallHandler({
|
||||
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
|
||||
if ("switchView" == call.method) {
|
||||
self.flutterResult = result
|
||||
|
||||
let platformViewController = PlatformViewController(nibName: "PlatformViewController", bundle: nil)
|
||||
platformViewController.counter = call.arguments as! Int
|
||||
platformViewController.delegate = self
|
||||
|
||||
let navigationController = UINavigationController(rootViewController: platformViewController)
|
||||
navigationController.navigationBar.topItem?.title = "Platform View"
|
||||
controller.present(navigationController, animated: true, completion: nil)
|
||||
} else {
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
});
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
func didUpdateCounter(counter: Int) {
|
||||
flutterResult?(counter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,12 @@
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
23
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file
23
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file
BIN
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
5
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file
5
platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -10,13 +10,20 @@
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -24,4 +31,7 @@
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina6_1" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -18,127 +18,13 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="46" y="197"/>
|
||||
</scene>
|
||||
<!--Platform View Controller-->
|
||||
<scene sceneID="qxR-Ib-h1B">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="PlatformView" id="l7k-TM-87m" customClass="PlatformViewController" customModule="Runner" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="aNK-cG-KHz"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="KQ0-mI-uQk"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="9Pa-2h-BJY" userLabel="ParentView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="O5w-dx-5ca">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" restorationIdentifier="PVController" translatesAutoresizingMaskIntoConstraints="NO" id="PVo-OY-IKE" userLabel="Top">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="597"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Button tapped 0 times." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qaB-rs-mWp">
|
||||
<rect key="frame" x="95.5" y="288" width="185" height="21.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K7X-Ru-0N7" customClass="MDButton">
|
||||
<rect key="frame" x="94" y="325.5" width="188" height="38"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="188" id="W0o-wA-IUz"/>
|
||||
<constraint firstAttribute="height" constant="38" id="tEK-W1-2uy"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<state key="normal" title="Continue in Flutter view">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="type">
|
||||
<integer key="value" value="0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="switchToFlutterView:" destination="l7k-TM-87m" eventType="touchUpInside" id="Q9G-Ua-HnS"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="qaB-rs-mWp" firstAttribute="centerX" secondItem="PVo-OY-IKE" secondAttribute="centerX" id="3XU-jp-cMf"/>
|
||||
<constraint firstItem="qaB-rs-mWp" firstAttribute="centerY" secondItem="PVo-OY-IKE" secondAttribute="centerY" id="GEk-gm-nLl"/>
|
||||
<constraint firstItem="K7X-Ru-0N7" firstAttribute="top" secondItem="qaB-rs-mWp" secondAttribute="bottom" constant="16" id="Gwc-TH-45z"/>
|
||||
<constraint firstItem="K7X-Ru-0N7" firstAttribute="centerX" secondItem="qaB-rs-mWp" secondAttribute="centerX" id="QqH-9r-NM7"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" restorationIdentifier="Bottom" translatesAutoresizingMaskIntoConstraints="NO" id="9iX-D6-aiy" userLabel="Bottom">
|
||||
<rect key="frame" x="0.0" y="597" width="375" height="70"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CTc-Jz-yjr">
|
||||
<rect key="frame" x="20" y="14" width="47" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6yL-sX-bUL" customClass="MDButton">
|
||||
<rect key="frame" x="300" y="-5" width="55" height="55"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="55" id="h4F-29-Y6n"/>
|
||||
<constraint firstAttribute="height" constant="55" id="q45-t3-9DA"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="type">
|
||||
<integer key="value" value="2"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="imageNormal" value="ic_add.png"/>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="rippleColor">
|
||||
<color key="value" red="0.82337594749999998" green="0.83186435940000003" blue="0.83186435940000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="handleIncrement:" destination="l7k-TM-87m" eventType="touchUpInside" id="n9c-Ap-rPx"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="6yL-sX-bUL" secondAttribute="bottom" constant="20" symbolic="YES" id="RqS-NP-k0w"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6yL-sX-bUL" secondAttribute="trailing" constant="20" symbolic="YES" id="gvv-UZ-pAw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="CTc-Jz-yjr" secondAttribute="bottom" constant="20" symbolic="YES" id="p6W-U8-gLe"/>
|
||||
<constraint firstAttribute="height" constant="70" id="v60-11-5Pg"/>
|
||||
<constraint firstItem="CTc-Jz-yjr" firstAttribute="leading" secondItem="9iX-D6-aiy" secondAttribute="leading" constant="20" symbolic="YES" id="vmT-3b-AxF"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="O5w-dx-5ca" firstAttribute="top" secondItem="9Pa-2h-BJY" secondAttribute="top" id="D5u-Ck-lxI"/>
|
||||
<constraint firstItem="O5w-dx-5ca" firstAttribute="leading" secondItem="9Pa-2h-BJY" secondAttribute="leading" id="Djg-Hg-SBg"/>
|
||||
<constraint firstAttribute="trailing" secondItem="O5w-dx-5ca" secondAttribute="trailing" id="RDC-2b-jUw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="O5w-dx-5ca" secondAttribute="bottom" id="YEU-9J-aTb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="incrementLabel" destination="qaB-rs-mWp" id="bFY-of-WoI"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="7qW-nP-WZA" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="805.60000000000002" y="197.45127436281859"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="ic_add.png" width="24" height="24"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -15,11 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
|
||||
@@ -6,32 +6,32 @@ import UIKit
|
||||
import Foundation
|
||||
|
||||
protocol PlatformViewControllerDelegate {
|
||||
func didUpdateCounter(counter: Int)
|
||||
func didUpdateCounter(counter: Int)
|
||||
}
|
||||
|
||||
class PlatformViewController : UIViewController {
|
||||
var delegate: PlatformViewControllerDelegate? = nil
|
||||
var counter: Int = 0
|
||||
|
||||
@IBOutlet weak var incrementLabel: UILabel!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
setIncrementLabelText()
|
||||
}
|
||||
|
||||
func handleIncrement(_ sender: Any) {
|
||||
self.counter += 1
|
||||
self.setIncrementLabelText()
|
||||
}
|
||||
|
||||
func switchToFlutterView(_ sender: Any) {
|
||||
self.delegate?.didUpdateCounter(counter: self.counter)
|
||||
dismiss(animated:false, completion:nil)
|
||||
}
|
||||
|
||||
func setIncrementLabelText() {
|
||||
let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times")
|
||||
self.incrementLabel.text = text;
|
||||
}
|
||||
var delegate: PlatformViewControllerDelegate? = nil
|
||||
var counter: Int = 0
|
||||
|
||||
@IBOutlet weak var incrementLabel: UILabel!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
setIncrementLabelText()
|
||||
}
|
||||
|
||||
@IBAction func handleIncrement(_ sender: Any) {
|
||||
self.counter += 1
|
||||
self.setIncrementLabelText()
|
||||
}
|
||||
|
||||
@IBAction func switchToFlutterView(_ sender: Any) {
|
||||
self.delegate?.didUpdateCounter(counter: self.counter)
|
||||
dismiss(animated:false, completion:nil)
|
||||
}
|
||||
|
||||
func setIncrementLabelText() {
|
||||
let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times")
|
||||
self.incrementLabel.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
66
platform_view_swift/ios/Runner/PlatformViewController.xib
Normal file
66
platform_view_swift/ios/Runner/PlatformViewController.xib
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PlatformViewController" customModule="Runner" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="incrementLabel" destination="Fwz-pb-Vxw" id="LtN-bK-cIm"/>
|
||||
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Button tapped 0 times." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fwz-pb-Vxw">
|
||||
<rect key="frame" x="114.5" y="379.5" width="185" height="21.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0Q4-1m-vDk">
|
||||
<rect key="frame" x="144" y="433" width="126" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="Increment counter"/>
|
||||
<connections>
|
||||
<action selector="handleIncrement:" destination="-1" eventType="touchUpInside" id="6jY-7M-lj4"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Vb-F2-qFl">
|
||||
<rect key="frame" x="125" y="495" width="164" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="Continue in Flutter View"/>
|
||||
<connections>
|
||||
<action selector="switchToFlutterView:" destination="-1" eventType="touchUpInside" id="tzA-cQ-gl6"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QgT-DT-gSd">
|
||||
<rect key="frame" x="16" y="828" width="47" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="1Vb-F2-qFl" firstAttribute="top" secondItem="0Q4-1m-vDk" secondAttribute="bottom" constant="32" id="2Fr-G0-fL1"/>
|
||||
<constraint firstItem="0Q4-1m-vDk" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="6R3-W6-Dle"/>
|
||||
<constraint firstItem="1Vb-F2-qFl" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="8sv-fF-vKQ"/>
|
||||
<constraint firstItem="QgT-DT-gSd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="16" id="8yF-bR-Te3"/>
|
||||
<constraint firstItem="0Q4-1m-vDk" firstAttribute="top" secondItem="Fwz-pb-Vxw" secondAttribute="bottom" constant="32" id="QNR-n2-WAr"/>
|
||||
<constraint firstItem="0Q4-1m-vDk" firstAttribute="centerY" secondItem="i5M-Pr-FkT" secondAttribute="centerY" id="YWH-R0-Md3"/>
|
||||
<constraint firstItem="QgT-DT-gSd" firstAttribute="bottom" secondItem="i5M-Pr-FkT" secondAttribute="bottom" constant="-32" id="bIY-Nb-J3I"/>
|
||||
<constraint firstItem="Fwz-pb-Vxw" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="jcd-no-9jg"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="144.92753623188406" y="64.955357142857139"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -1 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 86 B |
Reference in New Issue
Block a user