Commit 48fafd37 authored by Leo's avatar Leo

add designated initializer

parent 8a706f68
......@@ -29,6 +29,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer>
@property (nonatomic,copy,readwrite) NSString *name;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (void)surfaceUpdated:(BOOL)appeared;
- (void)setEnableForRunnersBatch:(BOOL)enable;
@end
......
......@@ -35,6 +35,8 @@
@interface FLBFlutterViewContainer ()
@property (nonatomic,strong,readwrite) NSDictionary *params;
@property (nonatomic,assign) long long identifier;
@property (nonatomic, copy) NSString *flbNibName;
@property (nonatomic, strong) NSBundle *flbNibBundle;
@end
#pragma clang diagnostic push
......@@ -45,13 +47,15 @@
{
[FLUTTER_APP.flutterProvider prepareEngineIfNeeded];
if(self = [super initWithEngine:FLUTTER_APP.flutterProvider.engine
nibName:nil
bundle:nil]){
nibName:_flbNibName
bundle:_flbNibBundle]){
[self _setup];
}
return self;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-designated-initializers"
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder: aDecoder]) {
NSAssert(NO, @"unsupported init method!");
......@@ -59,6 +63,13 @@
}
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
{
......
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