Quellcode durchsuchen

Stop recursive double setting of default options (#5456)

There is no need to call `setDefaultOptions` on the `childViewController` while iterating the `childViewControllers` as those will be passed recursively as `rootViewController` anyway and thus calling `setDefaultOptions` in the nested recursive call.
Danilo Bürger vor 5 Jahren
Ursprung
Commit
d5c92b1609
1 geänderte Dateien mit 2 neuen und 5 gelöschten Zeilen
  1. 2
    5
      lib/ios/RNNDefaultOptionsHelper.m

+ 2
- 5
lib/ios/RNNDefaultOptionsHelper.m Datei anzeigen

@@ -3,14 +3,11 @@
3 3
 @implementation RNNDefaultOptionsHelper
4 4
 
5 5
 + (void)recrusivelySetDefaultOptions:(RNNNavigationOptions *)defaultOptions onRootViewController:(UIViewController *)rootViewController {
6
-	if ([rootViewController conformsToProtocol:@protocol(RNNLayoutProtocol)])
6
+	if ([rootViewController conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
7 7
 		[((UIViewController<RNNLayoutProtocol> *)rootViewController) setDefaultOptions:defaultOptions];
8
+	}
8 9
 	
9 10
 	for (UIViewController<RNNLayoutProtocol>* childViewController in rootViewController.childViewControllers) {
10
-		if ([childViewController conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
11
-			[childViewController setDefaultOptions:defaultOptions];
12
-		}
13
-		
14 11
 		[self recrusivelySetDefaultOptions:defaultOptions onRootViewController:childViewController];
15 12
 	}
16 13
 }