Bläddra i källkod

Avoid using [[* alloc] init*] where possible

Prefer shorthand initializers, like +new or +stringWithCString:encoding:
Tanner Bennett 7 år sedan
förälder
incheckning
81b7ccea22
33 ändrade filer med 102 tillägg och 102 borttagningar
  1. 8 8
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputColorView.m
  2. 1 1
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputDateView.m
  3. 1 1
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputSwitchView.m
  4. 1 1
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputView.m
  5. 3 3
      Classes/Editing/FLEXFieldEditorView.m
  6. 1 1
      Classes/Editing/FLEXFieldEditorViewController.m
  7. 3 3
      Classes/ExplorerInterface/FLEXExplorerViewController.m
  8. 5 5
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXMultiColumnTableView.m
  9. 1 1
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXRealmDatabaseManager.m
  10. 1 1
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableListViewController.m
  11. 1 1
      Classes/GlobalStateExplorers/FLEXLibrariesTableViewController.m
  12. 1 1
      Classes/GlobalStateExplorers/FLEXLiveObjectsTableViewController.m
  13. 2 2
      Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m
  14. 3 3
      Classes/Manager/FLEXManager.m
  15. 1 1
      Classes/Network/FLEXNetworkCurlLogger.m
  16. 2 2
      Classes/Network/FLEXNetworkHistoryTableViewController.m
  17. 3 3
      Classes/Network/FLEXNetworkRecorder.m
  18. 5 5
      Classes/Network/FLEXNetworkSettingsTableViewController.m
  19. 24 24
      Classes/Network/FLEXNetworkTransactionDetailTableViewController.m
  20. 5 5
      Classes/Network/FLEXNetworkTransactionTableViewCell.m
  21. 5 5
      Classes/Network/PonyDebugger/FLEXNetworkObserver.m
  22. 4 4
      Classes/ObjectExplorers/Controllers/FLEXObjectExplorerViewController.m
  23. 1 1
      Classes/ObjectExplorers/FLEXObjectExplorerFactory.m
  24. 6 6
      Classes/Toolbar/FLEXExplorerToolbar.m
  25. 2 2
      Classes/Utility/FLEXKeyboardShortcutManager.m
  26. 1 1
      Classes/Utility/FLEXRuntimeUtility.m
  27. 2 2
      Classes/Utility/FLEXUtility.m
  28. 2 2
      Classes/ViewHierarchy/FLEXHierarchyTableViewCell.m
  29. 1 1
      Example/UICatalog/AAPLAppDelegate.m
  30. 2 2
      Example/UICatalog/AAPLCatalogTableTableViewController.m
  31. 2 2
      Example/UICatalog/AAPLDatePickerController.m
  32. 1 1
      Example/UICatalog/AAPLProgressViewController.m
  33. 1 1
      Example/UICatalog/AAPLTextViewController.m

+ 8 - 8
Classes/Editing/ArgumentInputViews/FLEXArgumentInputColorView.m

@@ -34,12 +34,12 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        self.slider = [[UISlider alloc] init];
+        self.slider = [UISlider new];
         self.slider.backgroundColor = self.backgroundColor;
         [self.slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
         [self addSubview:self.slider];
         
-        self.valueLabel = [[UILabel alloc] init];
+        self.valueLabel = [UILabel new];
         self.valueLabel.backgroundColor = self.backgroundColor;
         self.valueLabel.font = [FLEXUtility defaultFontOfSize:14.0];
         self.valueLabel.textAlignment = NSTextAlignmentRight;
@@ -168,31 +168,31 @@
 {
     self = [super initWithArgumentTypeEncoding:typeEncoding];
     if (self) {
-        self.colorPreviewBox = [[FLEXColorPreviewBox alloc] init];
+        self.colorPreviewBox = [FLEXColorPreviewBox new];
         [self addSubview:self.colorPreviewBox];
         
-        self.hexLabel = [[UILabel alloc] init];
+        self.hexLabel = [UILabel new];
         self.hexLabel.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.9];
         self.hexLabel.textAlignment = NSTextAlignmentCenter;
         self.hexLabel.font = [FLEXUtility defaultFontOfSize:12.0];
         [self addSubview:self.hexLabel];
         
-        self.alphaInput = [[FLEXColorComponentInputView alloc] init];
+        self.alphaInput = [FLEXColorComponentInputView new];
         self.alphaInput.slider.minimumTrackTintColor = UIColor.blackColor;
         self.alphaInput.delegate = self;
         [self addSubview:self.alphaInput];
         
-        self.redInput = [[FLEXColorComponentInputView alloc] init];
+        self.redInput = [FLEXColorComponentInputView new];
         self.redInput.slider.minimumTrackTintColor = UIColor.redColor;
         self.redInput.delegate = self;
         [self addSubview:self.redInput];
         
-        self.greenInput = [[FLEXColorComponentInputView alloc] init];
+        self.greenInput = [FLEXColorComponentInputView new];
         self.greenInput.slider.minimumTrackTintColor = UIColor.greenColor;
         self.greenInput.delegate = self;
         [self addSubview:self.greenInput];
         
-        self.blueInput = [[FLEXColorComponentInputView alloc] init];
+        self.blueInput = [FLEXColorComponentInputView new];
         self.blueInput.slider.minimumTrackTintColor = UIColor.blueColor;
         self.blueInput.delegate = self;
         [self addSubview:self.blueInput];

+ 1 - 1
Classes/Editing/ArgumentInputViews/FLEXArgumentInputDateView.m

@@ -21,7 +21,7 @@
 {
     self = [super initWithArgumentTypeEncoding:typeEncoding];
     if (self) {
-        self.datePicker = [[UIDatePicker alloc] init];
+        self.datePicker = [UIDatePicker new];
         self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
         // Using UTC, because that's what the NSDate description prints
         self.datePicker.calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];

+ 1 - 1
Classes/Editing/ArgumentInputViews/FLEXArgumentInputSwitchView.m

@@ -20,7 +20,7 @@
 {
     self = [super initWithArgumentTypeEncoding:typeEncoding];
     if (self) {
-        self.inputSwitch = [[UISwitch alloc] init];
+        self.inputSwitch = [UISwitch new];
         [self.inputSwitch addTarget:self action:@selector(switchValueDidChange:) forControlEvents:UIControlEventValueChanged];
         [self.inputSwitch sizeToFit];
         [self addSubview:self.inputSwitch];

+ 1 - 1
Classes/Editing/ArgumentInputViews/FLEXArgumentInputView.m

@@ -56,7 +56,7 @@
 - (UILabel *)titleLabel
 {
     if (!_titleLabel) {
-        _titleLabel = [[UILabel alloc] init];
+        _titleLabel = [UILabel new];
         _titleLabel.font = [[self class] titleFont];
         _titleLabel.backgroundColor = self.backgroundColor;
         _titleLabel.textColor = [UIColor colorWithWhite:0.3 alpha:1.0];

+ 3 - 3
Classes/Editing/FLEXFieldEditorView.m

@@ -25,7 +25,7 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        self.targetDescriptionLabel = [[UILabel alloc] init];
+        self.targetDescriptionLabel = [UILabel new];
         self.targetDescriptionLabel.numberOfLines = 0;
         self.targetDescriptionLabel.font = [[self class] labelFont];
         [self addSubview:self.targetDescriptionLabel];
@@ -33,7 +33,7 @@
         self.targetDescriptionDivider = [[self class] dividerView];
         [self addSubview:self.targetDescriptionDivider];
         
-        self.fieldDescriptionLabel = [[UILabel alloc] init];
+        self.fieldDescriptionLabel = [UILabel new];
         self.fieldDescriptionLabel.numberOfLines = 0;
         self.fieldDescriptionLabel.font = [[self class] labelFont];
         [self addSubview:self.fieldDescriptionLabel];
@@ -123,7 +123,7 @@
 
 + (UIView *)dividerView
 {
-    UIView *dividerView = [[UIView alloc] init];
+    UIView *dividerView = [UIView new];
     dividerView.backgroundColor = [self dividerColor];
     return dividerView;
 }

+ 1 - 1
Classes/Editing/FLEXFieldEditorViewController.m

@@ -83,7 +83,7 @@
     self.scrollView.delegate = self;
     [self.view addSubview:self.scrollView];
     
-    self.fieldEditorView = [[FLEXFieldEditorView alloc] init];
+    self.fieldEditorView = [FLEXFieldEditorView new];
     self.fieldEditorView.backgroundColor = self.view.backgroundColor;
     self.fieldEditorView.targetDescription = [NSString stringWithFormat:@"%@ %p", [self.target class], self.target];
     [self.scrollView addSubview:self.fieldEditorView];

+ 3 - 3
Classes/ExplorerInterface/FLEXExplorerViewController.m

@@ -95,7 +95,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     [super viewDidLoad];
 
     // Toolbar
-    self.explorerToolbar = [[FLEXExplorerToolbar alloc] init];
+    self.explorerToolbar = [FLEXExplorerToolbar new];
 
     // Start the toolbar off below any bars that may be at the top of the view.
     id toolbarOriginYDefault = [[NSUserDefaults standardUserDefaults] objectForKey:kFLEXToolbarTopMarginDefaultsKey];
@@ -215,7 +215,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
         if (selectedView) {
             if (!self.selectedViewOverlay) {
-                self.selectedViewOverlay = [[UIView alloc] init];
+                self.selectedViewOverlay = [UIView new];
                 [self.view addSubview:self.selectedViewOverlay];
                 self.selectedViewOverlay.layer.borderWidth = 1.0;
             }
@@ -883,7 +883,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 - (void)toggleMenuTool
 {
     [self toggleToolWithViewControllerProvider:^UIViewController *{
-        FLEXGlobalsTableViewController *globalsViewController = [[FLEXGlobalsTableViewController alloc] init];
+        FLEXGlobalsTableViewController *globalsViewController = [FLEXGlobalsTableViewController new];
         globalsViewController.delegate = self;
         [FLEXGlobalsTableViewController setApplicationWindow:[UIApplication.sharedApplication keyWindow]];
         return [[UINavigationController alloc] initWithRootViewController:globalsViewController];

+ 5 - 5
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXMultiColumnTableView.m

@@ -91,7 +91,7 @@ static const CGFloat kColumnMargin = 1;
 
 - (void)loadHeaderScrollView
 {
-    UIScrollView *headerScrollView = [[UIScrollView alloc] init];
+    UIScrollView *headerScrollView = [UIScrollView new];
     headerScrollView.delegate      = self;
     self.headerScrollView          = headerScrollView;
     self.headerScrollView.backgroundColor =  [UIColor colorWithWhite:0.803 alpha:0.850];
@@ -102,11 +102,11 @@ static const CGFloat kColumnMargin = 1;
 - (void)loadContentScrollView
 {
     
-    UIScrollView *scrollView = [[UIScrollView alloc] init];
+    UIScrollView *scrollView = [UIScrollView new];
     scrollView.bounces       = NO;
     scrollView.delegate      = self;
     
-    UITableView *tableView   = [[UITableView alloc] init];
+    UITableView *tableView   = [UITableView new];
     tableView.delegate       = self;
     tableView.dataSource     = self;
     tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
@@ -121,14 +121,14 @@ static const CGFloat kColumnMargin = 1;
 
 - (void)loadLeftView
 {
-    UITableView *leftTableView = [[UITableView alloc] init];
+    UITableView *leftTableView = [UITableView new];
     leftTableView.delegate       = self;
     leftTableView.dataSource     = self;
     leftTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
     self.leftTableView           = leftTableView;
     [self addSubview:leftTableView];
     
-    UIView *leftHeader = [[UIView alloc] init];
+    UIView *leftHeader = [UIView new];
     leftHeader.backgroundColor = [UIColor colorWithWhite:0.950 alpha:0.668];
     self.leftHeader            = leftHeader;
     [self addSubview:leftHeader];

+ 1 - 1
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXRealmDatabaseManager.m

@@ -51,7 +51,7 @@
     }
     
     NSError *error = nil;
-    id configuration = [[configurationClass alloc] init];
+    id configuration = [configurationClass new];
     [(RLMRealmConfiguration *)configuration setFileURL:[NSURL fileURLWithPath:self.path]];
     self.realm = [realmClass realmWithConfiguration:configuration error:&error];
     return (error == nil);

+ 1 - 1
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableListViewController.m

@@ -88,7 +88,7 @@
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    FLEXTableContentViewController *contentViewController = [[FLEXTableContentViewController alloc] init];
+    FLEXTableContentViewController *contentViewController = [FLEXTableContentViewController new];
     
     contentViewController.contentsArray = [_dbm queryAllDataWithTableName:self.tables[indexPath.row]];
     contentViewController.columnsArray = [_dbm queryAllColumnsWithTableName:self.tables[indexPath.row]];

+ 1 - 1
Classes/GlobalStateExplorers/FLEXLibrariesTableViewController.m

@@ -172,7 +172,7 @@
         objectExplorer.object = self.foundClass;
         [self.navigationController pushViewController:objectExplorer animated:YES];
     } else {
-        FLEXClassesTableViewController *classesViewController = [[FLEXClassesTableViewController alloc] init];
+        FLEXClassesTableViewController *classesViewController = [FLEXClassesTableViewController new];
         classesViewController.binaryImageName = self.filteredImageNames[self.foundClass ? indexPath.row-1 : indexPath.row];
         [self.navigationController pushViewController:classesViewController animated:YES];
     }

+ 1 - 1
Classes/GlobalStateExplorers/FLEXLiveObjectsTableViewController.m

@@ -37,7 +37,7 @@ static const NSInteger kFLEXLiveObjectsSortBySizeIndex = 2;
     self.showsCarousel = YES;
     self.carousel.items = @[@"A→Z", @"Count", @"Size"];
     
-    self.refreshControl = [[UIRefreshControl alloc] init];
+    self.refreshControl = [UIRefreshControl new];
     [self.refreshControl addTarget:self action:@selector(refreshControlDidRefresh:) forControlEvents:UIControlEventValueChanged];
     
     [self reloadTableData];

+ 2 - 2
Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m

@@ -24,7 +24,7 @@ NSString *const kFLEXSystemLogTableViewCellIdentifier = @"FLEXSystemLogTableView
 {
     self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
     if (self) {
-        self.logMessageLabel = [[UILabel alloc] init];
+        self.logMessageLabel = [UILabel new];
         self.logMessageLabel.numberOfLines = 0;
         self.separatorInset = UIEdgeInsetsZero;
         self.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -118,7 +118,7 @@ static const UIEdgeInsets kFLEXLogMessageCellInsets = {10.0, 10.0, 10.0, 10.0};
     static NSDateFormatter *formatter = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        formatter = [[NSDateFormatter alloc] init];
+        formatter = [NSDateFormatter new];
         formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.SSS";
     });
 

+ 3 - 3
Classes/Manager/FLEXManager.m

@@ -37,7 +37,7 @@
     static FLEXManager *sharedManager = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        sharedManager = [[[self class] alloc] init];
+        sharedManager = [self new];
     });
     return sharedManager;
 }
@@ -68,7 +68,7 @@
 - (FLEXExplorerViewController *)explorerViewController
 {
     if (!_explorerViewController) {
-        _explorerViewController = [[FLEXExplorerViewController alloc] init];
+        _explorerViewController = [FLEXExplorerViewController new];
         _explorerViewController.delegate = self;
     }
 
@@ -393,7 +393,7 @@
     {
         [[topViewController presentingViewController] dismissViewControllerAnimated:YES completion:nil];
     } else {
-        id viewController = [[class alloc] init];
+        id viewController = [class new];
         UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
         [topViewController presentViewController:navigationController animated:YES completion:nil];
     }

+ 1 - 1
Classes/Network/FLEXNetworkCurlLogger.m

@@ -28,7 +28,7 @@
     }
 
     if (request.HTTPBody) {
-            [curlCommandString appendFormat:@"-d \'%@\'", [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding]];
+            [curlCommandString appendFormat:@"-d \'%@\'", [NSString stringWithCString:request.HTTPBody.bytes encoding:NSUTF8StringEncoding]];
     }
 
     return curlCommandString;

+ 2 - 2
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -68,7 +68,7 @@
 
 - (void)settingsButtonTapped:(id)sender
 {
-    FLEXNetworkSettingsTableViewController *settingsViewController = [[FLEXNetworkSettingsTableViewController alloc] init];
+    FLEXNetworkSettingsTableViewController *settingsViewController = [FLEXNetworkSettingsTableViewController new];
     settingsViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(settingsViewControllerDoneTapped:)];
     settingsViewController.title = @"Network Debugging Settings";
     UINavigationController *wrapperNavigationController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
@@ -293,7 +293,7 @@
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    FLEXNetworkTransactionDetailTableViewController *detailViewController = [[FLEXNetworkTransactionDetailTableViewController alloc] init];
+    FLEXNetworkTransactionDetailTableViewController *detailViewController = [FLEXNetworkTransactionDetailTableViewController new];
     detailViewController.transaction = [self transactionAtIndexPath:indexPath inTableView:tableView];
     [self.navigationController pushViewController:detailViewController animated:YES];
 }

+ 3 - 3
Classes/Network/FLEXNetworkRecorder.m

@@ -34,7 +34,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
 {
     self = [super init];
     if (self) {
-        self.responseCache = [[NSCache alloc] init];
+        self.responseCache = [NSCache new];
         NSUInteger responseCacheLimit = [[[NSUserDefaults standardUserDefaults] objectForKey:kFLEXNetworkRecorderResponseCacheLimitDefaultsKey] unsignedIntegerValue];
         if (responseCacheLimit) {
             [self.responseCache setTotalCostLimit:responseCacheLimit];
@@ -56,7 +56,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
     static FLEXNetworkRecorder *defaultRecorder = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        defaultRecorder = [[[self class] alloc] init];
+        defaultRecorder = [self new];
     });
     return defaultRecorder;
 }
@@ -118,7 +118,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
     }
 
     dispatch_async(self.queue, ^{
-        FLEXNetworkTransaction *transaction = [[FLEXNetworkTransaction alloc] init];
+        FLEXNetworkTransaction *transaction = [FLEXNetworkTransaction new];
         transaction.requestID = requestID;
         transaction.request = request;
         transaction.startTime = startDate;

+ 5 - 5
Classes/Network/FLEXNetworkSettingsTableViewController.m

@@ -108,12 +108,12 @@
 
 - (UITableViewCell *)switchCellWithTitle:(NSString *)title toggleAction:(SEL)toggleAction isOn:(BOOL)isOn
 {
-    UITableViewCell *cell = [[UITableViewCell alloc] init];
+    UITableViewCell *cell = [UITableViewCell new];
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
     cell.textLabel.text = title;
     cell.textLabel.font = [[self class] cellTitleFont];
 
-    UISwitch *theSwitch = [[UISwitch alloc] init];
+    UISwitch *theSwitch = [UISwitch new];
     theSwitch.on = isOn;
     [theSwitch addTarget:self action:toggleAction forControlEvents:UIControlEventValueChanged];
 
@@ -128,7 +128,7 @@
 
 - (UITableViewCell *)buttonCellWithTitle:(NSString *)title touchUpAction:(SEL)action isDestructive:(BOOL)isDestructive
 {
-    UITableViewCell *buttonCell = [[UITableViewCell alloc] init];
+    UITableViewCell *buttonCell = [UITableViewCell new];
     buttonCell.selectionStyle = UITableViewCellSelectionStyleNone;
 
     UIButton *actionButton = [UIButton buttonWithType:UIButtonTypeSystem];
@@ -156,12 +156,12 @@
 
 - (UITableViewCell *)sliderCellWithTitle:(NSString *)title changedAction:(SEL)changedAction minimum:(CGFloat)minimum maximum:(CGFloat)maximum initialValue:(CGFloat)initialValue
 {
-    UITableViewCell *sliderCell = [[UITableViewCell alloc] init];
+    UITableViewCell *sliderCell = [UITableViewCell new];
     sliderCell.selectionStyle = UITableViewCellSelectionStyleNone;
     sliderCell.textLabel.text = title;
     sliderCell.textLabel.font = [[self class] cellTitleFont];
 
-    UISlider *slider = [[UISlider alloc] init];
+    UISlider *slider = [UISlider new];
     slider.minimumValue = minimum;
     slider.maximumValue = maximum;
     slider.value = initialValue;

+ 24 - 24
Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

@@ -219,7 +219,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
     NSString *title = [NSString stringWithFormat:@"%@: ", row.title];
     NSString *detailText = row.detailText ?: @"";
-    NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] init];
+    NSMutableAttributedString *attributedText = [NSMutableAttributedString new];
     [attributedText appendAttributedString:[[NSAttributedString alloc] initWithString:title attributes:titleAttributes]];
     [attributedText appendAttributedString:[[NSAttributedString alloc] initWithString:detailText attributes:detailAttributes]];
 
@@ -232,7 +232,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 {
     NSMutableArray<FLEXNetworkDetailRow *> *rows = [NSMutableArray array];
 
-    FLEXNetworkDetailRow *requestURLRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *requestURLRow = [FLEXNetworkDetailRow new];
     requestURLRow.title = @"Request URL";
     NSURL *url = transaction.request.URL;
     requestURLRow.detailText = url.absoluteString;
@@ -243,18 +243,18 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     };
     [rows addObject:requestURLRow];
 
-    FLEXNetworkDetailRow *requestMethodRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *requestMethodRow = [FLEXNetworkDetailRow new];
     requestMethodRow.title = @"Request Method";
     requestMethodRow.detailText = transaction.request.HTTPMethod;
     [rows addObject:requestMethodRow];
 
     if (transaction.cachedRequestBody.length > 0) {
-        FLEXNetworkDetailRow *postBodySizeRow = [[FLEXNetworkDetailRow alloc] init];
+        FLEXNetworkDetailRow *postBodySizeRow = [FLEXNetworkDetailRow new];
         postBodySizeRow.title = @"Request Body Size";
         postBodySizeRow.detailText = [NSByteCountFormatter stringFromByteCount:transaction.cachedRequestBody.length countStyle:NSByteCountFormatterCountStyleBinary];
         [rows addObject:postBodySizeRow];
 
-        FLEXNetworkDetailRow *postBodyRow = [[FLEXNetworkDetailRow alloc] init];
+        FLEXNetworkDetailRow *postBodyRow = [FLEXNetworkDetailRow new];
         postBodyRow.title = @"Request Body";
         postBodyRow.detailText = @"tap to view";
         postBodyRow.selectionFuture = ^{
@@ -273,20 +273,20 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
     NSString *statusCodeString = [FLEXUtility statusCodeStringFromURLResponse:transaction.response];
     if (statusCodeString.length > 0) {
-        FLEXNetworkDetailRow *statusCodeRow = [[FLEXNetworkDetailRow alloc] init];
+        FLEXNetworkDetailRow *statusCodeRow = [FLEXNetworkDetailRow new];
         statusCodeRow.title = @"Status Code";
         statusCodeRow.detailText = statusCodeString;
         [rows addObject:statusCodeRow];
     }
 
     if (transaction.error) {
-        FLEXNetworkDetailRow *errorRow = [[FLEXNetworkDetailRow alloc] init];
+        FLEXNetworkDetailRow *errorRow = [FLEXNetworkDetailRow new];
         errorRow.title = @"Error";
         errorRow.detailText = transaction.error.localizedDescription;
         [rows addObject:errorRow];
     }
 
-    FLEXNetworkDetailRow *responseBodyRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *responseBodyRow = [FLEXNetworkDetailRow new];
     responseBodyRow.title = @"Response Body";
     NSData *responseData = [[FLEXNetworkRecorder defaultRecorder] cachedResponseBodyForTransaction:transaction];
     if (responseData.length > 0) {
@@ -315,52 +315,52 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     }
     [rows addObject:responseBodyRow];
 
-    FLEXNetworkDetailRow *responseSizeRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *responseSizeRow = [FLEXNetworkDetailRow new];
     responseSizeRow.title = @"Response Size";
     responseSizeRow.detailText = [NSByteCountFormatter stringFromByteCount:transaction.receivedDataLength countStyle:NSByteCountFormatterCountStyleBinary];
     [rows addObject:responseSizeRow];
 
-    FLEXNetworkDetailRow *mimeTypeRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *mimeTypeRow = [FLEXNetworkDetailRow new];
     mimeTypeRow.title = @"MIME Type";
     mimeTypeRow.detailText = transaction.response.MIMEType;
     [rows addObject:mimeTypeRow];
 
-    FLEXNetworkDetailRow *mechanismRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *mechanismRow = [FLEXNetworkDetailRow new];
     mechanismRow.title = @"Mechanism";
     mechanismRow.detailText = transaction.requestMechanism;
     [rows addObject:mechanismRow];
 
-    NSDateFormatter *startTimeFormatter = [[NSDateFormatter alloc] init];
+    NSDateFormatter *startTimeFormatter = [NSDateFormatter new];
     startTimeFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.SSS";
 
-    FLEXNetworkDetailRow *localStartTimeRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *localStartTimeRow = [FLEXNetworkDetailRow new];
     localStartTimeRow.title = [NSString stringWithFormat:@"Start Time (%@)", [[NSTimeZone localTimeZone] abbreviationForDate:transaction.startTime]];
     localStartTimeRow.detailText = [startTimeFormatter stringFromDate:transaction.startTime];
     [rows addObject:localStartTimeRow];
 
     startTimeFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
 
-    FLEXNetworkDetailRow *utcStartTimeRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *utcStartTimeRow = [FLEXNetworkDetailRow new];
     utcStartTimeRow.title = @"Start Time (UTC)";
     utcStartTimeRow.detailText = [startTimeFormatter stringFromDate:transaction.startTime];
     [rows addObject:utcStartTimeRow];
 
-    FLEXNetworkDetailRow *unixStartTime = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *unixStartTime = [FLEXNetworkDetailRow new];
     unixStartTime.title = @"Unix Start Time";
     unixStartTime.detailText = [NSString stringWithFormat:@"%f", [transaction.startTime timeIntervalSince1970]];
     [rows addObject:unixStartTime];
 
-    FLEXNetworkDetailRow *durationRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *durationRow = [FLEXNetworkDetailRow new];
     durationRow.title = @"Total Duration";
     durationRow.detailText = [FLEXUtility stringFromRequestDuration:transaction.duration];
     [rows addObject:durationRow];
 
-    FLEXNetworkDetailRow *latencyRow = [[FLEXNetworkDetailRow alloc] init];
+    FLEXNetworkDetailRow *latencyRow = [FLEXNetworkDetailRow new];
     latencyRow.title = @"Latency";
     latencyRow.detailText = [FLEXUtility stringFromRequestDuration:transaction.latency];
     [rows addObject:latencyRow];
 
-    FLEXNetworkDetailSection *generalSection = [[FLEXNetworkDetailSection alloc] init];
+    FLEXNetworkDetailSection *generalSection = [FLEXNetworkDetailSection new];
     generalSection.title = @"General";
     generalSection.rows = rows;
 
@@ -369,7 +369,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
 + (FLEXNetworkDetailSection *)requestHeadersSectionForTransaction:(FLEXNetworkTransaction *)transaction
 {
-    FLEXNetworkDetailSection *requestHeadersSection = [[FLEXNetworkDetailSection alloc] init];
+    FLEXNetworkDetailSection *requestHeadersSection = [FLEXNetworkDetailSection new];
     requestHeadersSection.title = @"Request Headers";
     requestHeadersSection.rows = [self networkDetailRowsFromDictionary:transaction.request.allHTTPHeaderFields];
 
@@ -378,12 +378,12 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
 + (FLEXNetworkDetailSection *)postBodySectionForTransaction:(FLEXNetworkTransaction *)transaction
 {
-    FLEXNetworkDetailSection *postBodySection = [[FLEXNetworkDetailSection alloc] init];
+    FLEXNetworkDetailSection *postBodySection = [FLEXNetworkDetailSection new];
     postBodySection.title = @"Request Body Parameters";
     if (transaction.cachedRequestBody.length > 0) {
         NSString *contentType = [transaction.request valueForHTTPHeaderField:@"Content-Type"];
         if ([contentType hasPrefix:@"application/x-www-form-urlencoded"]) {
-            NSString *bodyString = [[NSString alloc] initWithData:[self postBodyDataForTransaction:transaction] encoding:NSUTF8StringEncoding];
+            NSString *bodyString = [NSString stringWithCString:[self postBodyDataForTransaction:transaction].bytes encoding:NSUTF8StringEncoding];
             postBodySection.rows = [self networkDetailRowsFromDictionary:[FLEXUtility dictionaryFromQuery:bodyString]];
         }
     }
@@ -393,7 +393,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 + (FLEXNetworkDetailSection *)queryParametersSectionForTransaction:(FLEXNetworkTransaction *)transaction
 {
     NSDictionary<NSString *, id> *queryDictionary = [FLEXUtility dictionaryFromQuery:transaction.request.URL.query];
-    FLEXNetworkDetailSection *querySection = [[FLEXNetworkDetailSection alloc] init];
+    FLEXNetworkDetailSection *querySection = [FLEXNetworkDetailSection new];
     querySection.title = @"Query Parameters";
     querySection.rows = [self networkDetailRowsFromDictionary:queryDictionary];
 
@@ -402,7 +402,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
 + (FLEXNetworkDetailSection *)responseHeadersSectionForTransaction:(FLEXNetworkTransaction *)transaction
 {
-    FLEXNetworkDetailSection *responseHeadersSection = [[FLEXNetworkDetailSection alloc] init];
+    FLEXNetworkDetailSection *responseHeadersSection = [FLEXNetworkDetailSection new];
     responseHeadersSection.title = @"Response Headers";
     if ([transaction.response isKindOfClass:[NSHTTPURLResponse class]]) {
         NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)transaction.response;
@@ -417,7 +417,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     NSArray<NSString *> *sortedKeys = [dictionary.allKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
     for (NSString *key in sortedKeys) {
         id value = dictionary[key];
-        FLEXNetworkDetailRow *row = [[FLEXNetworkDetailRow alloc] init];
+        FLEXNetworkDetailRow *row = [FLEXNetworkDetailRow new];
         row.title = key;
         row.detailText = [value description];
         [rows addObject:row];

+ 5 - 5
Classes/Network/FLEXNetworkTransactionTableViewCell.m

@@ -31,22 +31,22 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
     if (self) {
         self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
 
-        self.nameLabel = [[UILabel alloc] init];
+        self.nameLabel = [UILabel new];
         self.nameLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
         [self.contentView addSubview:self.nameLabel];
 
-        self.pathLabel = [[UILabel alloc] init];
+        self.pathLabel = [UILabel new];
         self.pathLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
         self.pathLabel.textColor = [UIColor colorWithWhite:0.4 alpha:1.0];
         [self.contentView addSubview:self.pathLabel];
 
-        self.thumbnailImageView = [[UIImageView alloc] init];
+        self.thumbnailImageView = [UIImageView new];
         self.thumbnailImageView.layer.borderColor = UIColor.blackColor.CGColor;
         self.thumbnailImageView.layer.borderWidth = 1.0;
         self.thumbnailImageView.contentMode = UIViewContentModeScaleAspectFit;
         [self.contentView addSubview:self.thumbnailImageView];
 
-        self.transactionDetailsLabel = [[UILabel alloc] init];
+        self.transactionDetailsLabel = [UILabel new];
         self.transactionDetailsLabel.font = [FLEXUtility defaultFontOfSize:10.0];
         self.transactionDetailsLabel.textColor = [UIColor colorWithWhite:0.65 alpha:1.0];
         [self.contentView addSubview:self.transactionDetailsLabel];
@@ -167,7 +167,7 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
     static NSDateFormatter *dateFormatter = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        dateFormatter = [[NSDateFormatter alloc] init];
+        dateFormatter = [NSDateFormatter new];
         dateFormatter.dateFormat = @"HH:mm:ss";
     });
     return [dateFormatter stringFromDate:date];

+ 5 - 5
Classes/Network/PonyDebugger/FLEXNetworkObserver.m

@@ -116,7 +116,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
     static FLEXNetworkObserver *sharedObserver = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        sharedObserver = [[[self class] alloc] init];
+        sharedObserver = [self new];
     });
     return sharedObserver;
 }
@@ -888,7 +888,7 @@ static char const * const kFLEXRequestIDKey = "kFLEXRequestIDKey";
 {
     self = [super init];
     if (self) {
-        self.requestStatesForRequestIDs = [[NSMutableDictionary alloc] init];
+        self.requestStatesForRequestIDs = [NSMutableDictionary new];
         self.queue = dispatch_queue_create("com.flex.FLEXNetworkObserver", DISPATCH_QUEUE_SERIAL);
     }
     return self;
@@ -907,7 +907,7 @@ static char const * const kFLEXRequestIDKey = "kFLEXRequestIDKey";
 {
     FLEXInternalRequestState *requestState = self.requestStatesForRequestIDs[requestID];
     if (!requestState) {
-        requestState = [[FLEXInternalRequestState alloc] init];
+        requestState = [FLEXInternalRequestState new];
         [self.requestStatesForRequestIDs setObject:requestState forKey:requestID];
     }
     return requestState;
@@ -943,7 +943,7 @@ static char const * const kFLEXRequestIDKey = "kFLEXRequestIDKey";
 
         NSMutableData *dataAccumulator = nil;
         if (response.expectedContentLength < 0) {
-            dataAccumulator = [[NSMutableData alloc] init];
+            dataAccumulator = [NSMutableData new];
         } else if (response.expectedContentLength < 52428800) {
             dataAccumulator = [[NSMutableData alloc] initWithCapacity:(NSUInteger)response.expectedContentLength];
         }
@@ -1022,7 +1022,7 @@ static char const * const kFLEXRequestIDKey = "kFLEXRequestIDKey";
 
         NSMutableData *dataAccumulator = nil;
         if (response.expectedContentLength < 0) {
-            dataAccumulator = [[NSMutableData alloc] init];
+            dataAccumulator = [NSMutableData new];
         } else {
             dataAccumulator = [[NSMutableData alloc] initWithCapacity:(NSUInteger)response.expectedContentLength];
         }

+ 4 - 4
Classes/ObjectExplorers/Controllers/FLEXObjectExplorerViewController.m

@@ -97,7 +97,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     self.showsCarousel = YES;
     [self refreshScopeTitles];
     
-    self.refreshControl = [[UIRefreshControl alloc] init];
+    self.refreshControl = [UIRefreshControl new];
     [self.refreshControl addTarget:self action:@selector(refreshControlDidRefresh:) forControlEvents:UIControlEventValueChanged];
 }
 
@@ -245,7 +245,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     objc_property_t *propertyList = class_copyPropertyList(class, &propertyCount);
     if (propertyList) {
         for (unsigned int i = 0; i < propertyCount; i++) {
-            FLEXPropertyBox *propertyBox = [[FLEXPropertyBox alloc] init];
+            FLEXPropertyBox *propertyBox = [FLEXPropertyBox new];
             propertyBox.property = propertyList[i];
             [boxedProperties addObject:propertyBox];
         }
@@ -321,7 +321,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     Ivar *ivarList = class_copyIvarList(class, &ivarCount);
     if (ivarList) {
         for (unsigned int i = 0; i < ivarCount; i++) {
-            FLEXIvarBox *ivarBox = [[FLEXIvarBox alloc] init];
+            FLEXIvarBox *ivarBox = [FLEXIvarBox new];
             ivarBox.ivar = ivarList[i];
             [boxedIvars addObject:ivarBox];
         }
@@ -409,7 +409,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     Method *methodList = class_copyMethodList(class, &methodCount);
     if (methodList) {
         for (unsigned int i = 0; i < methodCount; i++) {
-            FLEXMethodBox *methodBox = [[FLEXMethodBox alloc] init];
+            FLEXMethodBox *methodBox = [FLEXMethodBox new];
             methodBox.method = methodList[i];
             [boxedMethods addObject:methodBox];
         }

+ 1 - 1
Classes/ObjectExplorers/FLEXObjectExplorerFactory.m

@@ -61,7 +61,7 @@
         }
     }
     
-    FLEXObjectExplorerViewController *explorerViewController = [[explorerClass alloc] init];
+    FLEXObjectExplorerViewController *explorerViewController = [explorerClass new];
     explorerViewController.object = object;
     
     return explorerViewController;

+ 6 - 6
Classes/Toolbar/FLEXExplorerToolbar.m

@@ -38,11 +38,11 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        self.backgroundView = [[UIView alloc] init];
+        self.backgroundView = [UIView new];
         self.backgroundView.backgroundColor = [FLEXColor secondaryBackgroundColorWithAlpha:0.95];
         [self addSubview:self.backgroundView];
 
-        self.dragHandle = [[UIView alloc] init];
+        self.dragHandle = [UIView new];
         self.dragHandle.backgroundColor = UIColor.clearColor;
         [self addSubview:self.dragHandle];
         
@@ -66,20 +66,20 @@
         UIImage *closeIcon = [FLEXResources closeIcon];
         self.closeItem = [FLEXToolbarItem toolbarItemWithTitle:@"close" image:closeIcon];
 
-        self.selectedViewDescriptionContainer = [[UIView alloc] init];
+        self.selectedViewDescriptionContainer = [UIView new];
         self.selectedViewDescriptionContainer.backgroundColor = [FLEXColor tertiaryBackgroundColorWithAlpha:0.95];
         self.selectedViewDescriptionContainer.hidden = YES;
         [self addSubview:self.selectedViewDescriptionContainer];
 
-        self.selectedViewDescriptionSafeAreaContainer = [[UIView alloc] init];
+        self.selectedViewDescriptionSafeAreaContainer = [UIView new];
         self.selectedViewDescriptionSafeAreaContainer.backgroundColor = UIColor.clearColor;
         [self.selectedViewDescriptionContainer addSubview:self.selectedViewDescriptionSafeAreaContainer];
         
-        self.selectedViewColorIndicator = [[UIView alloc] init];
+        self.selectedViewColorIndicator = [UIView new];
         self.selectedViewColorIndicator.backgroundColor = UIColor.redColor;
         [self.selectedViewDescriptionSafeAreaContainer addSubview:self.selectedViewColorIndicator];
         
-        self.selectedViewDescriptionLabel = [[UILabel alloc] init];
+        self.selectedViewDescriptionLabel = [UILabel new];
         self.selectedViewDescriptionLabel.backgroundColor = UIColor.clearColor;
         self.selectedViewDescriptionLabel.font = [[self class] descriptionLabelFont];
         [self.selectedViewDescriptionSafeAreaContainer addSubview:self.selectedViewDescriptionLabel];

+ 2 - 2
Classes/Utility/FLEXKeyboardShortcutManager.m

@@ -100,7 +100,7 @@
 
 + (instancetype)keyInputForKey:(NSString *)key flags:(UIKeyModifierFlags)flags helpDescription:(NSString *)helpDescription
 {
-    FLEXKeyInput *keyInput = [[self alloc] init];
+    FLEXKeyInput *keyInput = [self new];
     if (keyInput) {
         keyInput->_key = key;
         keyInput->_flags = flags;
@@ -128,7 +128,7 @@
     static FLEXKeyboardShortcutManager *sharedManager = nil;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        sharedManager = [[[self class] alloc] init];
+        sharedManager = [self new];
     });
     return sharedManager;
 }

+ 1 - 1
Classes/Utility/FLEXRuntimeUtility.m

@@ -553,7 +553,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
 
 + (NSValue *)valueForNumberWithObjCType:(const char *)typeEncoding fromInputString:(NSString *)inputString
 {
-    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
+    NSNumberFormatter *formatter = [NSNumberFormatter new];
     [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
     NSNumber *number = [formatter numberFromString:inputString];
     

+ 2 - 2
Classes/Utility/FLEXUtility.m

@@ -322,11 +322,11 @@
     
     id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
     if ([NSJSONSerialization isValidJSONObject:jsonObject]) {
-        prettyString = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:jsonObject options:NSJSONWritingPrettyPrinted error:NULL] encoding:NSUTF8StringEncoding];
+        prettyString = [NSString stringWithCString:[NSJSONSerialization dataWithJSONObject:jsonObject options:NSJSONWritingPrettyPrinted error:NULL].bytes encoding:NSUTF8StringEncoding];
         // NSJSONSerialization escapes forward slashes. We want pretty json, so run through and unescape the slashes.
         prettyString = [prettyString stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
     } else {
-        prettyString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+        prettyString = [NSString stringWithCString:data.bytes encoding:NSUTF8StringEncoding];
     }
     
     return prettyString;

+ 2 - 2
Classes/ViewHierarchy/FLEXHierarchyTableViewCell.m

@@ -27,7 +27,7 @@
 {
     self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
     if (self) {
-        self.depthIndicatorView = [[UIView alloc] init];
+        self.depthIndicatorView = [UIView new];
         self.depthIndicatorView.backgroundColor = [FLEXUtility hierarchyIndentPatternColor];
         [self.contentView addSubview:self.depthIndicatorView];
         
@@ -39,7 +39,7 @@
         self.detailTextLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
         self.accessoryType = UITableViewCellAccessoryDetailButton;
         
-        self.viewBackgroundColorView = [[UIView alloc] init];
+        self.viewBackgroundColorView = [UIView new];
         self.viewBackgroundColorView.clipsToBounds = YES;
         self.viewBackgroundColorView.layer.borderColor = UIColor.blackColor.CGColor;
         self.viewBackgroundColorView.layer.borderWidth = 1.0f;

+ 1 - 1
Example/UICatalog/AAPLAppDelegate.m

@@ -169,7 +169,7 @@
     for (NSString *urlString in requestURLStrings) {
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
             NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
-            [self.connections addObject:[[NSURLConnection alloc] initWithRequest:request delegate:self]];
+            [self.connections addObject:[NSURLConnection connectionWithRequest:request delegate:self]];
         });
         delayTime += stagger;
     }

+ 2 - 2
Example/UICatalog/AAPLCatalogTableTableViewController.m

@@ -34,10 +34,10 @@
 - (void)registerViewControllerBasedOption
 {
     // create UIViewController subclass
-    UIViewController *viewController = [[UIViewController alloc] init];
+    UIViewController *viewController = [UIViewController new];
 
     // fill it with some stuff
-    UILabel *infoLabel = [[UILabel alloc] init];
+    UILabel *infoLabel = [UILabel new];
     infoLabel.translatesAutoresizingMaskIntoConstraints = NO;
     infoLabel.text = @"Add switches, notes or whatever you wish to provide your testers with superpowers!";
     infoLabel.numberOfLines = 0;

+ 2 - 2
Example/UICatalog/AAPLDatePickerController.m

@@ -65,7 +65,7 @@
     [super viewDidLoad];
 
     // Create a date formatter to be used to format the "date" property of "datePicker".
-    self.dateFormatter = [[NSDateFormatter alloc] init];
+    self.dateFormatter = [NSDateFormatter new];
     self.dateFormatter.dateStyle = NSDateFormatterMediumStyle;
     self.dateFormatter.timeStyle = NSDateFormatterShortStyle;
 
@@ -85,7 +85,7 @@
 
     NSCalendar *currentCalendar = [NSCalendar currentCalendar];
 
-    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
+    NSDateComponents *dateComponents = [NSDateComponents new];
     dateComponents.day = 7;
 
     NSDate *sevenDaysFromNow = [currentCalendar dateByAddingComponents:dateComponents toDate:now options:0];

+ 1 - 1
Example/UICatalog/AAPLProgressViewController.m

@@ -118,7 +118,7 @@ const NSUInteger kProgressViewControllerMaxProgress = 100;
 
 - (void)simulateProgress {
     // In this example we will simulate progress with a "sleep operation".
-    self.operationQueue = [[NSOperationQueue alloc] init];
+    self.operationQueue = [NSOperationQueue new];
     
     for (NSUInteger count = 0; count < kProgressViewControllerMaxProgress; count++) {
         [self.operationQueue addOperationWithBlock:^{

+ 1 - 1
Example/UICatalog/AAPLTextViewController.m

@@ -167,7 +167,7 @@
     [attributedText addAttribute:NSForegroundColorAttributeName value:UIColor.aapl_applicationBlueColor range:tintedRange];
     
     // Add an image attachment.
-    NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
+    NSTextAttachment *textAttachment = [NSTextAttachment new];
     UIImage *image = [UIImage imageNamed:@"text_view_attachment"];
     textAttachment.image = image;
     textAttachment.bounds = CGRectMake(0, 0, image.size.width, image.size.height);