From af9e7e8b4cd4c0c42c40a8aa4057064ad083fd66 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Wed, 28 Oct 2015 10:53:30 -0700 Subject: [PATCH] Update ReactExample Objective-C to 4-space indentation --- .../ReactExample.xcodeproj/project.pbxproj | 6 +- .../ReactExampleTests/ReactExampleTests.m | 63 ++++++++--------- examples/ReactExample/iOS/AppDelegate.m | 70 +++++++++---------- examples/ReactExample/iOS/main.m | 6 +- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj b/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj index f380c05b..8aee7818 100644 --- a/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj +++ b/examples/ReactExample/ReactExample.xcodeproj/project.pbxproj @@ -349,9 +349,9 @@ 027798471BBB2F1000C96559 /* ReactExampleTests */, 83CBBA001A601CBA00E9B192 /* Products */, ); - indentWidth = 2; + indentWidth = 4; sourceTree = ""; - tabWidth = 2; + tabWidth = 4; }; 83CBBA001A601CBA00E9B192 /* Products */ = { isa = PBXGroup; @@ -411,7 +411,7 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0700; - ORGANIZATIONNAME = Facebook; + ORGANIZATIONNAME = Realm; TargetAttributes = { 027798451BBB2F1000C96559 = { CreatedOnToolsVersion = 7.0.1; diff --git a/examples/ReactExample/ReactExampleTests/ReactExampleTests.m b/examples/ReactExample/ReactExampleTests/ReactExampleTests.m index 546e5131..faac8843 100644 --- a/examples/ReactExample/ReactExampleTests/ReactExampleTests.m +++ b/examples/ReactExample/ReactExampleTests/ReactExampleTests.m @@ -19,47 +19,46 @@ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test { - if (test(view)) { - return YES; - } - for (UIView *subview in [view subviews]) { - if ([self findSubviewInView:subview matching:test]) { - return YES; + if (test(view)) { + return YES; } - } - return NO; + for (UIView *subview in [view subviews]) { + if ([self findSubviewInView:subview matching:test]) { + return YES; + } + } + return NO; } - (void)testLaunched { - UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; - BOOL foundElement = NO; + UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; + BOOL foundElement = NO; - __block NSString *redboxError = nil; - RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; + __block NSString *redboxError = nil; + RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { + if (level >= RCTLogLevelError) { + redboxError = message; + } + }); + + while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + + foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { + if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { + return YES; + } + return NO; + }]; } - }); - while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + RCTSetLogFunction(RCTDefaultLogFunction); - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; - } - - RCTSetLogFunction(RCTDefaultLogFunction); - - XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); - //XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); + XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); + //XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); } - @end diff --git a/examples/ReactExample/iOS/AppDelegate.m b/examples/ReactExample/iOS/AppDelegate.m index 80331c4f..adaf8f33 100644 --- a/examples/ReactExample/iOS/AppDelegate.m +++ b/examples/ReactExample/iOS/AppDelegate.m @@ -10,47 +10,47 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - NSURL *jsCodeLocation; + NSURL *jsCodeLocation; - /** - * Loading JavaScript code - uncomment the one you want. - * - * OPTION 1 - * Load from development server. Start the server from the repository root: - * - * $ npm start - * - * To run on device, change `localhost` to the IP address of your computer - * (you can get this by typing `ifconfig` into the terminal and selecting the - * `inet` value under `en0:`) and make sure your computer and iOS device are - * on the same Wi-Fi network. - */ + /** + * Loading JavaScript code - uncomment the one you want. + * + * OPTION 1 + * Load from development server. Start the server from the repository root: + * + * $ npm start + * + * To run on device, change `localhost` to the IP address of your computer + * (you can get this by typing `ifconfig` into the terminal and selecting the + * `inet` value under `en0:`) and make sure your computer and iOS device are + * on the same Wi-Fi network. + */ - jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"]; + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"]; - /** - * OPTION 2 - * Load from pre-bundled file on disk. To re-generate the static bundle - * from the root of your project directory, run - * - * $ react-native bundle --minify - * - * see http://facebook.github.io/react-native/docs/runningondevice.html - */ + /** + * OPTION 2 + * Load from pre-bundled file on disk. To re-generate the static bundle + * from the root of your project directory, run + * + * $ react-native bundle --minify + * + * see http://facebook.github.io/react-native/docs/runningondevice.html + */ -// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; - RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation - moduleName:@"ReactExample" - initialProperties:nil - launchOptions:launchOptions]; + RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation + moduleName:@"ReactExample" + initialProperties:nil + launchOptions:launchOptions]; - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [[UIViewController alloc] init]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - return YES; + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + UIViewController *rootViewController = [[UIViewController alloc] init]; + rootViewController.view = rootView; + self.window.rootViewController = rootViewController; + [self.window makeKeyAndVisible]; + return YES; } @end diff --git a/examples/ReactExample/iOS/main.m b/examples/ReactExample/iOS/main.m index 3d767fcb..e7af16f9 100644 --- a/examples/ReactExample/iOS/main.m +++ b/examples/ReactExample/iOS/main.m @@ -12,7 +12,7 @@ #import "AppDelegate.h" int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } }