MyFlutterViewFactory.swift 705 B

12345678910111213141516171819202122232425262728
  1. //
  2. // MyFlutterViewFactory.swift
  3. // Runner
  4. //
  5. // Created by 大唐云 on 2021/6/3.
  6. //
  7. import Foundation
  8. import Flutter
  9. class MyFlutterViewFactory: NSObject,FlutterPlatformViewFactory {
  10. var messenger:FlutterBinaryMessenger
  11. init(messenger:FlutterBinaryMessenger) {
  12. self.messenger = messenger
  13. super.init()
  14. }
  15. func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
  16. return YSFlutterView(frame,viewID: viewId,args: args,messenger: messenger)
  17. }
  18. func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
  19. return FlutterStandardMessageCodec.sharedInstance()
  20. }
  21. }