mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Improve Swift plugin implementation * Add iOS tests * Review feedback on structure * Remove duplicate scheme file * Add macOS * Add iOS * swift test tweaks * unit tests * Whitespace * Add e2e tests
20 lines
627 B
Cheetah
20 lines
627 B
Cheetah
import Flutter
|
|
import UIKit
|
|
|
|
public class {{pluginClass}}: NSObject, FlutterPlugin {
|
|
public static func register(with registrar: FlutterPluginRegistrar) {
|
|
let channel = FlutterMethodChannel(name: "{{projectName}}", binaryMessenger: registrar.messenger())
|
|
let instance = {{pluginClass}}()
|
|
registrar.addMethodCallDelegate(instance, channel: channel)
|
|
}
|
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
switch call.method {
|
|
case "getPlatformVersion":
|
|
result("iOS " + UIDevice.current.systemVersion)
|
|
default:
|
|
result(FlutterMethodNotImplemented)
|
|
}
|
|
}
|
|
}
|