Browse Source

Fix build warnings on iOS (#6047)

* Fix possible retain cycles in commands handler
* Fix compiler build warnings
Yogev Ben David 4 years ago
parent
commit
3f8577da7d
No account linked to committer's email address

+ 1
- 1
lib/ios/BottomTabsPresenterCreator.h View File

@@ -3,6 +3,6 @@
3 3
 
4 4
 @interface BottomTabsPresenterCreator : NSObject
5 5
 
6
-+ (RNNBottomTabsPresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions;
6
++ (BottomTabsBasePresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions;
7 7
 
8 8
 @end

+ 1
- 1
lib/ios/BottomTabsPresenterCreator.m View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 @implementation BottomTabsPresenterCreator
5 5
 
6
-+ (RNNBottomTabsPresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
6
++ (BottomTabsBasePresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
7 7
 	if (@available(iOS 13.0, *)) {
8 8
 		return [[BottomTabsAppearancePresenter alloc] initWithDefaultOptions:defaultOptions];
9 9
 	} else {

+ 0
- 2
lib/ios/ElementFrameTransition.h View File

@@ -3,8 +3,6 @@
3 3
 
4 4
 @interface ElementFrameTransition : ElementBaseTransition
5 5
 
6
-- (instancetype)initWithView:(UIView *)view from:(CGRect)from to:(CGRect)to startDelay:(NSTimeInterval)startDelay duration:(NSTimeInterval)duration interpolation:(Text *)interpolation;
7
-
8 6
 @property (nonatomic) CGRect from;
9 7
 @property (nonatomic) CGRect to;
10 8
 

+ 13
- 13
lib/ios/RNNBridgeModule.m View File

@@ -21,7 +21,7 @@ RCT_EXPORT_MODULE();
21 21
 
22 22
 RCT_EXPORT_METHOD(setRoot:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
23 23
     RCTExecuteOnMainQueue(^{
24
-        [_commandsHandler setRoot:layout commandId:commandId completion:^{
24
+        [self->_commandsHandler setRoot:layout commandId:commandId completion:^{
25 25
             resolve(layout);
26 26
         }];
27 27
     });
@@ -29,7 +29,7 @@ RCT_EXPORT_METHOD(setRoot:(NSString*)commandId layout:(NSDictionary*)layout reso
29 29
 
30 30
 RCT_EXPORT_METHOD(mergeOptions:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
31 31
     RCTExecuteOnMainQueue(^{
32
-        [_commandsHandler mergeOptions:componentId options:options completion:^{
32
+        [self->_commandsHandler mergeOptions:componentId options:options completion:^{
33 33
             resolve(componentId);
34 34
         }];
35 35
     });
@@ -37,7 +37,7 @@ RCT_EXPORT_METHOD(mergeOptions:(NSString*)componentId options:(NSDictionary*)opt
37 37
 
38 38
 RCT_EXPORT_METHOD(setDefaultOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
39 39
     RCTExecuteOnMainQueue(^{
40
-        [_commandsHandler setDefaultOptions:options completion:^{
40
+        [self->_commandsHandler setDefaultOptions:options completion:^{
41 41
             resolve(nil);
42 42
         }];
43 43
     });
@@ -45,7 +45,7 @@ RCT_EXPORT_METHOD(setDefaultOptions:(NSDictionary*)options resolver:(RCTPromiseR
45 45
 
46 46
 RCT_EXPORT_METHOD(push:(NSString*)commandId componentId:(NSString*)componentId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
47 47
     RCTExecuteOnMainQueue(^{
48
-        [_commandsHandler push:componentId commandId:commandId layout:layout completion:^{
48
+        [self->_commandsHandler push:componentId commandId:commandId layout:layout completion:^{
49 49
             resolve(componentId);
50 50
         } rejection:reject];
51 51
     });
@@ -53,7 +53,7 @@ RCT_EXPORT_METHOD(push:(NSString*)commandId componentId:(NSString*)componentId l
53 53
 
54 54
 RCT_EXPORT_METHOD(pop:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
55 55
     RCTExecuteOnMainQueue(^{
56
-        [_commandsHandler pop:componentId commandId:commandId mergeOptions:(NSDictionary*)options completion:^{
56
+        [self->_commandsHandler pop:componentId commandId:commandId mergeOptions:(NSDictionary*)options completion:^{
57 57
             resolve(componentId);
58 58
         } rejection:reject];
59 59
     });
@@ -61,7 +61,7 @@ RCT_EXPORT_METHOD(pop:(NSString*)commandId componentId:(NSString*)componentId me
61 61
 
62 62
 RCT_EXPORT_METHOD(setStackRoot:(NSString*)commandId componentId:(NSString*)componentId children:(NSArray*)children resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
63 63
     RCTExecuteOnMainQueue(^{
64
-        [_commandsHandler setStackRoot:componentId commandId:commandId children:children completion:^{
64
+        [self->_commandsHandler setStackRoot:componentId commandId:commandId children:children completion:^{
65 65
             resolve(componentId);
66 66
         } rejection:reject];
67 67
     });
@@ -69,7 +69,7 @@ RCT_EXPORT_METHOD(setStackRoot:(NSString*)commandId componentId:(NSString*)compo
69 69
 
70 70
 RCT_EXPORT_METHOD(popTo:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
71 71
     RCTExecuteOnMainQueue(^{
72
-        [_commandsHandler popTo:componentId commandId:commandId mergeOptions:options completion:^{
72
+        [self->_commandsHandler popTo:componentId commandId:commandId mergeOptions:options completion:^{
73 73
             resolve(componentId);
74 74
         } rejection:reject];
75 75
     });
@@ -77,7 +77,7 @@ RCT_EXPORT_METHOD(popTo:(NSString*)commandId componentId:(NSString*)componentId
77 77
 
78 78
 RCT_EXPORT_METHOD(popToRoot:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
79 79
     RCTExecuteOnMainQueue(^{
80
-        [_commandsHandler popToRoot:componentId commandId:commandId mergeOptions:options completion:^{
80
+        [self->_commandsHandler popToRoot:componentId commandId:commandId mergeOptions:options completion:^{
81 81
             resolve(componentId);
82 82
         } rejection:reject];
83 83
     });
@@ -85,7 +85,7 @@ RCT_EXPORT_METHOD(popToRoot:(NSString*)commandId componentId:(NSString*)componen
85 85
 
86 86
 RCT_EXPORT_METHOD(showModal:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
87 87
     RCTExecuteOnMainQueue(^{
88
-        [_commandsHandler showModal:layout commandId:commandId completion:^(NSString *componentId) {
88
+        [self->_commandsHandler showModal:layout commandId:commandId completion:^(NSString *componentId) {
89 89
             resolve(componentId);
90 90
         }];
91 91
     });
@@ -93,7 +93,7 @@ RCT_EXPORT_METHOD(showModal:(NSString*)commandId layout:(NSDictionary*)layout re
93 93
 
94 94
 RCT_EXPORT_METHOD(dismissModal:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
95 95
     RCTExecuteOnMainQueue(^{
96
-        [_commandsHandler dismissModal:componentId commandId:commandId mergeOptions:options completion:^{
96
+        [self->_commandsHandler dismissModal:componentId commandId:commandId mergeOptions:options completion:^{
97 97
             resolve(componentId);
98 98
         } rejection:reject];
99 99
     });
@@ -101,7 +101,7 @@ RCT_EXPORT_METHOD(dismissModal:(NSString*)commandId componentId:(NSString*)compo
101 101
 
102 102
 RCT_EXPORT_METHOD(dismissAllModals:(NSString*)commandId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
103 103
     RCTExecuteOnMainQueue(^{
104
-        [_commandsHandler dismissAllModals:options commandId:commandId completion:^{
104
+        [self->_commandsHandler dismissAllModals:options commandId:commandId completion:^{
105 105
             resolve(nil);
106 106
         }];
107 107
     });
@@ -109,7 +109,7 @@ RCT_EXPORT_METHOD(dismissAllModals:(NSString*)commandId mergeOptions:(NSDictiona
109 109
 
110 110
 RCT_EXPORT_METHOD(showOverlay:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
111 111
     RCTExecuteOnMainQueue(^{
112
-        [_commandsHandler showOverlay:layout commandId:commandId completion:^{
112
+        [self->_commandsHandler showOverlay:layout commandId:commandId completion:^{
113 113
             resolve(layout[@"id"]);
114 114
         }];
115 115
     });
@@ -117,7 +117,7 @@ RCT_EXPORT_METHOD(showOverlay:(NSString*)commandId layout:(NSDictionary*)layout
117 117
 
118 118
 RCT_EXPORT_METHOD(dismissOverlay:(NSString*)commandId componentId:(NSString*)componentId resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
119 119
     RCTExecuteOnMainQueue(^{
120
-        [_commandsHandler dismissOverlay:componentId commandId:commandId completion:^{
120
+        [self->_commandsHandler dismissOverlay:componentId commandId:commandId completion:^{
121 121
             resolve(@(1));
122 122
         } rejection:reject];
123 123
     });

+ 25
- 22
lib/ios/RNNCommandsHandler.m View File

@@ -74,10 +74,10 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
74 74
 	
75 75
 	UIViewController *vc = [_controllerFactory createLayout:layout[@"root"]];
76 76
     vc.waitForRender = [vc.resolveOptionsWithDefault.animations.setRoot.waitForRender getWithDefaultValue:NO];
77
-    
77
+    __weak UIViewController* weakVC = vc;
78 78
     [vc setReactViewReadyCallback:^{
79
-        _mainWindow.rootViewController = vc;
80
-        [_eventEmitter sendOnNavigationCommandCompletion:setRoot commandId:commandId params:@{@"layout": layout}];
79
+        self->_mainWindow.rootViewController = weakVC;
80
+        [self->_eventEmitter sendOnNavigationCommandCompletion:setRoot commandId:commandId params:@{@"layout": layout}];
81 81
         completion();
82 82
     }];
83 83
     
@@ -160,8 +160,9 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
160 160
 		}
161 161
 	} else {
162 162
         newVc.waitForRender = newVc.resolveOptionsWithDefault.animations.push.shouldWaitForRender;
163
+        __weak UIViewController* weakNewVC = newVc;
163 164
         [newVc setReactViewReadyCallback:^{
164
-            [fromVC.stack push:newVc onTop:fromVC animated:[newVc.resolveOptionsWithDefault.animations.push.enable getWithDefaultValue:YES] completion:^{
165
+            [fromVC.stack push:weakNewVC onTop:fromVC animated:[weakNewVC.resolveOptionsWithDefault.animations.push.enable getWithDefaultValue:YES] completion:^{
165 166
                 [self->_eventEmitter sendOnNavigationCommandCompletion:push commandId:commandId params:@{@"componentId": componentId}];
166 167
                 completion();
167 168
             } rejection:rejection];
@@ -202,17 +203,17 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
202 203
 	RNNAssertMainQueue();
203 204
     
204 205
 	RNNComponentViewController *vc = (RNNComponentViewController*)[RNNLayoutManager findComponentForId:componentId];
205
-    if (vc) {
206
-        RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
207
-        [vc overrideOptions:options];
208
-        
209
-        [vc.stack pop:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^{
210
-            [self->_eventEmitter sendOnNavigationCommandCompletion:pop commandId:commandId params:@{@"componentId": componentId}];
211
-            completion();
212
-        } rejection:rejection];
213
-    } else {
214
-        [RNNErrorHandler reject:rejection withErrorCode:1012 errorDescription:[NSString stringWithFormat:@"Popping component failed - componentId '%@' not found", componentId]];
215
-    }
206
+  if (vc) {
207
+      RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
208
+      [vc overrideOptions:options];
209
+
210
+      [vc.stack pop:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^{
211
+          [self->_eventEmitter sendOnNavigationCommandCompletion:pop commandId:commandId params:@{@"componentId": componentId}];
212
+          completion();
213
+      } rejection:rejection];
214
+  } else {
215
+      [RNNErrorHandler reject:rejection withErrorCode:1012 errorDescription:[NSString stringWithFormat:@"Popping component failed - componentId '%@' not found", componentId]];
216
+  }
216 217
 }
217 218
 
218 219
 - (void)popTo:(NSString*)componentId commandId:(NSString*)commandId mergeOptions:(NSDictionary *)mergeOptions completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
@@ -224,7 +225,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
224 225
 	[vc overrideOptions:options];
225 226
 	
226 227
 	[vc.stack popTo:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^(NSArray *poppedViewControllers) {
227
-		[_eventEmitter sendOnNavigationCommandCompletion:popTo commandId:commandId params:@{@"componentId": componentId}];
228
+		[self->_eventEmitter sendOnNavigationCommandCompletion:popTo commandId:commandId params:@{@"componentId": componentId}];
228 229
 		completion();
229 230
 	} rejection:rejection];
230 231
 }
@@ -239,7 +240,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
239 240
 	
240 241
 	[CATransaction begin];
241 242
 	[CATransaction setCompletionBlock:^{
242
-		[_eventEmitter sendOnNavigationCommandCompletion:popToRoot commandId:commandId params:@{@"componentId": componentId}];
243
+		[self->_eventEmitter sendOnNavigationCommandCompletion:popToRoot commandId:commandId params:@{@"componentId": componentId}];
243 244
 		completion();
244 245
 	}];
245 246
 	
@@ -257,11 +258,12 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
257 258
     RNNAssertMainQueue();
258 259
 	
259 260
 	UIViewController *newVc = [_controllerFactory createLayout:layout];
261
+    __weak UIViewController* weakNewVC = newVc;
260 262
     newVc.waitForRender = [newVc.resolveOptionsWithDefault.animations.showModal.waitForRender getWithDefaultValue:NO];
261 263
     [newVc setReactViewReadyCallback:^{
262
-        [_modalManager showModal:newVc animated:[newVc.resolveOptionsWithDefault.animations.showModal.enable getWithDefaultValue:YES] completion:^(NSString *componentId) {
264
+        [self->_modalManager showModal:weakNewVC animated:[weakNewVC.resolveOptionsWithDefault.animations.showModal.enable getWithDefaultValue:YES] completion:^(NSString *componentId) {
263 265
             [self->_eventEmitter sendOnNavigationCommandCompletion:showModal commandId:commandId params:@{@"layout": layout}];
264
-            completion(newVc.layoutInfo.componentId);
266
+            completion(weakNewVC.layoutInfo.componentId);
265 267
         }];
266 268
     }];
267 269
 	[newVc render];
@@ -297,7 +299,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
297 299
 	
298 300
 	[CATransaction begin];
299 301
 	[CATransaction setCompletionBlock:^{
300
-		[_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals commandId:commandId params:@{}];
302
+		[self->_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals commandId:commandId params:@{}];
301 303
 		completion();
302 304
 	}];
303 305
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
@@ -311,9 +313,10 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
311 313
     RNNAssertMainQueue();
312 314
     
313 315
 	UIViewController* overlayVC = [_controllerFactory createLayout:layout];
316
+    __weak UIViewController* weakOverlayVC = overlayVC;
314 317
     [overlayVC setReactViewReadyCallback:^{UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
315
-        overlayWindow.rootViewController = overlayVC;
316
-        if ([overlayVC.resolveOptionsWithDefault.overlay.handleKeyboardEvents getWithDefaultValue:NO]) {
318
+        overlayWindow.rootViewController = weakOverlayVC;
319
+        if ([weakOverlayVC.resolveOptionsWithDefault.overlay.handleKeyboardEvents getWithDefaultValue:NO]) {
317 320
             [self->_overlayManager showOverlayWindowAsKeyWindow:overlayWindow];
318 321
         } else {
319 322
             [self->_overlayManager showOverlayWindow:overlayWindow];

+ 1
- 1
lib/ios/RNNControllerFactory.m View File

@@ -150,7 +150,7 @@
150 150
 - (UIViewController *)createBottomTabs:(RNNLayoutNode*)node {
151 151
     RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
152 152
     RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
153
-    RNNBottomTabsPresenter* presenter = [BottomTabsPresenterCreator createWithDefaultOptions:_defaultOptions];
153
+    BottomTabsBasePresenter* presenter = [BottomTabsPresenterCreator createWithDefaultOptions:_defaultOptions];
154 154
     NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
155 155
     BottomTabPresenter* bottomTabPresenter = [BottomTabPresenterCreator createWithDefaultOptions:_defaultOptions];
156 156
     RNNDotIndicatorPresenter* dotIndicatorPresenter = [[RNNDotIndicatorPresenter alloc] initWithDefaultOptions:_defaultOptions];

+ 9
- 9
lib/ios/RNNModalManager.h View File

@@ -3,25 +3,25 @@
3 3
 #import <React/RCTBridge.h>
4 4
 
5 5
 typedef void (^RNNTransitionCompletionBlock)(void);
6
-typedef void (^RNNTransitionWithComponentIdCompletionBlock)(NSString *componentId);
7
-typedef void (^RNNTransitionRejectionBlock)(NSString *code, NSString *message, NSError *error);
6
+typedef void (^RNNTransitionWithComponentIdCompletionBlock)(NSString * _Nonnull componentId);
7
+typedef void (^RNNTransitionRejectionBlock)(NSString * _Nonnull code, NSString * _Nonnull message, NSError * _Nullable error);
8 8
 
9 9
 @protocol RNNModalManagerDelegate <NSObject>
10 10
 
11
-- (void)dismissedModal:(UIViewController *)viewController;
12
-- (void)attemptedToDismissModal:(UIViewController *)viewController;
13
-- (void)dismissedMultipleModals:(NSArray *)viewControllers;
11
+- (void)dismissedModal:(UIViewController * _Nonnull)viewController;
12
+- (void)attemptedToDismissModal:(UIViewController * _Nonnull)viewController;
13
+- (void)dismissedMultipleModals:(NSArray * _Nonnull)viewControllers;
14 14
 
15 15
 @end
16 16
 
17 17
 @interface RNNModalManager : NSObject <UIAdaptivePresentationControllerDelegate>
18 18
 
19
-- (instancetype)initWithBridge:(RCTBridge *)bridge;
19
+- (instancetype _Nullable)initWithBridge:(RCTBridge * _Nonnull)bridge;
20 20
 
21
-@property (nonatomic, weak) id<RNNModalManagerDelegate> delegate;
21
+@property (nonatomic, weak) id<RNNModalManagerDelegate> _Nullable delegate;
22 22
 
23
-- (void)showModal:(UIViewController *)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock)completion;
24
-- (void)dismissModal:(UIViewController *)viewController completion:(RNNTransitionCompletionBlock)completion;
23
+- (void)showModal:(UIViewController * _Nonnull)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock _Nonnull)completion;
24
+- (void)dismissModal:(UIViewController * _Nonnull)viewController completion:(RNNTransitionCompletionBlock _Nonnull)completion;
25 25
 - (void)dismissAllModalsAnimated:(BOOL)animated completion:(void (^ __nullable)(void))completion;
26 26
 - (void)dismissAllModalsSynchronosly;
27 27
 

+ 1
- 1
lib/ios/RNNModalManager.m View File

@@ -106,7 +106,7 @@
106 106
 
107 107
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
108 108
 		[modalToDismiss dismissViewControllerAnimated:[optionsWithDefault.animations.dismissModal.enable getWithDefaultValue:YES] completion:^{
109
-			[_pendingModalIdsToDismiss removeObject:modalToDismiss];
109
+			[self->_pendingModalIdsToDismiss removeObject:modalToDismiss];
110 110
 			if (modalToDismiss.view) {
111 111
 				[self dismissedModal:modalToDismiss];
112 112
 			}

+ 31
- 30
lib/ios/RNNSideMenuPresenter.m View File

@@ -11,109 +11,110 @@
11 11
 - (void)applyOptions:(RNNNavigationOptions *)options {
12 12
 	[super applyOptions:options];
13 13
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
14
-	RNNSideMenuController* sideMenu = self.boundViewController;
15 14
 
16
-	[sideMenu side:MMDrawerSideLeft enabled:[withDefault.sideMenu.left.enabled getWithDefaultValue:YES]];
17
-	[sideMenu side:MMDrawerSideRight enabled:[withDefault.sideMenu.right.enabled getWithDefaultValue:YES]];
15
+	[self.sideMenuController side:MMDrawerSideLeft enabled:[withDefault.sideMenu.left.enabled getWithDefaultValue:YES]];
16
+	[self.sideMenuController side:MMDrawerSideRight enabled:[withDefault.sideMenu.right.enabled getWithDefaultValue:YES]];
18 17
 	
19
-	[sideMenu setShouldStretchLeftDrawer:[withDefault.sideMenu.left.shouldStretchDrawer getWithDefaultValue:YES]];
20
-	[sideMenu setShouldStretchRightDrawer:[withDefault.sideMenu.right.shouldStretchDrawer getWithDefaultValue:YES]];
18
+	[self.sideMenuController setShouldStretchLeftDrawer:[withDefault.sideMenu.left.shouldStretchDrawer getWithDefaultValue:YES]];
19
+	[self.sideMenuController setShouldStretchRightDrawer:[withDefault.sideMenu.right.shouldStretchDrawer getWithDefaultValue:YES]];
21 20
 	
22
-	[sideMenu setAnimationVelocityLeft:[withDefault.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
23
-	[sideMenu setAnimationVelocityRight:[withDefault.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
21
+	[self.sideMenuController setAnimationVelocityLeft:[withDefault.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
22
+	[self.sideMenuController setAnimationVelocityRight:[withDefault.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
24 23
 	
25
-	[sideMenu setAnimationType:[withDefault.sideMenu.animationType getWithDefaultValue:nil]];
24
+	[self.sideMenuController setAnimationType:[withDefault.sideMenu.animationType getWithDefaultValue:nil]];
26 25
 	
27 26
 	if (withDefault.sideMenu.left.width.hasValue) {
28
-		[sideMenu side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
27
+		[self.sideMenuController side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
29 28
 	}
30 29
 	
31 30
 	if (withDefault.sideMenu.right.width.hasValue) {
32
-		[sideMenu side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
31
+		[self.sideMenuController side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
33 32
 	}
34 33
 	
35 34
 	if (withDefault.sideMenu.left.visible.hasValue) {
36
-		[sideMenu side:MMDrawerSideLeft visible:withDefault.sideMenu.left.visible.get];
35
+		[self.sideMenuController side:MMDrawerSideLeft visible:withDefault.sideMenu.left.visible.get];
37 36
 		[withDefault.sideMenu.left.visible consume];
38 37
 	}
39 38
 	
40 39
 	if (withDefault.sideMenu.right.visible.hasValue) {
41
-		[sideMenu side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
40
+		[self.sideMenuController side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
42 41
 		[withDefault.sideMenu.right.visible consume];
43 42
 	}
44 43
     
45
-    [sideMenu.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
44
+    [self.sideMenuController.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
46 45
 }
47 46
 
48 47
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
49 48
 	[super applyOptionsOnInit:initialOptions];
50 49
 
51 50
 	RNNNavigationOptions *withDefault = [initialOptions withDefault:[self defaultOptions]];
52
-	RNNSideMenuController* sideMenu = self.boundViewController;
53 51
 	if (withDefault.sideMenu.left.width.hasValue) {
54
-		[sideMenu side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
52
+		[self.sideMenuController side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
55 53
 	}
56 54
 	
57 55
 	if (withDefault.sideMenu.right.width.hasValue) {
58
-		[sideMenu side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
56
+		[self.sideMenuController side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
59 57
 	}
60 58
 
61
-		[sideMenu setOpenDrawerGestureModeMask:[[withDefault.sideMenu.openGestureMode getWithDefaultValue:@(MMOpenDrawerGestureModeAll)] integerValue]];
59
+		[self.sideMenuController setOpenDrawerGestureModeMask:[[withDefault.sideMenu.openGestureMode getWithDefaultValue:@(MMOpenDrawerGestureModeAll)] integerValue]];
62 60
 }
63 61
 
64 62
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
65 63
     [super mergeOptions:options resolvedOptions:currentOptions];
66
-	RNNSideMenuController* sideMenu = self.boundViewController;
67 64
 	
68 65
 	if (options.sideMenu.left.enabled.hasValue) {
69
-		[sideMenu side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
66
+		[self.sideMenuController side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
70 67
 	}
71 68
 	
72 69
 	if (options.sideMenu.right.enabled.hasValue) {
73
-		[sideMenu side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
70
+		[self.sideMenuController side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
74 71
 	}
75 72
 	
76 73
 	if (options.sideMenu.left.visible.hasValue) {
77
-		[sideMenu side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
74
+		[self.sideMenuController side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
78 75
 		[options.sideMenu.left.visible consume];
79 76
 	}
80 77
 	
81 78
 	if (options.sideMenu.right.visible.hasValue) {
82
-		[sideMenu side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
79
+		[self.sideMenuController side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
83 80
 		[options.sideMenu.right.visible consume];
84 81
 	}
85 82
 	
86 83
 	if (options.sideMenu.left.width.hasValue) {
87
-		[sideMenu side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
84
+		[self.sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
88 85
 	}
89 86
 	
90 87
 	if (options.sideMenu.right.width.hasValue) {
91
-		[sideMenu side:MMDrawerSideRight width:options.sideMenu.right.width.get];
88
+		[self.sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
92 89
 	}
93 90
 	
94 91
 	if (options.sideMenu.left.shouldStretchDrawer.hasValue) {
95
-		sideMenu.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
92
+		self.sideMenuController.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
96 93
 	}
97 94
 	
98 95
 	if (options.sideMenu.right.shouldStretchDrawer.hasValue) {
99
-		sideMenu.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
96
+		self.sideMenuController.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
100 97
 	}
101 98
 	
102 99
 	if (options.sideMenu.left.animationVelocity.hasValue) {
103
-		sideMenu.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
100
+		self.sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
104 101
 	}
105 102
 	
106 103
 	if (options.sideMenu.right.animationVelocity.hasValue) {
107
-		sideMenu.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
104
+		self.sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
108 105
 	}
109 106
 	
110 107
 	if (options.sideMenu.animationType.hasValue) {
111
-		[sideMenu setAnimationType:options.sideMenu.animationType.get];
108
+		[self.sideMenuController setAnimationType:options.sideMenu.animationType.get];
112 109
 	}
113 110
     
114 111
     if (options.layout.backgroundColor.hasValue) {
115
-        [sideMenu.view setBackgroundColor:options.layout.backgroundColor.get];
112
+        [self.sideMenuController.view setBackgroundColor:options.layout.backgroundColor.get];
116 113
     }
117 114
 }
118 115
 
116
+- (RNNSideMenuController *)sideMenuController {
117
+    return (RNNSideMenuController *)self.boundViewController;
118
+}
119
+
119 120
 @end

+ 16
- 16
lib/ios/RNNSplitViewControllerPresenter.m View File

@@ -12,41 +12,41 @@
12 12
 - (void)applyOptions:(RNNNavigationOptions *)options {
13 13
 	[super applyOptions:options];
14 14
 	
15
-	UISplitViewController* splitViewController = self.boundViewController;
16
-	[splitViewController rnn_setDisplayMode:options.splitView.displayMode];
17
-	[splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
18
-	[splitViewController rnn_setMinWidth:options.splitView.minWidth];
19
-	[splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
15
+	[self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
16
+	[self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
17
+	[self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
18
+	[self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
20 19
 }
21 20
 
22 21
 
23 22
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
24 23
 	[super applyOptionsOnInit:initialOptions];
25 24
 	
26
-	UISplitViewController* splitViewController = self.boundViewController;
27
-	[splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
28
-	[splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
29
-	[splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
30
-	[splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
25
+	[self.splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
26
+	[self.splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
27
+	[self.splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
28
+	[self.splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
31 29
 }
32 30
 
33 31
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
34 32
     [super mergeOptions:options resolvedOptions:currentOptions];
35
-	
36
-	UISplitViewController* splitViewController = self.boundViewController;
37 33
 
38 34
 	if (options.splitView.displayMode) {
39
-		[splitViewController rnn_setDisplayMode:options.splitView.displayMode];
35
+		[self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
40 36
 	}
41 37
 	if (options.splitView.primaryEdge) {
42
-		[splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
38
+		[self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
43 39
 	}
44 40
 	if (options.splitView.minWidth) {
45
-		[splitViewController rnn_setMinWidth:options.splitView.minWidth];
41
+		[self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
46 42
 	}
47 43
 	if (options.splitView.maxWidth) {
48
-		[splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
44
+		[self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
49 45
 	}
50 46
 }
51 47
 
48
+- (UISplitViewController *)splitViewController {
49
+    return self.boundViewController;
50
+}
51
+
52 52
 @end

+ 0
- 2
lib/ios/RNNStackPresenter.m View File

@@ -76,8 +76,6 @@
76 76
 }
77 77
 
78 78
 - (void)applyOptionsBeforePopping:(RNNNavigationOptions *)options {
79
-    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
80
-    RNNStackController* navigationController = self.stackController;
81 79
     [_topBarPresenter applyOptionsBeforePopping:options.topBar];
82 80
 }
83 81