Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f62c939

Browse files
committed
review comments followup
1 parent e9551d7 commit f62c939

3 files changed

Lines changed: 12 additions & 33 deletions

File tree

shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,32 @@
55
#ifndef FLUTTER_FLUTTERPLATFORMVIEWS_H_
66
#define FLUTTER_FLUTTERPLATFORMVIEWS_H_
77

8-
#import <CoreMedia/CoreMedia.h>
9-
#import <Foundation/Foundation.h>
108
#import <UIKit/UIKit.h>
119

12-
#include "FlutterCodecs.h"
13-
#include "FlutterMacros.h"
10+
#import "FlutterCodecs.h"
11+
#import "FlutterMacros.h"
1412

1513
NS_ASSUME_NONNULL_BEGIN
1614

17-
/**
18-
* An instance of a `UIView` created by a `FlutterPlatformViewFactory`.
19-
*
20-
* This protocol is used to associate a view with a dispose callback.
21-
*/
22-
FLUTTER_EXPORT
23-
@protocol FlutterPlatformView <NSObject>
24-
- (UIView*)view;
25-
/**
26-
* Called when the Flutter engine no longer needs this `view`.
27-
*
28-
* The implementation of this method should release any kept for this view.
29-
*/
30-
- (void)dispose;
31-
@end
32-
3315
FLUTTER_EXPORT
3416
@protocol FlutterPlatformViewFactory <NSObject>
3517
/**
3618
* Create a `FlutterPlatformView`.
3719
*
3820
* Implemented by iOS code that expose a `UIView` for embedding in a Flutter app.
3921
*
40-
* The implementation of this method should create a new `UIView` and return a `FlutterPlatformView`
41-
* that wraps it.
22+
* The implementation of this method should create a new `UIView` and return it.
4223
*
4324
* @param frame The rectangle for the newly created `UIView` measued in points.
44-
* @param viewId A unique identifier for this `UIView`.
45-
* @param args Parameters for creating the `UIView` sent from the Dart side of the Flutter app.
25+
* @param viewIdentifier A unique identifier for this `UIView`.
26+
* @param arguments Parameters for creating the `UIView` sent from the Dart side of the Flutter app.
4627
* If `createArgsCodec` is not implemented, or if no creation arguments were sent from the Dart
4728
* code, this will be null. Otherwise this will be the value sent from the Dart code as decoded by
4829
* `createArgsCodec`.
4930
*/
50-
- (NSObject<FlutterPlatformView>*)createWithFrame:(CGRect)frame
51-
viewId:(int64_t)viewId
52-
andArgs:(id _Nullable)args;
31+
- (UIView*)createWithFrame:(CGRect)frame
32+
viewIdentifier:(int64_t)viewId
33+
arguments:(id _Nullable)args;
5334

5435
/**
5536
* Returns the `FlutterMessageCodec` for decoding the args parameter of `createWithFrame`.

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@
5555
}
5656

5757
// TODO(amirh): decode and pass the creation args.
58-
views_[viewId] =
59-
fml::scoped_nsobject<NSObject<FlutterPlatformView>>([[factory createWithFrame:CGRectZero
60-
viewId:viewId
61-
andArgs:nil] retain]);
58+
views_[viewId] = fml::scoped_nsobject<UIView>([[factory createWithFrame:CGRectZero
59+
viewIdentifier:viewId
60+
arguments:nil] retain]);
6261
result(nil);
6362
}
6463

@@ -73,7 +72,6 @@
7372
return;
7473
}
7574

76-
[views_[viewId] dispose];
7775
views_.erase(viewId);
7876
result(nil);
7977
}

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FlutterPlatformViewsController {
2222
private:
2323
fml::scoped_nsobject<FlutterMethodChannel> channel_;
2424
std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
25-
std::map<long long, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
25+
std::map<int64_t, fml::scoped_nsobject<UIView>> views_;
2626

2727
void OnMethodCall(FlutterMethodCall* call, FlutterResult& result);
2828
void OnCreate(FlutterMethodCall* call, FlutterResult& result);

0 commit comments

Comments
 (0)