From ccd90e25c1401cd5ad7cddace7a1f2fbfe44bb95 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Mon, 2 Nov 2015 07:58:47 -0800 Subject: [PATCH] Convert remaining uses of alloc] init] to new] Summary: public We moved to using `new` instead of `alloc] init` but there was still some calls left. Reviewed By: javache Differential Revision: D2604679 fb-gh-sync-id: ff7300ecbedb55dd5e93873592598810c9b87808 --- Examples/2048/2048/AppDelegate.m | 2 +- Examples/Movies/Movies/AppDelegate.m | 2 +- Examples/TicTacToe/TicTacToe/AppDelegate.m | 2 +- .../UIExplorerUnitTests/LayoutSubviewsOrderingTest.m | 8 ++++---- Libraries/ART/ViewManagers/ARTGroupManager.m | 2 +- Libraries/ART/ViewManagers/ARTNodeManager.m | 2 +- Libraries/ART/ViewManagers/ARTRenderableManager.m | 2 +- Libraries/ART/ViewManagers/ARTShapeManager.m | 2 +- Libraries/ART/ViewManagers/ARTSurfaceViewManager.m | 2 +- Libraries/ART/ViewManagers/ARTTextManager.m | 2 +- React/Base/RCTUtils.m | 2 +- React/Executors/RCTContextExecutor.m | 2 +- React/Profiler/RCTProfile.m | 2 +- local-cli/generator-ios/templates/app/AppDelegate.m | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Examples/2048/2048/AppDelegate.m b/Examples/2048/2048/AppDelegate.m index b4b1769ff..9975d7df3 100644 --- a/Examples/2048/2048/AppDelegate.m +++ b/Examples/2048/2048/AppDelegate.m @@ -56,7 +56,7 @@ launchOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [[UIViewController alloc] init]; + UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; diff --git a/Examples/Movies/Movies/AppDelegate.m b/Examples/Movies/Movies/AppDelegate.m index 6b8a069fd..d81599fb7 100644 --- a/Examples/Movies/Movies/AppDelegate.m +++ b/Examples/Movies/Movies/AppDelegate.m @@ -57,7 +57,7 @@ launchOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [[UIViewController alloc] init]; + UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; diff --git a/Examples/TicTacToe/TicTacToe/AppDelegate.m b/Examples/TicTacToe/TicTacToe/AppDelegate.m index f0199b6dd..4cca2217d 100644 --- a/Examples/TicTacToe/TicTacToe/AppDelegate.m +++ b/Examples/TicTacToe/TicTacToe/AppDelegate.m @@ -56,7 +56,7 @@ launchOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [[UIViewController alloc] init]; + UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; diff --git a/Examples/UIExplorer/UIExplorerUnitTests/LayoutSubviewsOrderingTest.m b/Examples/UIExplorer/UIExplorerUnitTests/LayoutSubviewsOrderingTest.m index c00eedcfd..fcd796114 100644 --- a/Examples/UIExplorer/UIExplorerUnitTests/LayoutSubviewsOrderingTest.m +++ b/Examples/UIExplorer/UIExplorerUnitTests/LayoutSubviewsOrderingTest.m @@ -20,10 +20,10 @@ - (void)testLayoutSubviewsOrdering { // create some Views and ViewControllers - UIViewController *parentVC = [[UIViewController alloc] init]; - UIView *parentView = [[UIView alloc] init]; - UIViewController *childVC = [[UIViewController alloc] init]; - UIView *childView = [[UIView alloc] init]; + UIViewController *parentVC = [UIViewController new]; + UIView *parentView = [UIView new]; + UIViewController *childVC = [UIViewController new]; + UIView *childView = [UIView new]; // The ordering we expect is: // parentView::layoutSubviews diff --git a/Libraries/ART/ViewManagers/ARTGroupManager.m b/Libraries/ART/ViewManagers/ARTGroupManager.m index 15f55d4df..b958d11f9 100644 --- a/Libraries/ART/ViewManagers/ARTGroupManager.m +++ b/Libraries/ART/ViewManagers/ARTGroupManager.m @@ -17,7 +17,7 @@ RCT_EXPORT_MODULE() - (ARTNode *)node { - return [[ARTGroup alloc] init]; + return [ARTGroup new]; } @end diff --git a/Libraries/ART/ViewManagers/ARTNodeManager.m b/Libraries/ART/ViewManagers/ARTNodeManager.m index c2f0dba35..3c697c129 100644 --- a/Libraries/ART/ViewManagers/ARTNodeManager.m +++ b/Libraries/ART/ViewManagers/ARTNodeManager.m @@ -17,7 +17,7 @@ RCT_EXPORT_MODULE() - (ARTNode *)node { - return [[ARTNode alloc] init]; + return [ARTNode new]; } - (UIView *)view diff --git a/Libraries/ART/ViewManagers/ARTRenderableManager.m b/Libraries/ART/ViewManagers/ARTRenderableManager.m index 01b579dca..aaed2e31d 100644 --- a/Libraries/ART/ViewManagers/ARTRenderableManager.m +++ b/Libraries/ART/ViewManagers/ARTRenderableManager.m @@ -17,7 +17,7 @@ RCT_EXPORT_MODULE() - (ARTRenderable *)node { - return [[ARTRenderable alloc] init]; + return [ARTRenderable new]; } RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) diff --git a/Libraries/ART/ViewManagers/ARTShapeManager.m b/Libraries/ART/ViewManagers/ARTShapeManager.m index 426237fa7..3997586d1 100644 --- a/Libraries/ART/ViewManagers/ARTShapeManager.m +++ b/Libraries/ART/ViewManagers/ARTShapeManager.m @@ -18,7 +18,7 @@ RCT_EXPORT_MODULE() - (ARTRenderable *)node { - return [[ARTShape alloc] init]; + return [ARTShape new]; } RCT_EXPORT_VIEW_PROPERTY(d, CGPath) diff --git a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m index ddfba6697..10772b72c 100644 --- a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m +++ b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m @@ -17,7 +17,7 @@ RCT_EXPORT_MODULE() - (UIView *)view { - return [[ARTSurfaceView alloc] init]; + return [ARTSurfaceView new]; } @end diff --git a/Libraries/ART/ViewManagers/ARTTextManager.m b/Libraries/ART/ViewManagers/ARTTextManager.m index 473d0cf4f..430f26db5 100644 --- a/Libraries/ART/ViewManagers/ARTTextManager.m +++ b/Libraries/ART/ViewManagers/ARTTextManager.m @@ -18,7 +18,7 @@ RCT_EXPORT_MODULE() - (ARTRenderable *)node { - return [[ARTText alloc] init]; + return [ARTText new]; } RCT_EXPORT_VIEW_PROPERTY(alignment, CTTextAlignment) diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index d262c2ced..f1faa9004 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -358,7 +358,7 @@ id RCTAlertView(NSString *title, NSString *message, id delegate, NSString *cance return nil; } - UIAlertView *alertView = [[UIAlertView alloc] init]; + UIAlertView *alertView = [UIAlertView new]; alertView.title = title; alertView.message = message; alertView.delegate = delegate; diff --git a/React/Executors/RCTContextExecutor.m b/React/Executors/RCTContextExecutor.m index 51e136018..c4315e8d5 100644 --- a/React/Executors/RCTContextExecutor.m +++ b/React/Executors/RCTContextExecutor.m @@ -338,7 +338,7 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context) return; } if (!strongSelf->_context) { - JSContext *context = [[JSContext alloc] init]; + JSContext *context = [JSContext new]; strongSelf->_context = [[RCTJavaScriptContext alloc] initWithJSContext:context]; } [strongSelf _addNativeHook:RCTNativeLoggingHook withName:"nativeLoggingHook"]; diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index 04d70d8b2..1addda121 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -337,7 +337,7 @@ static NSMutableArray *RCTProfileGetThreadEvents(void) static NSString *const RCTProfileThreadEventsKey = @"RCTProfileThreadEventsKey"; NSMutableArray *threadEvents = [NSThread currentThread].threadDictionary[RCTProfileThreadEventsKey]; if (!threadEvents) { - threadEvents = [[NSMutableArray alloc] init]; + threadEvents = [NSMutableArray new]; [NSThread currentThread].threadDictionary[RCTProfileThreadEventsKey] = threadEvents; } return threadEvents; diff --git a/local-cli/generator-ios/templates/app/AppDelegate.m b/local-cli/generator-ios/templates/app/AppDelegate.m index 65ccc4e0e..6cf213bd4 100644 --- a/local-cli/generator-ios/templates/app/AppDelegate.m +++ b/local-cli/generator-ios/templates/app/AppDelegate.m @@ -47,7 +47,7 @@ launchOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [[UIViewController alloc] init]; + UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible];