Convert alloc/init to new to please linter

This commit is contained in:
Nick Lockwood
2015-08-17 07:35:34 -07:00
parent 869ff92dbc
commit 8d1e02b8bd
74 changed files with 172 additions and 172 deletions

View File

@@ -50,7 +50,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];

View File

@@ -34,7 +34,7 @@
initialProperties:nil];
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];

View File

@@ -45,11 +45,11 @@
{
[super setUp];
_uiManager = [[RCTUIManager alloc] init];
_uiManager = [RCTUIManager new];
// Register 20 views to use in the tests
for (NSInteger i = 1; i <= 20; i++) {
UIView *registeredView = [[UIView alloc] init];
UIView *registeredView = [UIView new];
[registeredView setReactTag:@(i)];
_uiManager.viewRegistry[i] = registeredView;
}

View File

@@ -94,7 +94,7 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
- (void)testModulesAreInvalidated
{
AllocationTestModule *module = [[AllocationTestModule alloc] init];
AllocationTestModule *module = [AllocationTestModule new];
@autoreleasepool {
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:nil
moduleProvider:^{
@@ -113,7 +113,7 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
{
__weak AllocationTestModule *weakModule;
@autoreleasepool {
AllocationTestModule *module = [[AllocationTestModule alloc] init];
AllocationTestModule *module = [AllocationTestModule new];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:nil
moduleProvider:^{
return @[module];

View File

@@ -37,7 +37,7 @@
- (void)setUp
{
self.cache = [[RCTCache alloc] init];
self.cache = [RCTCache new];
self.cache.countLimit = 3;
self.cache.totalCostLimit = 100;
}

View File

@@ -33,7 +33,7 @@
- (void)setUp
{
[super setUp];
_executor = [[RCTContextExecutor alloc] init];
_executor = [RCTContextExecutor new];
[_executor setUp];
}
@@ -129,7 +129,7 @@ static uint64_t _get_time_nanoseconds(void)
";
[_executor executeApplicationScript:script sourceURL:[NSURL URLWithString:@"http://localhost:8081/"] onComplete:^(__unused NSError *error) {
NSMutableArray *params = [[NSMutableArray alloc] init];
NSMutableArray *params = [NSMutableArray new];
id data = @1;
for (int i = 0; i < 4; i++) {
double samples[runs / frequency];

View File

@@ -61,7 +61,7 @@
[super setUp];
_bridge = [OCMockObject mockForClass:[RCTBridge class]];
_eventDispatcher = [[RCTEventDispatcher alloc] init];
_eventDispatcher = [RCTEventDispatcher new];
((id<RCTBridgeModule>)_eventDispatcher).bridge = _bridge;
_eventName = RCTNormalizeInputEventName(@"sampleEvent");

View File

@@ -67,7 +67,7 @@ extern BOOL RCTIsGzippedData(NSData *data);
@"headers": @{@"Content-Encoding": @"gzip"},
};
RCTNetworking *networker = [[RCTNetworking alloc] init];
RCTNetworking *networker = [RCTNetworking new];
__block NSURLRequest *request = nil;
[networker buildRequest:query completionBlock:^(NSURLRequest *_request) {
request = _request;

View File

@@ -99,7 +99,7 @@
- (RCTShadowView *)_shadowViewWithStyle:(void(^)(css_style_t *style))styleBlock
{
RCTShadowView *shadowView = [[RCTShadowView alloc] init];
RCTShadowView *shadowView = [RCTShadowView new];
css_style_t style = shadowView.cssNode->style;
styleBlock(&style);

View File

@@ -25,13 +25,13 @@
- (void)testDictionary
{
id<RCTComponent> myView = [[UIView alloc] init];
id<RCTComponent> myView = [UIView new];
myView.reactTag = @4;
id<RCTComponent> myOtherView = [[UIView alloc] init];
id<RCTComponent> myOtherView = [UIView new];
myOtherView.reactTag = @5;
RCTSparseArray *registry = [[RCTSparseArray alloc] init];
RCTSparseArray *registry = [RCTSparseArray new];
XCTAssertNil(registry[@4], @"how did you have a view when none are registered?");
XCTAssertNil(registry[@5], @"how did you have a view when none are registered?");

View File

@@ -44,11 +44,11 @@
{
[super setUp];
_uiManager = [[RCTUIManager alloc] init];
_uiManager = [RCTUIManager new];
// Register 20 views to use in the tests
for (NSInteger i = 1; i <= 20; i++) {
UIView *registeredView = [[UIView alloc] init];
UIView *registeredView = [UIView new];
[registeredView setReactTag:@(i)];
_uiManager.viewRegistry[i] = registeredView;
}