SwiftFlowyInfraUiPlugin.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import Flutter
  2. import UIKit
  3. public class SwiftFlowyInfraUiPlugin: NSObject, FlutterPlugin {
  4. enum Constant {
  5. static let infraUIMethodChannelName = "flowy_infra_ui_method"
  6. static let infraUIKeyboardEventChannelName = "flowy_infra_ui_event/keyboard"
  7. }
  8. public static func register(with registrar: FlutterPluginRegistrar) {
  9. let instance = SwiftFlowyInfraUiPlugin()
  10. let methodChannel = FlutterMethodChannel(
  11. name: Constant.infraUIMethodChannelName,
  12. binaryMessenger: registrar.messenger())
  13. registrar.addMethodCallDelegate(instance, channel: methodChannel)
  14. let keyboardEventChannel = FlutterEventChannel(
  15. name: Constant.infraUIKeyboardEventChannelName,
  16. binaryMessenger: registrar.messenger())
  17. keyboardEventChannel.setStreamHandler(KeyboardEventHandler())
  18. }
  19. // MARK: - Method Channel
  20. public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
  21. switch call.method {
  22. default:
  23. assertionFailure("Unsupported method \(call.method)")
  24. }
  25. }
  26. }