Commit ca296b51 authored by Jim's avatar Jim Committed by GitHub

Merge pull request #388 from liaoyuanng/master

add designated initializer
parents 850b9189 48fafd37
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer> @interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer>
@property (nonatomic,copy,readwrite) NSString *name; @property (nonatomic,copy,readwrite) NSString *name;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (void)surfaceUpdated:(BOOL)appeared; - (void)surfaceUpdated:(BOOL)appeared;
- (void)setEnableForRunnersBatch:(BOOL)enable; - (void)setEnableForRunnersBatch:(BOOL)enable;
@end @end
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
@interface FLBFlutterViewContainer () @interface FLBFlutterViewContainer ()
@property (nonatomic,strong,readwrite) NSDictionary *params; @property (nonatomic,strong,readwrite) NSDictionary *params;
@property (nonatomic,assign) long long identifier; @property (nonatomic,assign) long long identifier;
@property (nonatomic, copy) NSString *flbNibName;
@property (nonatomic, strong) NSBundle *flbNibBundle;
@end @end
#pragma clang diagnostic push #pragma clang diagnostic push
...@@ -47,13 +49,15 @@ ...@@ -47,13 +49,15 @@
{ {
[FLUTTER_APP.flutterProvider prepareEngineIfNeeded]; [FLUTTER_APP.flutterProvider prepareEngineIfNeeded];
if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine
nibName:nil nibName:_flbNibName
bundle:nil]){ bundle:_flbNibBundle]){
[self _setup]; [self _setup];
} }
return self; return self;
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-designated-initializers"
- (instancetype)initWithCoder:(NSCoder *)aDecoder{ - (instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder: aDecoder]) { if (self = [super initWithCoder: aDecoder]) {
NSAssert(NO, @"unsupported init method!"); NSAssert(NO, @"unsupported init method!");
...@@ -61,6 +65,13 @@ ...@@ -61,6 +65,13 @@
} }
return self; return self;
} }
#pragma pop
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
_flbNibName = nibNameOrNil;
_flbNibBundle = nibBundleOrNil;
return [self init];
}
- (void)setName:(NSString *)name params:(NSDictionary *)params - (void)setName:(NSString *)name params:(NSDictionary *)params
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment