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

@@ -129,7 +129,7 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_METHOD(setAccessibilityContentSizeMultipliers:(NSDictionary *)JSMultipliers)
{
NSMutableDictionary *multipliers = [[NSMutableDictionary alloc] init];
NSMutableDictionary *multipliers = [NSMutableDictionary new];
for (NSString *__nonnull JSCategory in JSMultipliers) {
NSNumber *m = JSMultipliers[JSCategory];
NSString *UIKitCategory = [self.class UIKitCategoryFromJSCategory:JSCategory];

View File

@@ -28,9 +28,9 @@ RCT_EXPORT_MODULE()
- (instancetype)init
{
if ((self = [super init])) {
_alerts = [[NSMutableArray alloc] init];
_alertCallbacks = [[NSMutableArray alloc] init];
_alertButtonKeys = [[NSMutableArray alloc] init];
_alerts = [NSMutableArray new];
_alertCallbacks = [NSMutableArray new];
_alertButtonKeys = [NSMutableArray new];
}
return self;
}

View File

@@ -161,7 +161,7 @@ RCT_EXPORT_MODULE()
RCTDeleteStorageDirectory();
}
_clearOnInvalidate = NO;
_manifest = [[NSMutableDictionary alloc] init];
_manifest = [NSMutableDictionary new];
_haveSetup = NO;
}
@@ -199,10 +199,10 @@ RCT_EXPORT_MODULE()
if (!_haveSetup) {
NSDictionary *errorOut;
NSString *serialized = RCTReadFile(RCTGetManifestFilePath(), nil, &errorOut);
_manifest = serialized ? [RCTJSONParse(serialized, &error) mutableCopy] : [[NSMutableDictionary alloc] init];
_manifest = serialized ? [RCTJSONParse(serialized, &error) mutableCopy] : [NSMutableDictionary new];
if (error) {
RCTLogWarn(@"Failed to parse manifest - creating new one.\n\n%@", error);
_manifest = [[NSMutableDictionary alloc] init];
_manifest = [NSMutableDictionary new];
}
_haveSetup = YES;
}
@@ -377,7 +377,7 @@ RCT_EXPORT_METHOD(multiRemove:(NSArray *)keys
RCT_EXPORT_METHOD(clear:(RCTResponseSenderBlock)callback)
{
_manifest = [[NSMutableDictionary alloc] init];
_manifest = [NSMutableDictionary new];
NSError *error = RCTDeleteStorageDirectory();
if (callback) {
callback(@[RCTNullIfNil(error)]);

View File

@@ -125,7 +125,7 @@ RCT_EXPORT_MODULE()
object:nil];
_defaults = [NSUserDefaults standardUserDefaults];
_settings = [[NSMutableDictionary alloc] init];
_settings = [NSMutableDictionary new];
_extraMenuItems = [NSMutableArray array];
// Delay setup until after Bridge init
@@ -331,7 +331,7 @@ RCT_EXPORT_METHOD(show)
return;
}
UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
UIActionSheet *actionSheet = [UIActionSheet new];
actionSheet.title = @"React Native: Development";
actionSheet.delegate = self;

View File

@@ -78,7 +78,7 @@ RCT_EXPORT_MODULE()
{
if ((self = [super init])) {
_paused = YES;
_timers = [[RCTSparseArray alloc] init];
_timers = [RCTSparseArray new];
for (NSString *name in @[UIApplicationWillResignActiveNotification,
UIApplicationDidEnterBackgroundNotification,
@@ -134,7 +134,7 @@ RCT_EXPORT_MODULE()
- (void)didUpdateFrame:(__unused RCTFrameUpdate *)update
{
NSMutableArray *timersToCall = [[NSMutableArray alloc] init];
NSMutableArray *timersToCall = [NSMutableArray new];
for (RCTTimer *timer in _timers.allObjects) {
if ([timer updateFoundNeedsJSUpdate]) {
[timersToCall addObject:timer.callbackID];

View File

@@ -219,16 +219,16 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
_shadowQueue = dispatch_queue_create("com.facebook.React.ShadowQueue", DISPATCH_QUEUE_SERIAL);
_pendingUIBlocksLock = [[NSLock alloc] init];
_pendingUIBlocksLock = [NSLock new];
_shadowViewRegistry = [[RCTSparseArray alloc] init];
_viewRegistry = [[RCTSparseArray alloc] init];
_shadowViewRegistry = [RCTSparseArray new];
_viewRegistry = [RCTSparseArray new];
// Internal resources
_pendingUIBlocks = [[NSMutableArray alloc] init];
_rootViewTags = [[NSMutableSet alloc] init];
_pendingUIBlocks = [NSMutableArray new];
_rootViewTags = [NSMutableSet new];
_bridgeTransactionListeners = [[NSMutableSet alloc] init];
_bridgeTransactionListeners = [NSMutableSet new];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveNewContentSizeMultiplier)
@@ -284,10 +284,10 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
RCTAssert(_bridge == nil, @"Should not re-use same UIIManager instance");
_bridge = bridge;
_shadowViewRegistry = [[RCTSparseArray alloc] init];
_shadowViewRegistry = [RCTSparseArray new];
// Get view managers from bridge
NSMutableDictionary *componentDataByName = [[NSMutableDictionary alloc] init];
NSMutableDictionary *componentDataByName = [NSMutableDictionary new];
for (RCTViewManager *manager in _bridge.modules.allValues) {
if ([manager isKindOfClass:[RCTViewManager class]]) {
RCTComponentData *componentData = [[RCTComponentData alloc] initWithManager:manager];
@@ -326,7 +326,7 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
if (!_viewRegistry) {
return;
}
RCTShadowView *shadowView = [[RCTShadowView alloc] init];
RCTShadowView *shadowView = [RCTShadowView new];
shadowView.reactTag = reactTag;
shadowView.frame = frame;
shadowView.backgroundColor = rootView.backgroundColor;
@@ -479,7 +479,7 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
// reactSetFrame: has been called. Note that if reactSetFrame: is not called,
// these won't be called either, so this is not a suitable place to update
// properties that aren't related to layout.
NSMutableArray *updateBlocks = [[NSMutableArray alloc] init];
NSMutableArray *updateBlocks = [NSMutableArray new];
for (RCTShadowView *shadowView in viewsWithNewFrames) {
RCTViewManager *manager = [_componentDataByName[shadowView.viewName] manager];
RCTViewManagerUIBlock block = [manager uiBlockToAmendWithShadowView:shadowView];
@@ -870,7 +870,7 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po
// processing the pending blocks in another thread.
[_pendingUIBlocksLock lock];
NSArray *previousPendingUIBlocks = _pendingUIBlocks;
_pendingUIBlocks = [[NSMutableArray alloc] init];
_pendingUIBlocks = [NSMutableArray new];
[_pendingUIBlocksLock unlock];
// Execute the previously queued UI blocks
@@ -1130,7 +1130,7 @@ RCT_EXPORT_METHOD(clearJSResponder)
- (NSDictionary *)bubblingEventsConfig
{
NSMutableDictionary *customBubblingEventTypesConfigs = [[NSMutableDictionary alloc] init];
NSMutableDictionary *customBubblingEventTypesConfigs = [NSMutableDictionary new];
for (RCTComponentData *componentData in _componentDataByName.allValues) {
RCTViewManager *manager = componentData.manager;
if (RCTClassOverridesInstanceMethod([manager class], @selector(customBubblingEventTypes))) {
@@ -1160,7 +1160,7 @@ RCT_EXPORT_METHOD(clearJSResponder)
- (NSDictionary *)directEventsConfig
{
NSMutableDictionary *customDirectEventTypes = [[NSMutableDictionary alloc] init];
NSMutableDictionary *customDirectEventTypes = [NSMutableDictionary new];
for (RCTComponentData *componentData in _componentDataByName.allValues) {
RCTViewManager *manager = componentData.manager;
if (RCTClassOverridesInstanceMethod([manager class], @selector(customDirectEventTypes))) {