|
|
@@ -29,16 +29,16 @@
|
|
29
|
29
|
return self;
|
|
30
|
30
|
}
|
|
31
|
31
|
|
|
32
|
|
-- (UIViewController*)createLayoutAndSaveToStore:(NSDictionary*)layout {
|
|
|
32
|
+- (UIViewController<RNNRootViewProtocol> *)createLayoutAndSaveToStore:(NSDictionary*)layout {
|
|
33
|
33
|
return [self fromTree:layout];
|
|
34
|
34
|
}
|
|
35
|
35
|
|
|
36
|
36
|
# pragma mark private
|
|
37
|
37
|
|
|
38
|
|
-- (UIViewController*)fromTree:(NSDictionary*)json {
|
|
|
38
|
+- (UIViewController<RNNRootViewProtocol> *)fromTree:(NSDictionary*)json {
|
|
39
|
39
|
RNNLayoutNode* node = [RNNLayoutNode create:json];
|
|
40
|
40
|
|
|
41
|
|
- UIViewController* result;
|
|
|
41
|
+ UIViewController<RNNRootViewProtocol> *result;
|
|
42
|
42
|
|
|
43
|
43
|
if ( node.isContainer) {
|
|
44
|
44
|
result = [self createContainer:node];
|
|
|
@@ -76,7 +76,7 @@
|
|
76
|
76
|
return result;
|
|
77
|
77
|
}
|
|
78
|
78
|
|
|
79
|
|
-- (RNNRootViewController*)createContainer:(RNNLayoutNode*)node {
|
|
|
79
|
+- (UIViewController<RNNRootViewProtocol> *)createContainer:(RNNLayoutNode*)node {
|
|
80
|
80
|
NSString* name = node.data[@"name"];
|
|
81
|
81
|
NSDictionary* customTransition = node.data[@"customTransition"];
|
|
82
|
82
|
RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
|
|
|
@@ -85,7 +85,7 @@
|
|
85
|
85
|
return [[RNNRootViewController alloc] initWithName:name withOptions:options withContainerId:containerId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
|
|
86
|
86
|
}
|
|
87
|
87
|
|
|
88
|
|
-- (RNNNavigationController*)createContainerStack:(RNNLayoutNode*)node {
|
|
|
88
|
+- (UIViewController<RNNRootViewProtocol> *)createContainerStack:(RNNLayoutNode*)node {
|
|
89
|
89
|
RNNNavigationController* vc = [[RNNNavigationController alloc] init];
|
|
90
|
90
|
|
|
91
|
91
|
NSMutableArray* controllers = [NSMutableArray new];
|
|
|
@@ -97,12 +97,12 @@
|
|
97
|
97
|
return vc;
|
|
98
|
98
|
}
|
|
99
|
99
|
|
|
100
|
|
--(RNNTabBarController*)createTabs:(RNNLayoutNode*)node {
|
|
|
100
|
+-(UIViewController<RNNRootViewProtocol> *)createTabs:(RNNLayoutNode*)node {
|
|
101
|
101
|
RNNTabBarController* vc = [[RNNTabBarController alloc] init];
|
|
102
|
102
|
|
|
103
|
103
|
NSMutableArray* controllers = [NSMutableArray new];
|
|
104
|
104
|
for (NSDictionary *child in node.children) {
|
|
105
|
|
- UIViewController* childVc = [self fromTree:child];
|
|
|
105
|
+ UIViewController* childVc = (UIViewController*)[self fromTree:child];
|
|
106
|
106
|
RNNRootViewController* rootView = (RNNRootViewController *)childVc.childViewControllers.firstObject;
|
|
107
|
107
|
[rootView applyTabBarItem];
|
|
108
|
108
|
|
|
|
@@ -113,7 +113,7 @@
|
|
113
|
113
|
return vc;
|
|
114
|
114
|
}
|
|
115
|
115
|
|
|
116
|
|
-- (UIViewController*)createSideMenu:(RNNLayoutNode*)node {
|
|
|
116
|
+- (UIViewController<RNNRootViewProtocol> *)createSideMenu:(RNNLayoutNode*)node {
|
|
117
|
117
|
NSMutableArray* childrenVCs = [NSMutableArray new];
|
|
118
|
118
|
|
|
119
|
119
|
|
|
|
@@ -126,8 +126,8 @@
|
|
126
|
126
|
}
|
|
127
|
127
|
|
|
128
|
128
|
|
|
129
|
|
-- (UIViewController*)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
|
|
130
|
|
- UIViewController* child = [self fromTree:node.children[0]];
|
|
|
129
|
+- (UIViewController<RNNRootViewProtocol> *)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
|
|
|
130
|
+ UIViewController* child = (UIViewController*)[self fromTree:node.children[0]];
|
|
131
|
131
|
RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithChild: child type:type];
|
|
132
|
132
|
|
|
133
|
133
|
return sideMenuChild;
|