Просмотр исходного кода

Use dot syntax for properties

Replaces the following method calls with dot syntax:
- count, length, UTF8String, CGColor, contentOffset, firstObject, lastObject, allObjects, allKeys, allValues, subviews, scale, frame, bounds, bytes

Also replaces various UIKit and Foundation singleton method calls with dot syntax, such as UIApplication.sharedApplication. These are all `class` properties now and Xcode will autocomplete them.

Also fixes a couple warnings.
Tanner Bennett лет назад: 7
Родитель
Сommit
f2c8ede0e0
80 измененных файлов с 330 добавлено и 327 удалено
  1. 4 4
      Classes/Core/FLEXScopeCarousel.m
  2. 9 9
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputColorView.m
  3. 3 3
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputFontsPickerView.m
  4. 1 1
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputNumberView.m
  5. 1 1
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputStringView.m
  6. 3 3
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputStructView.m
  7. 2 2
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputTextView.m
  8. 2 2
      Classes/Editing/ArgumentInputViews/FLEXArgumentInputView.m
  9. 1 1
      Classes/Editing/FLEXFieldEditorView.m
  10. 4 4
      Classes/Editing/FLEXFieldEditorViewController.m
  11. 2 2
      Classes/Editing/FLEXPropertyEditorViewController.m
  12. 20 20
      Classes/ExplorerInterface/FLEXExplorerViewController.m
  13. 1 1
      Classes/ExplorerInterface/FLEXWindow.m
  14. 3 3
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXMultiColumnTableView.m
  15. 2 2
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXSQLiteDatabaseManager.m
  16. 1 1
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableColumnHeader.m
  17. 3 3
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentCell.m
  18. 2 2
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentViewController.m
  19. 1 1
      Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableLeftCell.m
  20. 1 1
      Classes/GlobalStateExplorers/FLEXAddressExplorerCoordinator.m
  21. 5 5
      Classes/GlobalStateExplorers/FLEXClassesTableViewController.m
  22. 2 2
      Classes/GlobalStateExplorers/FLEXCookiesTableViewController.m
  23. 3 3
      Classes/GlobalStateExplorers/FLEXInstancesTableViewController.m
  24. 2 2
      Classes/GlobalStateExplorers/FLEXLiveObjectsTableViewController.m
  25. 2 2
      Classes/GlobalStateExplorers/FLEXWebViewController.m
  26. 4 4
      Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserFileOperationController.m
  27. 4 4
      Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserSearchOperation.m
  28. 12 12
      Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserTableViewController.m
  29. 1 1
      Classes/GlobalStateExplorers/SystemLog/FLEXASLLogController.m
  30. 1 1
      Classes/GlobalStateExplorers/SystemLog/FLEXOSLogController.h
  31. 1 1
      Classes/GlobalStateExplorers/SystemLog/FLEXOSLogController.m
  32. 2 2
      Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m
  33. 1 1
      Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.m
  34. 14 12
      Classes/Manager/FLEXManager.m
  35. 1 1
      Classes/Network/FLEXNetworkCurlLogger.m
  36. 11 11
      Classes/Network/FLEXNetworkHistoryTableViewController.m
  37. 7 7
      Classes/Network/FLEXNetworkRecorder.m
  38. 2 2
      Classes/Network/FLEXNetworkSettingsTableViewController.m
  39. 20 20
      Classes/Network/FLEXNetworkTransactionDetailTableViewController.m
  40. 7 7
      Classes/Network/FLEXNetworkTransactionTableViewCell.m
  41. 8 8
      Classes/Network/PonyDebugger/FLEXNetworkObserver.m
  42. 2 2
      Classes/ObjectExplorers/Controllers/FLEXArrayExplorerViewController.m
  43. 1 1
      Classes/ObjectExplorers/Controllers/FLEXBundleExplorerViewController.m
  44. 1 1
      Classes/ObjectExplorers/Controllers/FLEXColorExplorerViewController.m
  45. 1 1
      Classes/ObjectExplorers/Controllers/FLEXDictionaryExplorerViewController.m
  46. 25 25
      Classes/ObjectExplorers/Controllers/FLEXObjectExplorerViewController.m
  47. 1 1
      Classes/ObjectExplorers/Controllers/FLEXSetExplorerViewController.m
  48. 10 10
      Classes/ObjectExplorers/FLEXObjectExplorerFactory.m
  49. 1 1
      Classes/ObjectExplorers/Views/FLEXTableViewCell.m
  50. 7 7
      Classes/Toolbar/FLEXExplorerToolbar.m
  51. 1 1
      Classes/Toolbar/FLEXToolbarItem.m
  52. 3 3
      Classes/Utility/FLEXColor.m
  53. 2 2
      Classes/Utility/FLEXKeyboardHelpViewController.m
  54. 4 4
      Classes/Utility/FLEXKeyboardShortcutManager.m
  55. 1 1
      Classes/Utility/FLEXResources.m
  56. 15 15
      Classes/Utility/FLEXRuntimeUtility.m
  57. 1 1
      Classes/Utility/FLEXUtility.h
  58. 11 11
      Classes/Utility/FLEXUtility.m
  59. 2 2
      Classes/ViewHierarchy/FLEXHierarchyTableViewCell.m
  60. 3 3
      Classes/ViewHierarchy/FLEXHierarchyTableViewController.m
  61. 3 2
      Example/UICatalog.xcodeproj/project.pbxproj
  62. 1 1
      Example/UICatalog/AAPLActivityIndicatorViewController.m
  63. 6 6
      Example/UICatalog/AAPLAppDelegate.m
  64. 5 5
      Example/UICatalog/AAPLButtonViewController.m
  65. 1 1
      Example/UICatalog/AAPLCatalogTableTableViewController.m
  66. 1 1
      Example/UICatalog/AAPLCustomSearchBarViewController.m
  67. 2 2
      Example/UICatalog/AAPLCustomToolbarViewController.m
  68. 1 1
      Example/UICatalog/AAPLImageViewController.m
  69. 1 1
      Example/UICatalog/AAPLMasterViewController.m
  70. 5 5
      Example/UICatalog/AAPLPageControlViewController.m
  71. 2 2
      Example/UICatalog/AAPLProgressViewController.m
  72. 4 4
      Example/UICatalog/AAPLSegmentedControlViewController.m
  73. 2 2
      Example/UICatalog/AAPLSliderViewController.m
  74. 4 4
      Example/UICatalog/AAPLSplitViewControllerDelegate.m
  75. 1 1
      Example/UICatalog/AAPLStepperViewController.m
  76. 3 3
      Example/UICatalog/AAPLSwitchViewController.m
  77. 4 4
      Example/UICatalog/AAPLTextFieldViewController.m
  78. 8 8
      Example/UICatalog/AAPLTextViewController.m
  79. 2 2
      Example/UICatalog/AAPLTintedToolbarViewController.m
  80. 6 6
      Example/UICatalog/AAPLWebViewController.m

+ 4 - 4
Classes/Core/FLEXScopeCarousel.m

@@ -52,7 +52,7 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
                 collectionViewLayout:layout
             ];
             cv.showsHorizontalScrollIndicator = NO;
-            cv.backgroundColor = [UIColor clearColor];
+            cv.backgroundColor = UIColor.clearColor;
             cv.delegate = self;
             cv.dataSource = self;
             [cv registerClass:[FLEXCarouselCell class] forCellWithReuseIdentifier:kCarouselCellReuseIdentifier];
@@ -68,7 +68,7 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
 
         // Dynamic type
         __weak __typeof(self) weakSelf = self;
-        _dynamicTypeObserver = [[NSNotificationCenter defaultCenter]
+        _dynamicTypeObserver = [NSNotificationCenter.defaultCenter
             addObserverForName:UIContentSizeCategoryDidChangeNotification
             object:nil queue:nil usingBlock:^(NSNotification *note) {
                 [self.collectionView setNeedsLayout];
@@ -87,7 +87,7 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
 }
 
 - (void)dealloc {
-    [[NSNotificationCenter defaultCenter] removeObserver:self.dynamicTypeObserver];
+    [NSNotificationCenter.defaultCenter removeObserver:self.dynamicTypeObserver];
 }
 
 #pragma mark - Overrides
@@ -95,7 +95,7 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
 - (void)drawRect:(CGRect)rect {
     [super drawRect:rect];
 
-    CGFloat width = 1.f / [UIScreen mainScreen].scale;
+    CGFloat width = 1.f / UIScreen.mainScreen.scale;
 
     // Draw hairline
     CGContextRef context = UIGraphicsGetCurrentContext();

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

@@ -107,12 +107,12 @@
     self = [super initWithFrame:frame];
     if (self) {
         self.layer.borderWidth = 1.0;
-        self.layer.borderColor = [[UIColor blackColor] CGColor];
+        self.layer.borderColor = UIColor.blackColor.CGColor;
         self.backgroundColor = [UIColor colorWithPatternImage:[[self class] backgroundPatternImage]];
         
         self.colorOverlayView = [[UIView alloc] initWithFrame:self.bounds];
         self.colorOverlayView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-        self.colorOverlayView.backgroundColor = [UIColor clearColor];
+        self.colorOverlayView.backgroundColor = UIColor.clearColor;
         [self addSubview:self.colorOverlayView];
     }
     return self;
@@ -134,12 +134,12 @@
     CGSize squareSize = CGSizeMake(kSquareDimension, kSquareDimension);
     CGSize imageSize = CGSizeMake(2.0 * kSquareDimension, 2.0 * kSquareDimension);
     
-    UIGraphicsBeginImageContextWithOptions(imageSize, YES, [[UIScreen mainScreen] scale]);
+    UIGraphicsBeginImageContextWithOptions(imageSize, YES, UIScreen.mainScreen.scale);
     
-    [[UIColor whiteColor] setFill];
+    [UIColor.whiteColor setFill];
     UIRectFill(CGRectMake(0, 0, imageSize.width, imageSize.height));
     
-    [[UIColor grayColor] setFill];
+    [UIColor.grayColor setFill];
     UIRectFill(CGRectMake(squareSize.width, 0, squareSize.width, squareSize.height));
     UIRectFill(CGRectMake(0, squareSize.height, squareSize.width, squareSize.height));
     
@@ -178,22 +178,22 @@
         [self addSubview:self.hexLabel];
         
         self.alphaInput = [[FLEXColorComponentInputView alloc] init];
-        self.alphaInput.slider.minimumTrackTintColor = [UIColor blackColor];
+        self.alphaInput.slider.minimumTrackTintColor = UIColor.blackColor;
         self.alphaInput.delegate = self;
         [self addSubview:self.alphaInput];
         
         self.redInput = [[FLEXColorComponentInputView alloc] init];
-        self.redInput.slider.minimumTrackTintColor = [UIColor redColor];
+        self.redInput.slider.minimumTrackTintColor = UIColor.redColor;
         self.redInput.delegate = self;
         [self addSubview:self.redInput];
         
         self.greenInput = [[FLEXColorComponentInputView alloc] init];
-        self.greenInput.slider.minimumTrackTintColor = [UIColor greenColor];
+        self.greenInput.slider.minimumTrackTintColor = UIColor.greenColor;
         self.greenInput.delegate = self;
         [self addSubview:self.greenInput];
         
         self.blueInput = [[FLEXColorComponentInputView alloc] init];
-        self.blueInput.slider.minimumTrackTintColor = [UIColor blueColor];
+        self.blueInput.slider.minimumTrackTintColor = UIColor.blueColor;
         self.blueInput.delegate = self;
         [self addSubview:self.blueInput];
     }

+ 3 - 3
Classes/Editing/ArgumentInputViews/FLEXArgumentInputFontsPickerView.m

@@ -40,7 +40,7 @@
 
 - (id)inputValue
 {
-    return [self.inputTextView.text length] > 0 ? [self.inputTextView.text copy] : nil;
+    return self.inputTextView.text.length > 0 ? [self.inputTextView.text copy] : nil;
 }
 
 #pragma mark - private
@@ -74,7 +74,7 @@
 
 - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
 {
-    return [self.availableFonts count];
+    return self.availableFonts.count;
 }
 
 #pragma mark - UIPickerViewDelegate
@@ -84,7 +84,7 @@
     UILabel *fontLabel;
     if (!view) {
         fontLabel = [UILabel new];
-        fontLabel.backgroundColor = [UIColor clearColor];
+        fontLabel.backgroundColor = UIColor.clearColor;
         fontLabel.textAlignment = NSTextAlignmentCenter;
     } else {
         fontLabel = (UILabel*)view;

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

@@ -30,7 +30,7 @@
 
 - (id)inputValue
 {
-    return [FLEXRuntimeUtility valueForNumberWithObjCType:[self.typeEncoding UTF8String] fromInputString:self.inputTextView.text];
+    return [FLEXRuntimeUtility valueForNumberWithObjCType:self.typeEncoding.UTF8String fromInputString:self.inputTextView.text];
 }
 
 + (BOOL)supportsObjCType:(const char *)type withCurrentValue:(id)value

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

@@ -29,7 +29,7 @@
 {
     // Interpret empty string as nil. We loose the ability to set empty string as a string value,
     // but we accept that tradeoff in exchange for not having to type quotes for every string.
-    return [self.inputTextView.text length] > 0 ? [self.inputTextView.text copy] : nil;
+    return self.inputTextView.text.length > 0 ? [self.inputTextView.text copy] : nil;
 }
 
 // TODO: Support using object address for strings, as in the object arg view.

+ 3 - 3
Classes/Editing/ArgumentInputViews/FLEXArgumentInputStructView.m

@@ -30,7 +30,7 @@
             inputView.backgroundColor = self.backgroundColor;
             inputView.targetSize = FLEXArgumentInputViewSizeSmall;
             
-            if (fieldIndex < [customTitles count]) {
+            if (fieldIndex < customTitles.count) {
                 inputView.title = customTitles[fieldIndex];
             } else {
                 inputView.title = [NSString stringWithFormat:@"%@ field %lu (%@)", structName, (unsigned long)fieldIndex, prettyTypeEncoding];
@@ -59,7 +59,7 @@
 {
     if ([inputValue isKindOfClass:[NSValue class]]) {
         const char *structTypeEncoding = [inputValue objCType];
-        if (strcmp([self.typeEncoding UTF8String], structTypeEncoding) == 0) {
+        if (strcmp(self.typeEncoding.UTF8String, structTypeEncoding) == 0) {
             NSUInteger valueSize = 0;
             @try {
                 // NSGetSizeAndAlignment barfs on type encoding for bitfields.
@@ -90,7 +90,7 @@
 - (id)inputValue
 {
     NSValue *boxedStruct = nil;
-    const char *structTypeEncoding = [self.typeEncoding UTF8String];
+    const char *structTypeEncoding = self.typeEncoding.UTF8String;
     NSUInteger structSize = 0;
     @try {
         // NSGetSizeAndAlignment barfs on type encoding for bitfields.

+ 2 - 2
Classes/Editing/ArgumentInputViews/FLEXArgumentInputTextView.m

@@ -27,7 +27,7 @@
         self.inputTextView = [UITextView new];
         self.inputTextView.font = [[self class] inputFont];
         self.inputTextView.backgroundColor = [FLEXColor primaryBackgroundColor];
-        self.inputTextView.layer.borderColor = [[FLEXColor borderColor] CGColor];
+        self.inputTextView.layer.borderColor = [FLEXColor borderColor].CGColor;
         self.inputTextView.layer.borderWidth = 1.f;
         self.inputTextView.layer.cornerRadius = 5.f;
         self.inputTextView.autocapitalizationType = UITextAutocapitalizationTypeNone;
@@ -144,7 +144,7 @@
 #if FLEX_AT_LEAST_IOS13_SDK
     if (@available(iOS 13.0, *)) {
         if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
-            self.inputTextView.layer.borderColor = [[FLEXColor borderColor] CGColor];
+            self.inputTextView.layer.borderColor = [FLEXColor borderColor].CGColor;
         }
     }
 #endif

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

@@ -68,7 +68,7 @@
 
 - (BOOL)showsTitle
 {
-    return [self.title length] > 0;
+    return self.title.length > 0;
 }
 
 - (CGFloat)topInputFieldVerticalLayoutGuide
@@ -114,7 +114,7 @@
 {
     CGFloat height = 0;
     
-    if ([self.title length] > 0) {
+    if (self.title.length > 0) {
         CGSize constrainSize = CGSizeMake(size.width, CGFLOAT_MAX);
         height += ceil([self.titleLabel sizeThatFits:constrainSize].height);
         height += [[self class] titleBottomPadding];

+ 1 - 1
Classes/Editing/FLEXFieldEditorView.m

@@ -130,7 +130,7 @@
 
 + (UIColor *)dividerColor
 {
-    return [UIColor lightGrayColor];
+    return UIColor.lightGrayColor;
 }
 
 + (CGFloat)horizontalPadding

+ 4 - 4
Classes/Editing/FLEXFieldEditorViewController.m

@@ -33,15 +33,15 @@
     self = [super initWithNibName:nil bundle:nil];
     if (self) {
         self.target = target;
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
     }
     return self;
 }
 
 - (void)dealloc
 {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [NSNotificationCenter.defaultCenter removeObserver:self];
 }
 
 - (void)keyboardDidShow:(NSNotification *)notification
@@ -102,7 +102,7 @@
 
 - (FLEXArgumentInputView *)firstInputView
 {
-    return [[self.fieldEditorView argumentInputViews] firstObject];
+    return [self.fieldEditorView argumentInputViews].firstObject;
 }
 
 - (void)actionButtonPressed:(id)sender

+ 2 - 2
Classes/Editing/FLEXPropertyEditorViewController.m

@@ -39,7 +39,7 @@
     id currentValue = [FLEXRuntimeUtility valueForProperty:self.property onObject:self.target];
     self.setterButton.enabled = [[self class] canEditProperty:self.property onObject:self.target currentValue:currentValue];
     
-    const char *typeEncoding = [[FLEXRuntimeUtility typeEncodingForProperty:self.property] UTF8String];
+    const char *typeEncoding = [FLEXRuntimeUtility typeEncodingForProperty:self.property].UTF8String;
     FLEXArgumentInputView *inputView = [FLEXArgumentInputViewFactory argumentInputViewForTypeEncoding:typeEncoding];
     inputView.backgroundColor = self.view.backgroundColor;
     inputView.inputValue = [FLEXRuntimeUtility valueForProperty:self.property onObject:self.target];
@@ -92,7 +92,7 @@
 
 + (BOOL)canEditProperty:(objc_property_t)property onObject:(id)object currentValue:(id)value
 {
-    const char *typeEncoding = [[FLEXRuntimeUtility typeEncodingForProperty:property] UTF8String];
+    const char *typeEncoding = [FLEXRuntimeUtility typeEncodingForProperty:property].UTF8String;
     BOOL canEditType = [FLEXArgumentInputViewFactory canEditFieldWithTypeEncoding:typeEncoding currentValue:value];
     SEL setterSelector = [FLEXRuntimeUtility setterSelectorForProperty:property];
     BOOL isReadonly = [FLEXRuntimeUtility isReadonlyProperty:property] && (!setterSelector || ![object respondsToSelector:setterSelector]);

+ 20 - 20
Classes/ExplorerInterface/FLEXExplorerViewController.m

@@ -131,7 +131,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 - (UIViewController *)viewControllerForRotationAndOrientation
 {
-    UIWindow *window = self.previousKeyWindow ?: [[UIApplication sharedApplication] keyWindow];
+    UIWindow *window = self.previousKeyWindow ?: [UIApplication.sharedApplication keyWindow];
     UIViewController *viewController = window.rootViewController;
     // Obfuscating selector _viewControllerForSupportedInterfaceOrientations
     NSString *viewControllerSelectorString = [@[@"_vie", @"wContro", @"llerFor", @"Supported", @"Interface", @"Orientations"] componentsJoinedByString:@""];
@@ -175,7 +175,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
 {
     [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
-        for (UIView *outlineView in [self.outlineViewsForVisibleViews allValues]) {
+        for (UIView *outlineView in self.outlineViewsForVisibleViews.allValues) {
             outlineView.hidden = YES;
         }
         self.selectedViewOverlay.hidden = YES;
@@ -221,7 +221,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
             }
             UIColor *outlineColor = [FLEXUtility consistentRandomColorForObject:selectedView];
             self.selectedViewOverlay.backgroundColor = [outlineColor colorWithAlphaComponent:0.2];
-            self.selectedViewOverlay.layer.borderColor = [outlineColor CGColor];
+            self.selectedViewOverlay.layer.borderColor = outlineColor.CGColor;
             self.selectedViewOverlay.frame = [self.view convertRect:selectedView.bounds fromView:selectedView];
             
             // Make sure the selected overlay is in front of all the other subviews except the toolbar, which should always stay on top.
@@ -397,7 +397,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 - (UIWindow *)statusWindow
 {
     NSString *statusBarString = [NSString stringWithFormat:@"%@arWindow", @"_statusB"];
-    return [[UIApplication sharedApplication] valueForKey:statusBarString];
+    return [UIApplication.sharedApplication valueForKey:statusBarString];
 }
 
 - (void)moveButtonTapped:(FLEXToolbarItem *)sender
@@ -562,8 +562,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     CGRect outlineFrame = [self frameInLocalCoordinatesForView:view];
     UIView *outlineView = [[UIView alloc] initWithFrame:outlineFrame];
-    outlineView.backgroundColor = [UIColor clearColor];
-    outlineView.layer.borderColor = [[FLEXUtility consistentRandomColorForObject:view] CGColor];
+    outlineView.backgroundColor = UIColor.clearColor;
+    outlineView.layer.borderColor = [FLEXUtility consistentRandomColorForObject:view].CGColor;
     outlineView.layer.borderWidth = 1.0;
     return outlineView;
 }
@@ -594,7 +594,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     // Select in the window that would handle the touch, but don't just use the result of hitTest:withEvent: so we can still select views with interaction disabled.
     // Default to the the application's key window if none of the windows want the touch.
-    UIWindow *windowForSelection = [[UIApplication sharedApplication] keyWindow];
+    UIWindow *windowForSelection = [UIApplication.sharedApplication keyWindow];
     for (UIWindow *window in [[FLEXUtility allWindows] reverseObjectEnumerator]) {
         // Ignore the explorer's own window.
         if (window != self.view.window) {
@@ -606,7 +606,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     }
     
     // Select the deepest visible view at the tap point. This generally corresponds to what the user wants to select.
-    return [[self recursiveSubviewsAtPoint:tapPointInWindow inView:windowForSelection skipHiddenViews:YES] lastObject];
+    return [self recursiveSubviewsAtPoint:tapPointInWindow inView:windowForSelection skipHiddenViews:YES].lastObject;
 }
 
 - (NSArray<UIView *> *)recursiveSubviewsAtPoint:(CGPoint)pointInView inView:(UIView *)view skipHiddenViews:(BOOL)skipHidden
@@ -791,7 +791,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 - (void)makeKeyAndPresentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion
 {
     // Save the current key window so we can restore it following dismissal.
-    self.previousKeyWindow = [[UIApplication sharedApplication] keyWindow];
+    self.previousKeyWindow = [UIApplication.sharedApplication keyWindow];
     
     // Make our window key to correctly handle input.
     [self.view.window makeKeyWindow];
@@ -802,8 +802,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     // If this app doesn't use view controller based status bar management and we're on iOS 7+,
     // make sure the status bar style is UIStatusBarStyleDefault. We don't actually have to check
     // for view controller based management because the global methods no-op if that is turned on.
-    self.previousStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
-    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
+    self.previousStatusBarStyle = [UIApplication.sharedApplication statusBarStyle];
+    [UIApplication.sharedApplication setStatusBarStyle:UIStatusBarStyleDefault];
     
     // Show the view controller.
     [self presentViewController:viewController animated:animated completion:completion];
@@ -821,7 +821,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     [[self statusWindow] setWindowLevel:UIWindowLevelStatusBar];
     
     // Restore the status bar style if the app is using global status bar management.
-    [[UIApplication sharedApplication] setStatusBarStyle:self.previousStatusBarStyle];
+    [UIApplication.sharedApplication setStatusBarStyle:self.previousStatusBarStyle];
     
     [self dismissViewControllerAnimated:animated completion:completion];
 }
@@ -885,7 +885,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     [self toggleToolWithViewControllerProvider:^UIViewController *{
         FLEXGlobalsTableViewController *globalsViewController = [[FLEXGlobalsTableViewController alloc] init];
         globalsViewController.delegate = self;
-        [FLEXGlobalsTableViewController setApplicationWindow:[[UIApplication sharedApplication] keyWindow]];
+        [FLEXGlobalsTableViewController setApplicationWindow:[UIApplication.sharedApplication keyWindow]];
         return [[UINavigationController alloc] initWithRootViewController:globalsViewController];
     } completion:nil];
 }
@@ -894,9 +894,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     if (self.currentMode == FLEXExplorerModeMove) {
         CGRect frame = self.selectedView.frame;
-        frame.origin.y += 1.0 / [[UIScreen mainScreen] scale];
+        frame.origin.y += 1.0 / UIScreen.mainScreen.scale;
         self.selectedView.frame = frame;
-    } else if (self.currentMode == FLEXExplorerModeSelect && [self.viewsAtTapPoint count] > 0) {
+    } else if (self.currentMode == FLEXExplorerModeSelect && self.viewsAtTapPoint.count > 0) {
         NSInteger selectedViewIndex = [self.viewsAtTapPoint indexOfObject:self.selectedView];
         if (selectedViewIndex > 0) {
             self.selectedView = [self.viewsAtTapPoint objectAtIndex:selectedViewIndex - 1];
@@ -908,11 +908,11 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     if (self.currentMode == FLEXExplorerModeMove) {
         CGRect frame = self.selectedView.frame;
-        frame.origin.y -= 1.0 / [[UIScreen mainScreen] scale];
+        frame.origin.y -= 1.0 / UIScreen.mainScreen.scale;
         self.selectedView.frame = frame;
-    } else if (self.currentMode == FLEXExplorerModeSelect && [self.viewsAtTapPoint count] > 0) {
+    } else if (self.currentMode == FLEXExplorerModeSelect && self.viewsAtTapPoint.count > 0) {
         NSInteger selectedViewIndex = [self.viewsAtTapPoint indexOfObject:self.selectedView];
-        if (selectedViewIndex < [self.viewsAtTapPoint count] - 1) {
+        if (selectedViewIndex < self.viewsAtTapPoint.count - 1) {
             self.selectedView = [self.viewsAtTapPoint objectAtIndex:selectedViewIndex + 1];
         }
     }
@@ -922,7 +922,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     if (self.currentMode == FLEXExplorerModeMove) {
         CGRect frame = self.selectedView.frame;
-        frame.origin.x += 1.0 / [[UIScreen mainScreen] scale];
+        frame.origin.x += 1.0 / UIScreen.mainScreen.scale;
         self.selectedView.frame = frame;
     }
 }
@@ -931,7 +931,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 {
     if (self.currentMode == FLEXExplorerModeMove) {
         CGRect frame = self.selectedView.frame;
-        frame.origin.x -= 1.0 / [[UIScreen mainScreen] scale];
+        frame.origin.x -= 1.0 / UIScreen.mainScreen.scale;
         self.selectedView.frame = frame;
     }
 }

+ 1 - 1
Classes/ExplorerInterface/FLEXWindow.m

@@ -15,7 +15,7 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        self.backgroundColor = [UIColor clearColor];
+        self.backgroundColor = UIColor.clearColor;
         // Some apps have windows at UIWindowLevelStatusBar + n.
         // If we make the window level too high, we block out UIAlertViews.
         // There's a balance between staying above the app's windows and staying below alerts.

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

@@ -204,7 +204,7 @@ static const CGFloat kColumnMargin = 1;
 - (UITableViewCell *)tableView:(UITableView *)tableView
          cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    UIColor *backgroundColor = [UIColor whiteColor];
+    UIColor *backgroundColor = UIColor.whiteColor;
     if (indexPath.row % 2 != 0) {
         backgroundColor = [UIColor colorWithWhite:0.950 alpha:0.750];
     }
@@ -219,11 +219,11 @@ static const CGFloat kColumnMargin = 1;
         for (int i = 0 ; i < cell.labels.count; i++) {
             
             UILabel *label  = cell.labels[i];
-            label.textColor = [UIColor blackColor];
+            label.textColor = UIColor.blackColor;
             
             NSString *content = [NSString stringWithFormat:@"%@",self.rowData[i]];
             if ([content isEqualToString:@"<null>"]) {
-                label.textColor = [UIColor lightGrayColor];
+                label.textColor = UIColor.lightGrayColor;
                 content = @"NULL";
             }
             label.text            = content;

+ 2 - 2
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXSQLiteDatabaseManager.m

@@ -33,7 +33,7 @@ static NSString *const QUERY_TABLENAMES_SQL = @"SELECT name FROM sqlite_master W
     if (_db) {
         return YES;
     }
-    int err = sqlite3_open([_databasePath UTF8String], &_db);
+    int err = sqlite3_open(_databasePath.UTF8String, &_db);
 
 #if SQLITE_HAS_CODEC
     NSString *defaultSqliteDatabasePassword = [FLEXManager sharedManager].defaultSqliteDatabasePassword;
@@ -117,7 +117,7 @@ static NSString *const QUERY_TABLENAMES_SQL = @"SELECT name FROM sqlite_master W
     [self open];
     NSMutableArray<NSDictionary<NSString *, id> *> *resultArray = [NSMutableArray array];
     sqlite3_stmt *pstmt;
-    if (sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pstmt, 0) == SQLITE_OK) {
+    if (sqlite3_prepare_v2(_db, sql.UTF8String, -1, &pstmt, 0) == SQLITE_OK) {
         while (sqlite3_step(pstmt) == SQLITE_ROW) {
             NSUInteger num_cols = (NSUInteger)sqlite3_data_count(pstmt);
             if (num_cols > 0) {

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

@@ -18,7 +18,7 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        self.backgroundColor = [UIColor whiteColor];
+        self.backgroundColor = UIColor.whiteColor;
         
         UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, frame.size.width - 25, frame.size.height)];
         label.font = [UIFont systemFontOfSize:13.0];

+ 3 - 3
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentCell.m

@@ -24,10 +24,10 @@
         NSMutableArray<UILabel *> *labels = [NSMutableArray array];
         for (int i = 0; i < number ; i++) {
             UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
-            label.backgroundColor = [UIColor whiteColor];
+            label.backgroundColor = UIColor.whiteColor;
             label.font            = [UIFont systemFontOfSize:13.0];
             label.textAlignment   = NSTextAlignmentLeft;
-            label.backgroundColor = [UIColor greenColor];
+            label.backgroundColor = UIColor.greenColor;
             [labels addObject:label];
             
             UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:cell
@@ -36,7 +36,7 @@
             label.userInteractionEnabled = YES;
             
             [cell.contentView addSubview:label];
-            cell.contentView.backgroundColor = [UIColor whiteColor];
+            cell.contentView.backgroundColor = UIColor.whiteColor;
         }
         cell.labels = labels;
     }

+ 2 - 2
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentViewController.m

@@ -40,7 +40,7 @@
                            CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
         
         _multiColumnView.autoresizingMask          = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
-        _multiColumnView.backgroundColor           = [UIColor whiteColor];
+        _multiColumnView.backgroundColor           = UIColor.whiteColor;
         _multiColumnView.dataSource                = self;
         _multiColumnView.delegate                  = self;
     }
@@ -152,7 +152,7 @@
     }];
     if (sortType == FLEXTableColumnHeaderSortTypeDesc) {
         NSEnumerator *contentReverseEnumerator = [sortContentData reverseObjectEnumerator];
-        sortContentData = [NSArray arrayWithArray:[contentReverseEnumerator allObjects]];
+        sortContentData = [NSArray arrayWithArray:contentReverseEnumerator.allObjects];
     }
     
     self.contentsArray = sortContentData;

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

@@ -20,7 +20,7 @@
         UILabel *textLabel               = [[UILabel alloc] initWithFrame:CGRectZero];
         textLabel.textAlignment          = NSTextAlignmentCenter;
         textLabel.font                   = [UIFont systemFontOfSize:13.0];
-        textLabel.backgroundColor = [UIColor clearColor];
+        textLabel.backgroundColor = UIColor.clearColor;
         [cell.contentView addSubview:textLabel];
         cell.titlelabel = textLabel;
     }

+ 1 - 1
Classes/GlobalStateExplorers/FLEXAddressExplorerCoordinator.m

@@ -44,7 +44,7 @@
             [host tryExploreAddress:address safely:action.style == UIAlertActionStyleDefault];
         };
         [addressInput addTextFieldWithConfigurationHandler:^(UITextField *textField) {
-            NSString *copied = [UIPasteboard generalPasteboard].string;
+            NSString *copied = UIPasteboard.generalPasteboard.string;
             textField.placeholder = @"0x00000070deadbeef";
             // Go ahead and paste our clipboard if we have an address copied
             if ([copied hasPrefix:@"0x"]) {

+ 5 - 5
Classes/GlobalStateExplorers/FLEXClassesTableViewController.m

@@ -46,7 +46,7 @@
 - (void)loadClassNames
 {
     unsigned int classNamesCount = 0;
-    const char **classNames = objc_copyClassNamesForImage([self.binaryImageName UTF8String], &classNamesCount);
+    const char **classNames = objc_copyClassNamesForImage(self.binaryImageName.UTF8String, &classNamesCount);
     if (classNames) {
         NSMutableArray<NSString *> *classNameStrings = [NSMutableArray array];
         for (unsigned int i = 0; i < classNamesCount; i++) {
@@ -64,7 +64,7 @@
 - (void)updateTitle
 {
     NSString *shortImageName = self.binaryImageName.lastPathComponent;
-    self.title = [NSString stringWithFormat:@"%@ Classes (%lu)", shortImageName, (unsigned long)[self.filteredClassNames count]];
+    self.title = [NSString stringWithFormat:@"%@ Classes (%lu)", shortImageName, (unsigned long)self.filteredClassNames.count];
 }
 
 
@@ -86,7 +86,7 @@
 
 - (void)updateSearchResults:(NSString *)searchText
 {
-    if ([searchText length] > 0) {
+    if (searchText.length > 0) {
         NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[cd] %@", searchText];
         self.filteredClassNames = [self.classNames filteredArrayUsingPredicate:searchPredicate];
     } else {
@@ -106,7 +106,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return [self.filteredClassNames count];
+    return self.filteredClassNames.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -130,7 +130,7 @@
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     NSString *className = self.filteredClassNames[indexPath.row];
-    Class selectedClass = objc_getClass([className UTF8String]);
+    Class selectedClass = objc_getClass(className.UTF8String);
     FLEXObjectExplorerViewController *objectExplorer = [FLEXObjectExplorerFactory explorerViewControllerForObject:selectedClass];
     [self.navigationController pushViewController:objectExplorer animated:YES];
 }

+ 2 - 2
Classes/GlobalStateExplorers/FLEXCookiesTableViewController.m

@@ -25,7 +25,7 @@
         self.title = @"Cookies";
 
         NSSortDescriptor *nameSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)];
-        _cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage].cookies sortedArrayUsingDescriptors:@[nameSortDescriptor]];
+        _cookies = [NSHTTPCookieStorage.sharedHTTPCookieStorage.cookies sortedArrayUsingDescriptors:@[nameSortDescriptor]];
     }
     
     return self;
@@ -50,7 +50,7 @@
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
         cell.textLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
         cell.detailTextLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
-        cell.detailTextLabel.textColor = [UIColor grayColor];
+        cell.detailTextLabel.textColor = UIColor.grayColor;
         cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
     }
     

+ 3 - 3
Classes/GlobalStateExplorers/FLEXInstancesTableViewController.m

@@ -57,7 +57,7 @@
 
 + (instancetype)instancesTableViewControllerForClassName:(NSString *)className
 {
-    const char *classNameCString = [className UTF8String];
+    const char *classNameCString = className.UTF8String;
     NSMutableArray *instances = [NSMutableArray array];
     [FLEXHeapEnumerator enumerateLiveObjectsUsingBlock:^(__unsafe_unretained id object, __unsafe_unretained Class actualClass) {
         if (strcmp(classNameCString, class_getName(actualClass)) == 0) {
@@ -71,7 +71,7 @@
     }];
     NSArray<FLEXObjectRef *> *references = [FLEXObjectRef referencingAll:instances];
     FLEXInstancesTableViewController *viewController = [[self alloc] initWithReferences:references];
-    viewController.title = [NSString stringWithFormat:@"%@ (%lu)", className, (unsigned long)[instances count]];
+    viewController.title = [NSString stringWithFormat:@"%@ (%lu)", className, (unsigned long)instances.count];
     return viewController;
 }
 
@@ -209,7 +209,7 @@
         UIFont *cellFont = [FLEXUtility defaultTableViewCellLabelFont];
         cell.textLabel.font = cellFont;
         cell.detailTextLabel.font = cellFont;
-        cell.detailTextLabel.textColor = [UIColor grayColor];
+        cell.detailTextLabel.textColor = UIColor.grayColor;
     }
 
     FLEXObjectRef *row = self.sections[indexPath.section][indexPath.row];

+ 2 - 2
Classes/GlobalStateExplorers/FLEXLiveObjectsTableViewController.m

@@ -45,7 +45,7 @@ static const NSInteger kFLEXLiveObjectsSortBySizeIndex = 2;
 
 - (NSArray<NSString *> *)allClassNames
 {
-    return [self.instanceCountsForClassNames allKeys];
+    return self.instanceCountsForClassNames.allKeys;
 }
 
 - (void)reloadTableData
@@ -186,7 +186,7 @@ static const NSInteger kFLEXLiveObjectsSortBySizeIndex = 2;
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return [self.filteredClassNames count];
+    return self.filteredClassNames.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

+ 2 - 2
Classes/GlobalStateExplorers/FLEXWebViewController.m

@@ -70,14 +70,14 @@
     self.webView.frame = self.view.bounds;
     self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     
-    if ([self.originalText length] > 0) {
+    if (self.originalText.length > 0) {
         self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Copy" style:UIBarButtonItemStylePlain target:self action:@selector(copyButtonTapped:)];
     }
 }
 
 - (void)copyButtonTapped:(id)sender
 {
-    [[UIPasteboard generalPasteboard] setString:self.originalText];
+    [UIPasteboard.generalPasteboard setString:self.originalText];
 }
 
 

+ 4 - 4
Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserFileOperationController.m

@@ -39,7 +39,7 @@
 - (void)show
 {
     BOOL isDirectory = NO;
-    BOOL stillExists = [[NSFileManager defaultManager] fileExistsAtPath:self.path isDirectory:&isDirectory];
+    BOOL stillExists = [NSFileManager.defaultManager fileExistsAtPath:self.path isDirectory:&isDirectory];
 
     if (stillExists) {
         UIAlertView *deleteWarning = [[UIAlertView alloc]
@@ -61,7 +61,7 @@
     if (buttonIndex == alertView.cancelButtonIndex) {
         // Nothing, just cancel
     } else if (buttonIndex == alertView.firstOtherButtonIndex) {
-        [[NSFileManager defaultManager] removeItemAtPath:self.path error:NULL];
+        [NSFileManager.defaultManager removeItemAtPath:self.path error:NULL];
     }
 }
 
@@ -102,7 +102,7 @@
 - (void)show
 {
     BOOL isDirectory = NO;
-    BOOL stillExists = [[NSFileManager defaultManager] fileExistsAtPath:self.path isDirectory:&isDirectory];
+    BOOL stillExists = [NSFileManager.defaultManager fileExistsAtPath:self.path isDirectory:&isDirectory];
 
     if (stillExists) {
         UIAlertView *renameDialog = [[UIAlertView alloc]
@@ -130,7 +130,7 @@
     } else if (buttonIndex == alertView.firstOtherButtonIndex) {
         NSString *newFileName = [alertView textFieldAtIndex:0].text;
         NSString *newPath = [[self.path stringByDeletingLastPathComponent] stringByAppendingPathComponent:newFileName];
-        [[NSFileManager defaultManager] moveItemAtPath:self.path toPath:newPath error:NULL];
+        [NSFileManager.defaultManager moveItemAtPath:self.path toPath:newPath error:NULL];
     }
 }
 

+ 4 - 4
Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserSearchOperation.m

@@ -17,7 +17,7 @@
 
 - (id)flex_pop
 {
-    id anObject = [self lastObject];
+    id anObject = self.lastObject;
     [self removeLastObject];
     return anObject;
 }
@@ -37,7 +37,7 @@
 
 - (uint64_t)totalSizeAtPath:(NSString *)path
 {
-    NSFileManager *fileManager = [NSFileManager defaultManager];
+    NSFileManager *fileManager = NSFileManager.defaultManager;
     NSDictionary<NSString *, id> *attributes = [fileManager attributesOfItemAtPath:path error:NULL];
     uint64_t totalSize = [attributes fileSize];
     
@@ -64,7 +64,7 @@
 
 - (void)main
 {
-    NSFileManager *fileManager = [NSFileManager defaultManager];
+    NSFileManager *fileManager = NSFileManager.defaultManager;
     NSMutableArray<NSString *> *searchPaths = [NSMutableArray array];
     NSMutableDictionary<NSString *, NSNumber *> *sizeMapping = [NSMutableDictionary dictionary];
     uint64_t totalSize = 0;
@@ -72,7 +72,7 @@
     [stack flex_push:self.path];
     
     //recursive found all match searchString paths, and precomputing there size
-    while ([stack count]) {
+    while (stack.count) {
         NSString *currentPath = [stack flex_pop];
         NSArray<NSString *> *directoryPath = [fileManager contentsOfDirectoryAtPath:currentPath error:nil];
         

+ 12 - 12
Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserTableViewController.m

@@ -50,7 +50,7 @@
         //computing path size
         FLEXFileBrowserTableViewController *__weak weakSelf = self;
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            NSFileManager *fileManager = [NSFileManager defaultManager];
+            NSFileManager *fileManager = NSFileManager.defaultManager;
             NSDictionary<NSString *, id> *attributes = [fileManager attributesOfItemAtPath:path error:NULL];
             uint64_t totalSize = [attributes fileSize];
 
@@ -144,7 +144,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return self.searchController.isActive ? [self.searchPaths count] : [self.childPaths count];
+    return self.searchController.isActive ? self.searchPaths.count : self.childPaths.count;
 }
 
 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
@@ -160,17 +160,17 @@
         sizeString = [NSByteCountFormatter stringFromByteCount:[currentSize longLongValue] countStyle:NSByteCountFormatterCountStyleFile];
     }
 
-    return [NSString stringWithFormat:@"%lu files (%@)", (unsigned long)[currentPaths count], sizeString];
+    return [NSString stringWithFormat:@"%lu files (%@)", (unsigned long)currentPaths.count, sizeString];
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     NSString *fullPath = [self filePathAtIndexPath:indexPath];
-    NSDictionary<NSString *, id> *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:fullPath error:NULL];
+    NSDictionary<NSString *, id> *attributes = [NSFileManager.defaultManager attributesOfItemAtPath:fullPath error:NULL];
     BOOL isDirectory = [attributes.fileType isEqual:NSFileTypeDirectory];
     NSString *subtitle = nil;
     if (isDirectory) {
-        NSUInteger count = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:fullPath error:NULL] count];
+        NSUInteger count = [NSFileManager.defaultManager contentsOfDirectoryAtPath:fullPath error:NULL].count;
         subtitle = [NSString stringWithFormat:@"%lu item%@", (unsigned long)count, (count == 1 ? @"" : @"s")];
     } else {
         NSString *sizeString = [NSByteCountFormatter stringFromByteCount:attributes.fileSize countStyle:NSByteCountFormatterCountStyleFile];
@@ -189,7 +189,7 @@
         cell = [[FLEXFileBrowserTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
         cell.textLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
         cell.detailTextLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
-        cell.detailTextLabel.textColor = [UIColor grayColor];
+        cell.detailTextLabel.textColor = UIColor.grayColor;
         cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
     }
     NSString *cellTitle = [fullPath lastPathComponent];
@@ -213,7 +213,7 @@
     NSString *pathExtension = subpath.pathExtension;
 
     BOOL isDirectory = NO;
-    BOOL stillExists = [[NSFileManager defaultManager] fileExistsAtPath:fullPath isDirectory:&isDirectory];
+    BOOL stillExists = [NSFileManager.defaultManager fileExistsAtPath:fullPath isDirectory:&isDirectory];
     UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
     UIImage *image = cell.imageView.image;
 
@@ -293,7 +293,7 @@
     UIMenuItem *copyPath = [[UIMenuItem alloc] initWithTitle:@"Copy Path" action:@selector(fileBrowserCopyPath:)];
     UIMenuItem *share = [[UIMenuItem alloc] initWithTitle:@"Share" action:@selector(fileBrowserShare:)];
 
-    [UIMenuController sharedMenuController].menuItems = @[rename, delete, copyPath, share];
+    UIMenuController.sharedMenuController.menuItems = @[rename, delete, copyPath, share];
 
     return YES;
 }
@@ -353,7 +353,7 @@
 {
     NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
     NSString *fullPath = [self filePathAtIndexPath:indexPath];
-    [UIPasteboard generalPasteboard].string = fullPath;
+    UIPasteboard.generalPasteboard.string = fullPath;
 }
 
 - (void)fileBrowserShare:(UITableViewCell *)sender
@@ -363,7 +363,7 @@
     NSURL *filePath = [NSURL fileURLWithPath:pathString];
 
     BOOL isDirectory = NO;
-    [[NSFileManager defaultManager] fileExistsAtPath:pathString isDirectory:&isDirectory];
+    [NSFileManager.defaultManager fileExistsAtPath:pathString isDirectory:&isDirectory];
 
     if (isDirectory) {
         // UIDocumentInteractionController for folders
@@ -388,7 +388,7 @@
 - (void)reloadCurrentPath
 {
     NSMutableArray<NSString *> *childPaths = [NSMutableArray array];
-    NSArray<NSString *> *subpaths = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self.path error:NULL];
+    NSArray<NSString *> *subpaths = [NSFileManager.defaultManager contentsOfDirectoryAtPath:self.path error:NULL];
     for (NSString *subpath in subpaths) {
         [childPaths addObject:[self.path stringByAppendingPathComponent:subpath]];
     }
@@ -420,7 +420,7 @@
 - (void)forwardAction:(SEL)action withSender:(id)sender
 {
     id target = [self.nextResponder targetForAction:action withSender:sender];
-    [[UIApplication sharedApplication] sendAction:action to:target from:self forEvent:nil];
+    [UIApplication.sharedApplication sendAction:action to:target from:self forEvent:nil];
 }
 
 - (void)fileBrowserRename:(UIMenuController *)sender

+ 1 - 1
Classes/GlobalStateExplorers/SystemLog/FLEXASLLogController.m

@@ -120,7 +120,7 @@
 {
     static NSString *pidString = nil;
     if (!pidString) {
-        pidString = @([[NSProcessInfo processInfo] processIdentifier]).stringValue;
+        pidString = @([NSProcessInfo.processInfo processIdentifier]).stringValue;
     }
 
     // Create system log query object.

+ 1 - 1
Classes/GlobalStateExplorers/SystemLog/FLEXOSLogController.h

@@ -8,7 +8,7 @@
 
 #import "FLEXLogController.h"
 
-#define FLEXOSLogAvailable() ([NSProcessInfo processInfo].operatingSystemVersion.majorVersion >= 10)
+#define FLEXOSLogAvailable() (NSProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 10)
 
 extern NSString * const kFLEXiOSPersistentOSLogKey;
 

+ 1 - 1
Classes/GlobalStateExplorers/SystemLog/FLEXOSLogController.m

@@ -73,7 +73,7 @@ static uint8_t (*OSLogGetType)(void *);
 
     self = [super init];
     if (self) {
-        _filterPid = [NSProcessInfo processInfo].processIdentifier;
+        _filterPid = NSProcessInfo.processInfo.processIdentifier;
         _levelInfo = NO;
         _subsystemInfo = NO;
     }

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

@@ -77,9 +77,9 @@ static const UIEdgeInsets kFLEXLogMessageCellInsets = {10.0, 10.0, 10.0, 10.0};
     NSDictionary<NSString *, id> *attributes = @{ NSFontAttributeName : [UIFont fontWithName:@"CourierNewPSMT" size:12.0] };
     NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes];
 
-    if ([highlightedText length] > 0) {
+    if (highlightedText.length > 0) {
         NSMutableAttributedString *mutableAttributedText = [attributedText mutableCopy];
-        NSMutableDictionary<NSString *, id> *highlightAttributes = [@{ NSBackgroundColorAttributeName : [UIColor yellowColor] } mutableCopy];
+        NSMutableDictionary<NSString *, id> *highlightAttributes = [@{ NSBackgroundColorAttributeName : UIColor.yellowColor } mutableCopy];
         [highlightAttributes addEntriesFromDictionary:attributes];
         
         NSRange remainingSearchRange = NSMakeRange(0, text.length);

+ 1 - 1
Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.m

@@ -175,7 +175,7 @@
 {
     if (action == @selector(copy:)) {
         // We usually only want to copy the log message itself, not any metadata associated with it.
-        [UIPasteboard generalPasteboard].string = [self logMessageAtIndexPath:indexPath].messageText;
+        UIPasteboard.generalPasteboard.string = [self logMessageAtIndexPath:indexPath].messageText;
     }
 }
 

+ 14 - 12
Classes/Manager/FLEXManager.m

@@ -57,7 +57,7 @@
     NSAssert([NSThread isMainThread], @"You must use %@ from the main thread only.", NSStringFromClass([self class]));
     
     if (!_explorerWindow) {
-        _explorerWindow = [[FLEXWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+        _explorerWindow = [[FLEXWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
         _explorerWindow.eventDelegate = self;
         _explorerWindow.rootViewController = self.explorerViewController;
     }
@@ -82,7 +82,7 @@
     if (@available(iOS 13.0, *)) {
         // Only look for a new scene if the one we have isn't the active scene
         if (self.explorerWindow.windowScene.activationState != UISceneActivationStateForegroundActive) {
-            for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
+            for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
                 // Look for an active UIWindowScene
                 if (scene.activationState == UISceneActivationStateForegroundActive &&
                     [scene isKindOfClass:[UIWindowScene class]]) {
@@ -108,15 +108,15 @@
     }
 }
 
-#if FLEX_AT_LEAST_IOS13_SDK
 - (void)showExplorerFromScene:(UIWindowScene *)scene
 {
+    #if FLEX_AT_LEAST_IOS13_SDK
     if (@available(iOS 13.0, *)) {
         self.explorerWindow.windowScene = scene;
     }
+    #endif
     self.explorerWindow.hidden = NO;
 }
-#endif
 
 - (BOOL)isHidden
 {
@@ -328,7 +328,7 @@
 - (void)tryScrollDown
 {
     UIScrollView *firstScrollView = [self firstScrollView];
-    CGPoint contentOffset = [firstScrollView contentOffset];
+    CGPoint contentOffset = firstScrollView.contentOffset;
     CGFloat distance = floor(firstScrollView.frame.size.height / 2.0);
     CGFloat maxContentOffsetY = firstScrollView.contentSize.height + firstScrollView.contentInset.bottom - firstScrollView.frame.size.height;
     distance = MIN(maxContentOffsetY - firstScrollView.contentOffset.y, distance);
@@ -339,7 +339,7 @@
 - (void)tryScrollUp
 {
     UIScrollView *firstScrollView = [self firstScrollView];
-    CGPoint contentOffset = [firstScrollView contentOffset];
+    CGPoint contentOffset = firstScrollView.contentOffset;
     CGFloat distance = floor(firstScrollView.frame.size.height / 2.0);
     CGFloat minContentOffsetY = -firstScrollView.contentInset.top;
     distance = MIN(firstScrollView.contentOffset.y - minContentOffsetY, distance);
@@ -349,16 +349,16 @@
 
 - (UIScrollView *)firstScrollView
 {
-    NSMutableArray<UIView *> *views = [[[[UIApplication sharedApplication] keyWindow] subviews] mutableCopy];
+    NSMutableArray<UIView *> *views = [UIApplication.sharedApplication.keyWindow.subviews mutableCopy];
     UIScrollView *scrollView = nil;
-    while ([views count] > 0) {
-        UIView *view = [views firstObject];
+    while (views.count > 0) {
+        UIView *view = views.firstObject;
         [views removeObjectAtIndex:0];
         if ([view isKindOfClass:[UIScrollView class]]) {
             scrollView = (UIScrollView *)view;
             break;
         } else {
-            [views addObjectsFromArray:[view subviews]];
+            [views addObjectsFromArray:view.subviews];
         }
     }
     return scrollView;
@@ -378,7 +378,7 @@
 
 - (UIViewController *)topViewController
 {
-    UIViewController *topViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
+    UIViewController *topViewController = [[UIApplication.sharedApplication keyWindow] rootViewController];
     while ([topViewController presentedViewController]) {
         topViewController = [topViewController presentedViewController];
     }
@@ -388,7 +388,9 @@
 - (void)toggleTopViewControllerOfClass:(Class)class
 {
     UIViewController *topViewController = [self topViewController];
-    if ([topViewController isKindOfClass:[UINavigationController class]] && [[[(UINavigationController *)topViewController viewControllers] firstObject] isKindOfClass:[class class]]) {
+    if ([topViewController isKindOfClass:[UINavigationController class]] &&
+        [[(UINavigationController *)topViewController viewControllers].firstObject isKindOfClass:[class class]])
+    {
         [[topViewController presentingViewController] dismissViewControllerAnimated:YES completion:nil];
     } else {
         id viewController = [[class alloc] init];

+ 1 - 1
Classes/Network/FLEXNetworkCurlLogger.m

@@ -18,7 +18,7 @@
         [curlCommandString appendFormat:@"-H \'%@: %@\' ", key, val];
     }];
 
-    NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:request.URL];
+    NSArray<NSHTTPCookie *> *cookies = [NSHTTPCookieStorage.sharedHTTPCookieStorage cookiesForURL:request.URL];
     if (cookies) {
         [curlCommandString appendFormat:@"-H \'Cookie:"];
         for (NSHTTPCookie *cookie in cookies) {

+ 11 - 11
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -34,10 +34,10 @@
 {
     self = [super initWithStyle:UITableViewStylePlain];
     if (self) {
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNewTransactionRecordedNotification:) name:kFLEXNetworkRecorderNewTransactionNotification object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTransactionsClearedNotification:) name:kFLEXNetworkRecorderTransactionsClearedNotification object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNetworkObserverEnabledStateChangedNotification:) name:kFLEXNetworkObserverEnabledStateChangedNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleNewTransactionRecordedNotification:) name:kFLEXNetworkRecorderNewTransactionNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleTransactionsClearedNotification:) name:kFLEXNetworkRecorderTransactionsClearedNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleNetworkObserverEnabledStateChangedNotification:) name:kFLEXNetworkObserverEnabledStateChangedNotification object:nil];
         self.title = @"📡  Network";
         self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStylePlain target:self action:@selector(settingsButtonTapped:)];
 
@@ -50,7 +50,7 @@
 
 - (void)dealloc
 {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [NSNotificationCenter.defaultCenter removeObserver:self];
 }
 
 - (void)viewDidLoad
@@ -140,10 +140,10 @@
         NSInteger totalRequests = 0;
         if (self.searchController.isActive) {
             bytesReceived = self.filteredBytesReceived;
-            totalRequests = [self.filteredNetworkTransactions count];
+            totalRequests = self.filteredNetworkTransactions.count;
         } else {
             bytesReceived = self.bytesReceived;
-            totalRequests = [self.networkTransactions count];
+            totalRequests = self.networkTransactions.count;
         }
         NSString *byteCountText = [NSByteCountFormatter stringFromByteCount:bytesReceived countStyle:NSByteCountFormatterCountStyleBinary];
         NSString *requestsText = totalRequests == 1 ? @"Request" : @"Requests";
@@ -185,9 +185,9 @@
         return;
     }
 
-    NSInteger existingRowCount = [self.networkTransactions count];
+    NSInteger existingRowCount = self.networkTransactions.count;
     [self updateTransactions];
-    NSInteger newRowCount = [self.networkTransactions count];
+    NSInteger newRowCount = self.networkTransactions.count;
     NSInteger addedRowCount = newRowCount - existingRowCount;
 
     if (addedRowCount != 0 && !self.isPresentingSearch) {
@@ -259,7 +259,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return self.searchController.isActive ? [self.filteredNetworkTransactions count] : [self.networkTransactions count];
+    return self.searchController.isActive ? self.filteredNetworkTransactions.count : self.networkTransactions.count;
 }
 
 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
@@ -315,7 +315,7 @@
     if (action == @selector(copy:)) {
         FLEXNetworkTransaction *transaction = [self transactionAtIndexPath:indexPath inTableView:tableView];
         NSString *requestURLString = transaction.request.URL.absoluteString ?: @"";
-        [[UIPasteboard generalPasteboard] setString:requestURLString];
+        [UIPasteboard.generalPasteboard setString:requestURLString];
     }
 }
 

+ 7 - 7
Classes/Network/FLEXNetworkRecorder.m

@@ -95,7 +95,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
         [self.orderedTransactions removeAllObjects];
         [self.networkTransactionsForRequestIdentifiers removeAllObjects];
         dispatch_async(dispatch_get_main_queue(), ^{
-            [[NSNotificationCenter defaultCenter] postNotificationName:kFLEXNetworkRecorderTransactionsClearedNotification object:self];
+            [NSNotificationCenter.defaultCenter postNotificationName:kFLEXNetworkRecorderTransactionsClearedNotification object:self];
         });
     });
 }
@@ -173,7 +173,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
         transaction.transactionState = FLEXNetworkTransactionStateFinished;
         transaction.duration = -[transaction.startTime timeIntervalSinceDate:finishedDate];
 
-        BOOL shouldCache = [responseBody length] > 0;
+        BOOL shouldCache = responseBody.length > 0;
         if (!self.shouldCacheMediaResponses) {
             NSArray<NSString *> *ignoredMIMETypePrefixes = @[ @"audio", @"image", @"video" ];
             for (NSString *ignoredPrefix in ignoredMIMETypePrefixes) {
@@ -182,14 +182,14 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
         }
         
         if (shouldCache) {
-            [self.responseCache setObject:responseBody forKey:requestID cost:[responseBody length]];
+            [self.responseCache setObject:responseBody forKey:requestID cost:responseBody.length];
         }
 
         NSString *mimeType = transaction.response.MIMEType;
-        if ([mimeType hasPrefix:@"image/"] && [responseBody length] > 0) {
+        if ([mimeType hasPrefix:@"image/"] && responseBody.length > 0) {
             // Thumbnail image previews on a separate background queue
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                NSInteger maxPixelDimension = [[UIScreen mainScreen] scale] * 32.0;
+                NSInteger maxPixelDimension = UIScreen.mainScreen.scale * 32.0;
                 transaction.responseThumbnail = [FLEXUtility thumbnailedImageWithMaxPixelDimension:maxPixelDimension fromImageData:responseBody];
                 [self postUpdateNotificationForTransaction:transaction];
             });
@@ -253,7 +253,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
 {
     dispatch_async(dispatch_get_main_queue(), ^{
         NSDictionary<NSString *, id> *userInfo = @{ kFLEXNetworkRecorderUserInfoTransactionKey : transaction };
-        [[NSNotificationCenter defaultCenter] postNotificationName:kFLEXNetworkRecorderNewTransactionNotification object:self userInfo:userInfo];
+        [NSNotificationCenter.defaultCenter postNotificationName:kFLEXNetworkRecorderNewTransactionNotification object:self userInfo:userInfo];
     });
 }
 
@@ -261,7 +261,7 @@ NSString *const kFLEXNetworkRecorderResponseCacheLimitDefaultsKey = @"com.flex.r
 {
     dispatch_async(dispatch_get_main_queue(), ^{
         NSDictionary<NSString *, id> *userInfo = @{ kFLEXNetworkRecorderUserInfoTransactionKey : transaction };
-        [[NSNotificationCenter defaultCenter] postNotificationName:kFLEXNetworkRecorderTransactionUpdatedNotification object:self userInfo:userInfo];
+        [NSNotificationCenter.defaultCenter postNotificationName:kFLEXNetworkRecorderTransactionUpdatedNotification object:self userInfo:userInfo];
     });
 }
 

+ 2 - 2
Classes/Network/FLEXNetworkSettingsTableViewController.m

@@ -87,7 +87,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return [self.cells count];
+    return self.cells.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
@@ -134,7 +134,7 @@
     UIButton *actionButton = [UIButton buttonWithType:UIButtonTypeSystem];
     [actionButton setTitle:title forState:UIControlStateNormal];
     if (isDestructive) {
-        actionButton.tintColor = [UIColor redColor];
+        actionButton.tintColor = UIColor.redColor;
     }
     actionButton.titleLabel.font = [[self class] cellTitleFont];
     [actionButton addTarget:self action:@selector(clearRequestsTapped:) forControlEvents:UIControlEventTouchUpInside];

+ 20 - 20
Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

@@ -55,7 +55,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     // Force grouped style
     self = [super initWithStyle:UITableViewStyleGrouped];
     if (self) {
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
+        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
         self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Copy curl" style:UIBarButtonItemStylePlain target:self action:@selector(copyButtonPressed:)];
     }
     return self;
@@ -90,23 +90,23 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     NSMutableArray<FLEXNetworkDetailSection *> *sections = [NSMutableArray array];
 
     FLEXNetworkDetailSection *generalSection = [[self class] generalSectionForTransaction:self.transaction];
-    if ([generalSection.rows count] > 0) {
+    if (generalSection.rows.count > 0) {
         [sections addObject:generalSection];
     }
     FLEXNetworkDetailSection *requestHeadersSection = [[self class] requestHeadersSectionForTransaction:self.transaction];
-    if ([requestHeadersSection.rows count] > 0) {
+    if (requestHeadersSection.rows.count > 0) {
         [sections addObject:requestHeadersSection];
     }
     FLEXNetworkDetailSection *queryParametersSection = [[self class] queryParametersSectionForTransaction:self.transaction];
-    if ([queryParametersSection.rows count] > 0) {
+    if (queryParametersSection.rows.count > 0) {
         [sections addObject:queryParametersSection];
     }
     FLEXNetworkDetailSection *postBodySection = [[self class] postBodySectionForTransaction:self.transaction];
-    if ([postBodySection.rows count] > 0) {
+    if (postBodySection.rows.count > 0) {
         [sections addObject:postBodySection];
     }
     FLEXNetworkDetailSection *responseHeadersSection = [[self class] responseHeadersSectionForTransaction:self.transaction];
-    if ([responseHeadersSection.rows count] > 0) {
+    if (responseHeadersSection.rows.count > 0) {
         [sections addObject:responseHeadersSection];
     }
 
@@ -123,20 +123,20 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
 - (void)copyButtonPressed:(id)sender
 {
-    [[UIPasteboard generalPasteboard] setString:[FLEXNetworkCurlLogger curlCommandString:_transaction.request]];
+    [UIPasteboard.generalPasteboard setString:[FLEXNetworkCurlLogger curlCommandString:_transaction.request]];
 }
 
 #pragma mark - Table view data source
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
 {
-    return [self.sections count];
+    return self.sections.count;
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
     FLEXNetworkDetailSection *sectionModel = self.sections[section];
-    return [sectionModel.rows count];
+    return sectionModel.rows.count;
 }
 
 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
@@ -204,7 +204,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 {
     if (action == @selector(copy:)) {
         FLEXNetworkDetailRow *row = [self rowModelAtIndexPath:indexPath];
-        [[UIPasteboard generalPasteboard] setString:row.detailText];
+        [UIPasteboard.generalPasteboard setString:row.detailText];
     }
 }
 
@@ -248,10 +248,10 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     requestMethodRow.detailText = transaction.request.HTTPMethod;
     [rows addObject:requestMethodRow];
 
-    if ([transaction.cachedRequestBody length] > 0) {
+    if (transaction.cachedRequestBody.length > 0) {
         FLEXNetworkDetailRow *postBodySizeRow = [[FLEXNetworkDetailRow alloc] init];
         postBodySizeRow.title = @"Request Body Size";
-        postBodySizeRow.detailText = [NSByteCountFormatter stringFromByteCount:[transaction.cachedRequestBody length] countStyle:NSByteCountFormatterCountStyleBinary];
+        postBodySizeRow.detailText = [NSByteCountFormatter stringFromByteCount:transaction.cachedRequestBody.length countStyle:NSByteCountFormatterCountStyleBinary];
         [rows addObject:postBodySizeRow];
 
         FLEXNetworkDetailRow *postBodyRow = [[FLEXNetworkDetailRow alloc] init];
@@ -272,7 +272,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     }
 
     NSString *statusCodeString = [FLEXUtility statusCodeStringFromURLResponse:transaction.response];
-    if ([statusCodeString length] > 0) {
+    if (statusCodeString.length > 0) {
         FLEXNetworkDetailRow *statusCodeRow = [[FLEXNetworkDetailRow alloc] init];
         statusCodeRow.title = @"Status Code";
         statusCodeRow.detailText = statusCodeString;
@@ -289,7 +289,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     FLEXNetworkDetailRow *responseBodyRow = [[FLEXNetworkDetailRow alloc] init];
     responseBodyRow.title = @"Response Body";
     NSData *responseData = [[FLEXNetworkRecorder defaultRecorder] cachedResponseBodyForTransaction:transaction];
-    if ([responseData length] > 0) {
+    if (responseData.length > 0) {
         responseBodyRow.detailText = @"tap to view";
         // Avoid a long lived strong reference to the response data in case we need to purge it from the cache.
         __weak NSData *weakResponseData = responseData;
@@ -380,7 +380,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 {
     FLEXNetworkDetailSection *postBodySection = [[FLEXNetworkDetailSection alloc] init];
     postBodySection.title = @"Request Body Parameters";
-    if ([transaction.cachedRequestBody length] > 0) {
+    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];
@@ -413,8 +413,8 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
 + (NSArray<FLEXNetworkDetailRow *> *)networkDetailRowsFromDictionary:(NSDictionary<NSString *, id> *)dictionary
 {
-    NSMutableArray<FLEXNetworkDetailRow *> *rows = [NSMutableArray arrayWithCapacity:[dictionary count]];
-    NSArray<NSString *> *sortedKeys = [[dictionary allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+    NSMutableArray<FLEXNetworkDetailRow *> *rows = [NSMutableArray arrayWithCapacity:dictionary.count];
+    NSArray<NSString *> *sortedKeys = [dictionary.allKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
     for (NSString *key in sortedKeys) {
         id value = dictionary[key];
         FLEXNetworkDetailRow *row = [[FLEXNetworkDetailRow alloc] init];
@@ -441,7 +441,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     UIViewController *detailViewController = nil;
     if ([FLEXUtility isValidJSONData:data]) {
         NSString *prettyJSON = [FLEXUtility prettyJSONStringFromData:data];
-        if ([prettyJSON length] > 0) {
+        if (prettyJSON.length > 0) {
             detailViewController = [[FLEXWebViewController alloc] initWithText:prettyJSON];
         }
     } else if ([mimeType hasPrefix:@"image/"]) {
@@ -455,7 +455,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     // Fall back to trying to show the response as text
     if (!detailViewController) {
         NSString *text = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-        if ([text length] > 0) {
+        if (text.length > 0) {
             detailViewController = [[FLEXWebViewController alloc] initWithText:text];
         }
     }
@@ -465,7 +465,7 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 + (NSData *)postBodyDataForTransaction:(FLEXNetworkTransaction *)transaction
 {
     NSData *bodyData = transaction.cachedRequestBody;
-    if ([bodyData length] > 0) {
+    if (bodyData.length > 0) {
         NSString *contentEncoding = [transaction.request valueForHTTPHeaderField:@"Content-Encoding"];
         if ([contentEncoding rangeOfString:@"deflate" options:NSCaseInsensitiveSearch].length > 0 || [contentEncoding rangeOfString:@"gzip" options:NSCaseInsensitiveSearch].length > 0) {
             bodyData = [FLEXUtility inflatedDataFromCompressedData:bodyData];

+ 7 - 7
Classes/Network/FLEXNetworkTransactionTableViewCell.m

@@ -41,7 +41,7 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
         [self.contentView addSubview:self.pathLabel];
 
         self.thumbnailImageView = [[UIImageView alloc] init];
-        self.thumbnailImageView.layer.borderColor = [[UIColor blackColor] CGColor];
+        self.thumbnailImageView.layer.borderColor = UIColor.blackColor.CGColor;
         self.thumbnailImageView.layer.borderWidth = 1.0;
         self.thumbnailImageView.contentMode = UIViewContentModeScaleAspectFit;
         [self.contentView addSubview:self.thumbnailImageView];
@@ -80,7 +80,7 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
     self.nameLabel.text = [self nameLabelText];
     CGSize nameLabelPreferredSize = [self.nameLabel sizeThatFits:CGSizeMake(availableTextWidth, CGFLOAT_MAX)];
     self.nameLabel.frame = CGRectMake(textOriginX, kVerticalPadding, availableTextWidth, nameLabelPreferredSize.height);
-    self.nameLabel.textColor = (self.transaction.error || [FLEXUtility isErrorStatusCodeFromURLResponse:self.transaction.response]) ? [UIColor redColor] : [FLEXColor primaryTextColor];
+    self.nameLabel.textColor = (self.transaction.error || [FLEXUtility isErrorStatusCodeFromURLResponse:self.transaction.response]) ? UIColor.redColor : [FLEXColor primaryTextColor];
 
     self.pathLabel.text = [self pathLabelText];
     CGSize pathLabelPreferredSize = [self.pathLabel sizeThatFits:CGSizeMake(availableTextWidth, CGFLOAT_MAX)];
@@ -99,7 +99,7 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
 {
     NSURL *url = self.transaction.request.URL;
     NSString *name = [url lastPathComponent];
-    if ([name length] == 0) {
+    if (name.length == 0) {
         name = @"/";
     }
     NSString *query = [url query];
@@ -113,7 +113,7 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
 {
     NSURL *url = self.transaction.request.URL;
     NSMutableArray<NSString *> *mutablePathComponents = [[url pathComponents] mutableCopy];
-    if ([mutablePathComponents count] > 0) {
+    if (mutablePathComponents.count > 0) {
         [mutablePathComponents removeLastObject];
     }
     NSString *path = [url host];
@@ -128,19 +128,19 @@ NSString *const kFLEXNetworkTransactionCellIdentifier = @"kFLEXNetworkTransactio
     NSMutableArray<NSString *> *detailComponents = [NSMutableArray array];
 
     NSString *timestamp = [[self class] timestampStringFromRequestDate:self.transaction.startTime];
-    if ([timestamp length] > 0) {
+    if (timestamp.length > 0) {
         [detailComponents addObject:timestamp];
     }
 
     // Omit method for GET (assumed as default)
     NSString *httpMethod = self.transaction.request.HTTPMethod;
-    if ([httpMethod length] > 0) {
+    if (httpMethod.length > 0) {
         [detailComponents addObject:httpMethod];
     }
 
     if (self.transaction.transactionState == FLEXNetworkTransactionStateFinished || self.transaction.transactionState == FLEXNetworkTransactionStateFailed) {
         NSString *statusCodeString = [FLEXUtility statusCodeStringFromURLResponse:self.transaction.response];
-        if ([statusCodeString length] > 0) {
+        if (statusCodeString.length > 0) {
             [detailComponents addObject:statusCodeString];
         }
 

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

@@ -90,7 +90,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
     }
     
     if (previouslyEnabled != enabled) {
-        [[NSNotificationCenter defaultCenter] postNotificationName:kFLEXNetworkObserverEnabledStateChangedNotification object:self];
+        [NSNotificationCenter.defaultCenter postNotificationName:kFLEXNetworkObserverEnabledStateChangedNotification object:self];
     }
 }
 
@@ -280,9 +280,9 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
         // In iOS 8 resume lives in NSURLSessionTask
         // In iOS 9 resume lives in __NSCFURLSessionTask
         Class class = Nil;
-        if (![[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
+        if (![NSProcessInfo.processInfo respondsToSelector:@selector(operatingSystemVersion)]) {
             class = NSClassFromString([@[@"__", @"NSC", @"FLocalS", @"ession", @"Task"] componentsJoinedByString:@""]);
-        } else if ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion < 9) {
+        } else if ([NSProcessInfo.processInfo operatingSystemVersion].majorVersion < 9) {
             class = [NSURLSessionTask class];
         } else {
             class = NSClassFromString([@[@"__", @"NSC", @"FURLS", @"ession", @"Task"] componentsJoinedByString:@""]);
@@ -322,7 +322,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
                 [[FLEXNetworkRecorder defaultRecorder] recordMechanism:mechanism forRequestID:requestID];
                 NSURLConnectionAsyncCompletion completionWrapper = ^(NSURLResponse *response, NSData *data, NSError *connectionError) {
                     [[FLEXNetworkRecorder defaultRecorder] recordResponseReceivedWithRequestID:requestID response:response];
-                    [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:[data length]];
+                    [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:data.length];
                     if (connectionError) {
                         [[FLEXNetworkRecorder defaultRecorder] recordLoadingFailedWithRequestID:requestID error:connectionError];
                     } else {
@@ -363,7 +363,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
                 NSURLResponse *temporaryResponse = nil;
                 data = ((id(*)(id, SEL, id, NSURLResponse **, NSError **))objc_msgSend)(slf, swizzledSelector, request, &temporaryResponse, &temporaryError);
                 [[FLEXNetworkRecorder defaultRecorder] recordResponseReceivedWithRequestID:requestID response:temporaryResponse];
-                [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:[data length]];
+                [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:data.length];
                 if (temporaryError) {
                     [[FLEXNetworkRecorder defaultRecorder] recordLoadingFailedWithRequestID:requestID error:temporaryError];
                 } else {
@@ -410,7 +410,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
             if ([FLEXUtility instanceRespondsButDoesNotImplementSelector:selector class:class]) {
                 // iOS 7 does not implement these methods on NSURLSession. We actually want to
                 // swizzle __NSCFURLSession, which we can get from the class of the shared session
-                class = [[NSURLSession sharedSession] class];
+                class = [NSURLSession.sharedSession class];
             }
 
             NSURLSessionTask *(^asyncDataOrDownloadSwizzleBlock)(Class, id, NSURLSessionAsyncCompletion) = ^NSURLSessionTask *(Class slf, id argument, NSURLSessionAsyncCompletion completion) {
@@ -457,7 +457,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
             if ([FLEXUtility instanceRespondsButDoesNotImplementSelector:selector class:class]) {
                 // iOS 7 does not implement these methods on NSURLSession. We actually want to
                 // swizzle __NSCFURLSession, which we can get from the class of the shared session
-                class = [[NSURLSession sharedSession] class];
+                class = [NSURLSession.sharedSession class];
             }
 
             NSURLSessionUploadTask *(^asyncUploadTaskSwizzleBlock)(Class, NSURLRequest *, id, NSURLSessionAsyncCompletion) = ^NSURLSessionUploadTask *(Class slf, NSURLRequest *request, id argument, NSURLSessionAsyncCompletion completion) {
@@ -495,7 +495,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
         } else if ([fileURLOrData isKindOfClass:[NSData class]]) {
             data = fileURLOrData;
         }
-        [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:[data length]];
+        [[FLEXNetworkRecorder defaultRecorder] recordDataReceivedWithRequestID:requestID dataLength:data.length];
         if (error) {
             [[FLEXNetworkRecorder defaultRecorder] recordLoadingFailedWithRequestID:requestID error:error];
         } else {

+ 2 - 2
Classes/ObjectExplorers/Controllers/FLEXArrayExplorerViewController.m

@@ -34,8 +34,8 @@
 - (NSArray *)customSectionRowCookies
 {
     // Use index numbers as the row cookies
-    NSMutableArray *cookies = [NSMutableArray arrayWithCapacity:[self.array count]];
-    for (NSUInteger i = 0; i < [self.array count]; i++) {
+    NSMutableArray *cookies = [NSMutableArray arrayWithCapacity:self.array.count];
+    for (NSUInteger i = 0; i < self.array.count; i++) {
         [cookies addObject:@(i)];
     }
     return cookies;

+ 1 - 1
Classes/ObjectExplorers/Controllers/FLEXBundleExplorerViewController.m

@@ -34,7 +34,7 @@ typedef NS_ENUM(NSUInteger, FLEXBundleExplorerRow) {
 {
     BOOL isDirectory = NO;
     NSString *bundlePath = self.bundleToExplore.bundlePath;
-    if ([[NSFileManager defaultManager] fileExistsAtPath:bundlePath isDirectory:&isDirectory] && isDirectory) {
+    if ([NSFileManager.defaultManager fileExistsAtPath:bundlePath isDirectory:&isDirectory] && isDirectory) {
         return [@[@(FLEXBundleExplorerRowBundlePath)] arrayByAddingObjectsFromArray:[super customSectionRowCookies]];
     }
 

+ 1 - 1
Classes/ObjectExplorers/Controllers/FLEXColorExplorerViewController.m

@@ -42,7 +42,7 @@
 - (UIView *)customViewForRowCookie:(id)rowCookie
 {
     if ([rowCookie isKindOfClass:[NSNumber class]]) {
-        CGFloat width = [UIScreen mainScreen].bounds.size.width;
+        CGFloat width = UIScreen.mainScreen.bounds.size.width;
         switch ([rowCookie integerValue]) {
             case 0: {
                 UIView *square = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 44)];

+ 1 - 1
Classes/ObjectExplorers/Controllers/FLEXDictionaryExplorerViewController.m

@@ -33,7 +33,7 @@
 
 - (NSArray *)customSectionRowCookies
 {
-    return [self.dictionary allKeys];
+    return self.dictionary.allKeys;
 }
 
 - (NSString *)customSectionTitleForRowCookie:(id)rowCookie

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

@@ -78,8 +78,8 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     if (self == [FLEXObjectExplorerViewController class]) {
         // Initialize custom menu items for entire app
         UIMenuItem *copyObjectAddress = [[UIMenuItem alloc] initWithTitle:@"Copy Address" action:@selector(copyObjectAddress:)];
-        [UIMenuController sharedMenuController].menuItems = @[copyObjectAddress];
-        [[UIMenuController sharedMenuController] update];
+        UIMenuController.sharedMenuController.menuItems = @[copyObjectAddress];
+        [UIMenuController.sharedMenuController update];
     }
 }
 
@@ -187,7 +187,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     self.title = [[object class] description];
 
     // Only refresh if the view has appeared
-    #warning TODO make .object readonly so we don't have to deal with this...
+    // TODO: make .object readonly so we don't have to deal with this...
     if (self.showsCarousel) {
         [self refreshScopeTitles];
     }
@@ -269,7 +269,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     NSArray<FLEXPropertyBox *> *candidateProperties = [self metadata:FLEXMetadataKindProperties forClassAtIndex:self.selectedScope];
     
     NSArray<FLEXPropertyBox *> *unsortedFilteredProperties = nil;
-    if ([self.filterText length] > 0) {
+    if (self.filterText.length > 0) {
         NSMutableArray<FLEXPropertyBox *> *mutableUnsortedFilteredProperties = [NSMutableArray array];
         for (FLEXPropertyBox *propertyBox in candidateProperties) {
             NSString *prettyName = [FLEXRuntimeUtility prettyNameForProperty:propertyBox.property];
@@ -345,7 +345,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
     NSArray<FLEXIvarBox *> *candidateIvars = [self metadata:FLEXMetadataKindIvars forClassAtIndex:self.selectedScope];
     
     NSArray<FLEXIvarBox *> *unsortedFilteredIvars = nil;
-    if ([self.filterText length] > 0) {
+    if (self.filterText.length > 0) {
         NSMutableArray<FLEXIvarBox *> *mutableUnsortedFilteredIvars = [NSMutableArray array];
         for (FLEXIvarBox *ivarBox in candidateIvars) {
             NSString *prettyName = [FLEXRuntimeUtility prettyNameForIvar:ivarBox.ivar];
@@ -432,7 +432,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
 {
     NSArray<FLEXMethodBox *> *candidateMethods = methods;
     NSArray<FLEXMethodBox *> *unsortedFilteredMethods = nil;
-    if ([self.filterText length] > 0) {
+    if (self.filterText.length > 0) {
         NSMutableArray<FLEXMethodBox *> *mutableUnsortedFilteredMethods = [NSMutableArray array];
         for (FLEXMethodBox *methodBox in candidateMethods) {
             NSString *prettyName = [FLEXRuntimeUtility prettyNameForMethod:methodBox.method isClassMethod:areClassMethods];
@@ -481,7 +481,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
 
 - (void)updateFilteredSuperclasses
 {
-    if ([self.filterText length] > 0) {
+    if (self.filterText.length > 0) {
         NSMutableArray<Class> *filteredSuperclasses = [NSMutableArray array];
         for (Class superclass in self.classHierarchy) {
             if ([NSStringFromClass(superclass) localizedCaseInsensitiveContainsString:self.filterText]) {
@@ -553,32 +553,32 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
             break;
             
         case FLEXObjectExplorerSectionCustom:
-            numberOfRows = [self.customSectionVisibleIndexes count];
+            numberOfRows = self.customSectionVisibleIndexes.count;
             break;
             
         case FLEXObjectExplorerSectionProperties:
-            numberOfRows = [self.filteredProperties count];
+            numberOfRows = self.filteredProperties.count;
             break;
             
         case FLEXObjectExplorerSectionIvars:
-            numberOfRows = [self.filteredIvars count];
+            numberOfRows = self.filteredIvars.count;
             break;
             
         case FLEXObjectExplorerSectionMethods:
-            numberOfRows = [self.filteredMethods count];
+            numberOfRows = self.filteredMethods.count;
             break;
             
         case FLEXObjectExplorerSectionClassMethods:
-            numberOfRows = [self.filteredClassMethods count];
+            numberOfRows = self.filteredClassMethods.count;
             break;
             
         case FLEXObjectExplorerSectionSuperclasses:
-            numberOfRows = [self.filteredSuperclasses count];
+            numberOfRows = self.filteredSuperclasses.count;
             break;
             
         case FLEXObjectExplorerSectionReferencingInstances:
             // Hide this section if there is fliter text since there's nothing searchable (only 1 row, always the same).
-            numberOfRows = [self.filterText length] == 0 ? 1 : 0;
+            numberOfRows = self.filterText.length == 0 ? 1 : 0;
             break;
     }
     return numberOfRows;
@@ -728,26 +728,26 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
             
         case FLEXObjectExplorerSectionProperties: {
             NSUInteger totalCount = [self totalCountOfMetadata:FLEXMetadataKindProperties forClassAtIndex:self.selectedScope];
-            title = [self sectionTitleWithBaseName:@"Properties" totalCount:totalCount filteredCount:[self.filteredProperties count]];
+            title = [self sectionTitleWithBaseName:@"Properties" totalCount:totalCount filteredCount:self.filteredProperties.count];
         } break;
             
         case FLEXObjectExplorerSectionIvars: {
             NSUInteger totalCount = [self totalCountOfMetadata:FLEXMetadataKindIvars forClassAtIndex:self.selectedScope];
-            title = [self sectionTitleWithBaseName:@"Ivars" totalCount:totalCount filteredCount:[self.filteredIvars count]];
+            title = [self sectionTitleWithBaseName:@"Ivars" totalCount:totalCount filteredCount:self.filteredIvars.count];
         } break;
             
         case FLEXObjectExplorerSectionMethods: {
             NSUInteger totalCount = [self totalCountOfMetadata:FLEXMetadataKindMethods forClassAtIndex:self.selectedScope];
-            title = [self sectionTitleWithBaseName:@"Methods" totalCount:totalCount filteredCount:[self.filteredMethods count]];
+            title = [self sectionTitleWithBaseName:@"Methods" totalCount:totalCount filteredCount:self.filteredMethods.count];
         } break;
             
         case FLEXObjectExplorerSectionClassMethods: {
             NSUInteger totalCount = [self totalCountOfMetadata:FLEXMetadataKindClassMethods forClassAtIndex:self.selectedScope];
-            title = [self sectionTitleWithBaseName:@"Class Methods" totalCount:totalCount filteredCount:[self.filteredClassMethods count]];
+            title = [self sectionTitleWithBaseName:@"Class Methods" totalCount:totalCount filteredCount:self.filteredClassMethods.count];
         } break;
             
         case FLEXObjectExplorerSectionSuperclasses: {
-            title = [self sectionTitleWithBaseName:@"Superclasses" totalCount:[self.classHierarchy count] filteredCount:[self.filteredSuperclasses count]];
+            title = [self sectionTitleWithBaseName:@"Superclasses" totalCount:self.classHierarchy.count filteredCount:self.filteredSuperclasses.count];
         } break;
             
         case FLEXObjectExplorerSectionReferencingInstances: {
@@ -819,7 +819,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
 {
-    return [[self visibleExplorerSections] count];
+    return [self visibleExplorerSections].count;
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -851,7 +851,7 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
             UIFont *cellFont = [FLEXUtility defaultTableViewCellLabelFont];
             cell.textLabel.font = cellFont;
             cell.detailTextLabel.font = cellFont;
-            cell.detailTextLabel.textColor = [UIColor grayColor];
+            cell.detailTextLabel.textColor = UIColor.grayColor;
         }
     }
 
@@ -963,12 +963,12 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
         stringToCopy = [stringToCopy stringByAppendingString:subtitle];
     }
 
-    [UIPasteboard generalPasteboard].string = stringToCopy;
+    UIPasteboard.generalPasteboard.string = stringToCopy;
 }
 
 - (void)copyObjectAddress:(NSIndexPath *)indexPath
 {
-    [UIPasteboard generalPasteboard].string = [FLEXUtility addressOfObject:self.object];
+    UIPasteboard.generalPasteboard.string = [FLEXUtility addressOfObject:self.object];
 }
 
 
@@ -981,8 +981,8 @@ typedef NS_ENUM(NSUInteger, FLEXMetadataKind) {
 
 - (void)updateFilteredCustomData
 {
-    NSIndexSet *filteredIndexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self.cachedCustomSectionRowCookies count])];
-    if ([self.filterText length] > 0) {
+    NSIndexSet *filteredIndexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.cachedCustomSectionRowCookies.count)];
+    if (self.filterText.length > 0) {
         filteredIndexSet = [filteredIndexSet indexesPassingTest:^BOOL(NSUInteger index, BOOL *stop) {
             BOOL matches = NO;
             NSString *rowTitle = [self customSectionTitleForRowCookie:self.cachedCustomSectionRowCookies[index]];

+ 1 - 1
Classes/ObjectExplorers/Controllers/FLEXSetExplorerViewController.m

@@ -33,7 +33,7 @@
 
 - (NSArray *)customSectionRowCookies
 {
-    return [self.set allObjects];
+    return self.set.allObjects;
 }
 
 - (NSString *)customSectionTitleForRowCookie:(id)rowCookie

+ 10 - 10
Classes/ObjectExplorers/FLEXObjectExplorerFactory.m

@@ -73,23 +73,23 @@
 {
     switch (row) {
         case FLEXGlobalsRowAppDelegate: {
-            Class cls = [[UIApplication sharedApplication].delegate class];
+            Class cls = [UIApplication.sharedApplication.delegate class];
             return [NSString stringWithFormat:@"👉  %@", cls];
         }
         case FLEXGlobalsRowProcessInfo:
-            return @"🚦  +[NSProcessInfo processInfo]";
+            return @"🚦  +NSProcessInfo.processInfo";
         case FLEXGlobalsRowUserDefaults:
             return @"💾  +[NSUserDefaults standardUserDefaults]";
         case FLEXGlobalsRowMainBundle:
             return @"📦  +[NSBundle mainBundle]";
         case FLEXGlobalsRowApplication:
-            return @"🚀  +[UIApplication sharedApplication]";
+            return @"🚀  +UIApplication.sharedApplication";
         case FLEXGlobalsRowMainScreen:
-            return @"💻  +[UIScreen mainScreen]";
+            return @"💻  +UIScreen.mainScreen";
         case FLEXGlobalsRowCurrentDevice:
             return @"📱  +[UIDevice currentDevice]";
         case FLEXGlobalsRowPasteboard:
-            return @"📋  +[UIPasteboard generalPastboard]";
+            return @"📋  +UIPasteboard.generalPastboard";
         default: return nil;
     }
 }
@@ -98,23 +98,23 @@
 {
     switch (row) {
         case FLEXGlobalsRowAppDelegate: {
-            id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
+            id<UIApplicationDelegate> appDelegate = UIApplication.sharedApplication.delegate;
             return [self explorerViewControllerForObject:appDelegate];
         }
         case FLEXGlobalsRowProcessInfo:
-            return [self explorerViewControllerForObject:[NSProcessInfo processInfo]];;
+            return [self explorerViewControllerForObject:NSProcessInfo.processInfo];;
         case FLEXGlobalsRowUserDefaults:
             return [self explorerViewControllerForObject:[NSUserDefaults standardUserDefaults]];
         case FLEXGlobalsRowMainBundle:
             return [self explorerViewControllerForObject:[NSBundle mainBundle]];
         case FLEXGlobalsRowApplication:
-            return [self explorerViewControllerForObject:[UIApplication sharedApplication]];
+            return [self explorerViewControllerForObject:UIApplication.sharedApplication];
         case FLEXGlobalsRowMainScreen:
-            return [self explorerViewControllerForObject:[UIScreen mainScreen]];
+            return [self explorerViewControllerForObject:UIScreen.mainScreen];
         case FLEXGlobalsRowCurrentDevice:
             return [self explorerViewControllerForObject:[UIDevice currentDevice]];
         case FLEXGlobalsRowPasteboard:
-            return [self explorerViewControllerForObject:[UIPasteboard generalPasteboard]];
+            return [self explorerViewControllerForObject:UIPasteboard.generalPasteboard];
         default: return nil;
     }
 }

+ 1 - 1
Classes/ObjectExplorers/Views/FLEXTableViewCell.m

@@ -30,7 +30,7 @@
         UIFont *cellFont = [FLEXUtility defaultTableViewCellLabelFont];
         self.textLabel.font = cellFont;
         self.detailTextLabel.font = cellFont;
-        self.detailTextLabel.textColor = [UIColor grayColor];
+        self.detailTextLabel.textColor = UIColor.grayColor;
     }
 
     return self;

+ 7 - 7
Classes/Toolbar/FLEXExplorerToolbar.m

@@ -43,7 +43,7 @@
         [self addSubview:self.backgroundView];
 
         self.dragHandle = [[UIView alloc] init];
-        self.dragHandle.backgroundColor = [UIColor clearColor];
+        self.dragHandle.backgroundColor = UIColor.clearColor;
         [self addSubview:self.dragHandle];
         
         UIImage *dragHandle = [FLEXResources dragHandle];
@@ -72,15 +72,15 @@
         [self addSubview:self.selectedViewDescriptionContainer];
 
         self.selectedViewDescriptionSafeAreaContainer = [[UIView alloc] init];
-        self.selectedViewDescriptionSafeAreaContainer.backgroundColor = [UIColor clearColor];
+        self.selectedViewDescriptionSafeAreaContainer.backgroundColor = UIColor.clearColor;
         [self.selectedViewDescriptionContainer addSubview:self.selectedViewDescriptionSafeAreaContainer];
         
         self.selectedViewColorIndicator = [[UIView alloc] init];
-        self.selectedViewColorIndicator.backgroundColor = [UIColor redColor];
+        self.selectedViewColorIndicator.backgroundColor = UIColor.redColor;
         [self.selectedViewDescriptionSafeAreaContainer addSubview:self.selectedViewColorIndicator];
         
         self.selectedViewDescriptionLabel = [[UILabel alloc] init];
-        self.selectedViewDescriptionLabel.backgroundColor = [UIColor clearColor];
+        self.selectedViewDescriptionLabel.backgroundColor = UIColor.clearColor;
         self.selectedViewDescriptionLabel.font = [[self class] descriptionLabelFont];
         [self.selectedViewDescriptionSafeAreaContainer addSubview:self.selectedViewDescriptionLabel];
         
@@ -109,14 +109,14 @@
     CGFloat originX = CGRectGetMaxX(self.dragHandle.frame);
     CGFloat originY = CGRectGetMinY(safeArea);
     CGFloat height = kToolbarItemHeight;
-    CGFloat width = FLEXFloor((CGRectGetWidth(safeArea) - CGRectGetWidth(self.dragHandle.frame)) / [self.toolbarItems count]);
+    CGFloat width = FLEXFloor((CGRectGetWidth(safeArea) - CGRectGetWidth(self.dragHandle.frame)) / self.toolbarItems.count);
     for (UIView *toolbarItem in self.toolbarItems) {
         toolbarItem.frame = CGRectMake(originX, originY, width, height);
         originX = CGRectGetMaxX(toolbarItem.frame);
     }
     
     // Make sure the last toolbar item goes to the edge to account for any accumulated rounding effects.
-    UIView *lastToolbarItem = [self.toolbarItems lastObject];
+    UIView *lastToolbarItem = self.toolbarItems.lastObject;
     CGRect lastToolbarItemFrame = lastToolbarItem.frame;
     lastToolbarItemFrame.size.width = CGRectGetMaxX(safeArea) - lastToolbarItemFrame.origin.x;
     lastToolbarItem.frame = lastToolbarItemFrame;
@@ -204,7 +204,7 @@
     if (![_selectedViewDescription isEqual:selectedViewDescription]) {
         _selectedViewDescription = selectedViewDescription;
         self.selectedViewDescriptionLabel.text = selectedViewDescription;
-        BOOL showDescription = [selectedViewDescription length] > 0;
+        BOOL showDescription = selectedViewDescription.length > 0;
         self.selectedViewDescriptionContainer.hidden = !showDescription;
     }
 }

+ 1 - 1
Classes/Toolbar/FLEXToolbarItem.m

@@ -54,7 +54,7 @@
 
 + (UIColor *)defaultBackgroundColor
 {
-    return [UIColor clearColor];
+    return UIColor.clearColor;
 }
 
 + (CGFloat)topMargin

+ 3 - 3
Classes/Utility/FLEXColor.m

@@ -72,12 +72,12 @@
 + (UIColor *)tintColor {
     #if FLEX_AT_LEAST_IOS13_SDK
     if (@available(iOS 13.0, *)) {
-        return [UIColor systemBlueColor];
+        return UIColor.systemBlueColor;
     } else {
-        return [UIApplication sharedApplication].keyWindow.tintColor;
+        return UIApplication.sharedApplication.keyWindow.tintColor;
     }
     #else
-    return [UIApplication sharedApplication].keyWindow.tintColor;
+    return UIApplication.sharedApplication.keyWindow.tintColor;
     #endif
 }
 

+ 2 - 2
Classes/Utility/FLEXKeyboardHelpViewController.m

@@ -27,8 +27,8 @@
 #if TARGET_OS_SIMULATOR
     self.textView.text = [[FLEXKeyboardShortcutManager sharedManager] keyboardShortcutsDescription];
 #endif
-    self.textView.backgroundColor = [UIColor blackColor];
-    self.textView.textColor = [UIColor whiteColor];
+    self.textView.backgroundColor = UIColor.blackColor;
+    self.textView.textColor = UIColor.whiteColor;
     self.textView.font = [UIFont boldSystemFontOfSize:14.0];
     self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
     

+ 4 - 4
Classes/Utility/FLEXKeyboardShortcutManager.m

@@ -86,7 +86,7 @@
     }
     
     // Fudging to get easy columns with tabs
-    if ([prettyFlags length] < 2) {
+    if (prettyFlags.length < 2) {
         prettyKey = [prettyKey stringByAppendingString:@"\t"];
     }
     
@@ -239,9 +239,9 @@ static const long kFLEXCommandKeyCode = 0xe3;
         isKeyDown = [event _isKeyDown];
     }
     
-    BOOL interactionEnabled = ![[UIApplication sharedApplication] isIgnoringInteractionEvents];
+    BOOL interactionEnabled = ![UIApplication.sharedApplication isIgnoringInteractionEvents];
     BOOL hasFirstResponder = NO;
-    if (isKeyDown && [modifiedInput length] > 0 && interactionEnabled) {
+    if (isKeyDown && modifiedInput.length > 0 && interactionEnabled) {
         UIResponder *firstResponder = nil;
         for (UIWindow *window in [FLEXUtility allWindows]) {
             firstResponder = [window valueForKey:@"firstResponder"];
@@ -294,7 +294,7 @@ static const long kFLEXCommandKeyCode = 0xe3;
 - (NSString *)keyboardShortcutsDescription
 {
     NSMutableString *description = [NSMutableString string];
-    NSArray<FLEXKeyInput *> *keyInputs = [[self.actionsForKeyInputs allKeys] sortedArrayUsingComparator:^NSComparisonResult(FLEXKeyInput *_Nonnull input1, FLEXKeyInput *_Nonnull input2) {
+    NSArray<FLEXKeyInput *> *keyInputs = [self.actionsForKeyInputs.allKeys sortedArrayUsingComparator:^NSComparisonResult(FLEXKeyInput *_Nonnull input1, FLEXKeyInput *_Nonnull input2) {
         return [input1.key caseInsensitiveCompare:input2.key];
     }];
     for (FLEXKeyInput *keyInput in keyInputs) {

+ 1 - 1
Classes/Utility/FLEXResources.m

@@ -83,7 +83,7 @@ static const u_int8_t FLEXBinaryIcon2x[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a,
 
 #pragma mark - Images
 
-#define FLEXImage(base) (([[UIScreen mainScreen] scale] > 1.5) ? \
+#define FLEXImage(base) ((UIScreen.mainScreen.scale > 1.5) ? \
     [self imageWithBytesNoCopy:(void *)base##2x length:sizeof(base##2x) scale:2.0] : \
     [self imageWithBytesNoCopy:(void *)base length:sizeof(base) scale:1.0])
 

+ 15 - 15
Classes/Utility/FLEXRuntimeUtility.m

@@ -190,7 +190,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     }
     
     SEL getterSelector;
-    if ([customGetterString length] > 0) {
+    if (customGetterString.length > 0) {
         getterSelector = NSSelectorFromString(customGetterString);
     } else {
         NSString *propertyName = @(property_getName(property));
@@ -239,14 +239,14 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
 {
     objc_property_t property = class_getProperty(theClass, name);
     if (!property) {
-        unsigned int totalAttributesCount = (unsigned int)[attributePairs count];
+        unsigned int totalAttributesCount = (unsigned int)attributePairs.count;
         objc_property_attribute_t *attributes = malloc(sizeof(objc_property_attribute_t) * totalAttributesCount);
         if (attributes) {
             unsigned int attributeIndex = 0;
-            for (NSString *attributeName in [attributePairs allKeys]) {
+            for (NSString *attributeName in attributePairs.allKeys) {
                 objc_property_attribute_t attribute;
-                attribute.name = [attributeName UTF8String];
-                attribute.value = [attributePairs[attributeName] UTF8String];
+                attribute.name = attributeName.UTF8String;
+                attribute.value = attributePairs[attributeName].UTF8String;
                 attributes[attributeIndex++] = attribute;
             }
             
@@ -330,7 +330,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     free(returnType);
     NSString *prettyName = [NSString stringWithFormat:@"%@ (%@)", methodTypeString, readableReturnType];
     NSArray<NSString *> *components = [self prettyArgumentComponentsForMethod:method];
-    if ([components count] > 0) {
+    if (components.count > 0) {
         prettyName = [prettyName stringByAppendingString:[components componentsJoinedByString:@" "]];
     } else {
         prettyName = [prettyName stringByAppendingString:selectorName];
@@ -396,7 +396,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     NSUInteger numberOfArguments = [methodSignature numberOfArguments];
     for (NSUInteger argumentIndex = kFLEXNumberOfImplicitArgs; argumentIndex < numberOfArguments; argumentIndex++) {
         NSUInteger argumentsArrayIndex = argumentIndex - kFLEXNumberOfImplicitArgs;
-        id argumentObject = [arguments count] > argumentsArrayIndex ? arguments[argumentsArrayIndex] : nil;
+        id argumentObject = arguments.count > argumentsArrayIndex ? arguments[argumentsArrayIndex] : nil;
         
         // NSNull in the arguments array can be passed as a placeholder to indicate nil. We only need to set the argument if it will be non-nil.
         if (argumentObject && ![argumentObject isKindOfClass:[NSNull class]]) {
@@ -446,7 +446,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
         [invocation invoke];
         
         // Retrieve the return value and box if necessary.
-        const char *returnType = [methodSignature methodReturnType];
+        const char *returnType = methodSignature.methodReturnType;
         
         if (returnType[0] == @encode(id)[0] || returnType[0] == @encode(Class)[0]) {
             // Return value is an object.
@@ -455,7 +455,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
             returnObject = objectReturnedFromMethod;
         } else if (returnType[0] != @encode(void)[0]) {
             // Will use arbitrary buffer for return value and box it.
-            void *returnValue = malloc([methodSignature methodReturnLength]);
+            void *returnValue = malloc(methodSignature.methodReturnLength);
             
             if (returnValue) {
                 [invocation getReturnValue:returnValue];
@@ -534,7 +534,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
         NSArray *wrappedObject = @[object];
         if ([NSJSONSerialization isValidJSONObject:wrappedObject]) {
             NSString *wrappedDescription = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:wrappedObject options:0 error:NULL] encoding:NSUTF8StringEncoding];
-            editableDescription = [wrappedDescription substringWithRange:NSMakeRange(1, [wrappedDescription length] - 2)];
+            editableDescription = [wrappedDescription substringWithRange:NSMakeRange(1, wrappedDescription.length - 2)];
         }
     }
     
@@ -624,7 +624,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
                     // If the struct type encoding was successfully handled by NSGetSizeAndAlignment above, we *should* be ok with the field here.
                     const char *nextTypeStart = NSGetSizeAndAlignment(typeStart, &fieldSize, NULL);
                     NSString *typeEncoding = [@(structEncoding) substringWithRange:NSMakeRange(typeStart - structEncoding, nextTypeStart - typeStart)];
-                    typeBlock(structName, [typeEncoding UTF8String], [self readableTypeForEncoding:typeEncoding], runningFieldIndex, runningFieldOffset);
+                    typeBlock(structName, typeEncoding.UTF8String, [self readableTypeForEncoding:typeEncoding], runningFieldIndex, runningFieldOffset);
                     runningFieldOffset += fieldSize;
                     // Padding to keep proper alignment. __attribute((packed)) structs will break here.
                     // The type encoding is no different for packed structs, so it's not clear there's anything we can do for those.
@@ -647,7 +647,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     NSString *attributes = @(property_getAttributes(property));
     // Thanks to MAObjcRuntime for inspiration here.
     NSArray<NSString *> *attributePairs = [attributes componentsSeparatedByString:@","];
-    NSMutableDictionary<NSString *, NSString *> *attributesDictionary = [NSMutableDictionary dictionaryWithCapacity:[attributePairs count]];
+    NSMutableDictionary<NSString *, NSString *> *attributesDictionary = [NSMutableDictionary dictionaryWithCapacity:attributePairs.count];
     for (NSString *attributePair in attributePairs) {
         [attributesDictionary setObject:[attributePair substringFromIndex:1] forKey:[attributePair substringToIndex:1]];
     }
@@ -657,7 +657,7 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
 + (NSString *)appendName:(NSString *)name toType:(NSString *)type
 {
     NSString *combined = nil;
-    if ([type characterAtIndex:[type length] - 1] == '*') {
+    if ([type characterAtIndex:type.length - 1] == '*') {
         combined = [type stringByAppendingString:name];
     } else {
         combined = [type stringByAppendingFormat:@" %@", name];
@@ -676,13 +676,13 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     // See https://github.com/nygard/class-dump/blob/master/Source/CDType.m
     // Warning: this method uses multiple middle returns and macros to cut down on boilerplate.
     // The use of macros here was inspired by https://www.mikeash.com/pyblog/friday-qa-2013-02-08-lets-build-key-value-coding.html
-    const char *encodingCString = [encodingString UTF8String];
+    const char *encodingCString = encodingString.UTF8String;
     
     // Objects
     if (encodingCString[0] == '@') {
         NSString *class = [encodingString substringFromIndex:1];
         class = [class stringByReplacingOccurrencesOfString:@"\"" withString:@""];
-        if ([class length] == 0 || [class isEqual:@"?"]) {
+        if (class.length == 0 || [class isEqual:@"?"]) {
             class = @"id";
         } else {
             class = [class stringByAppendingString:@" *"];

+ 1 - 1
Classes/Utility/FLEXUtility.h

@@ -12,7 +12,7 @@
 #import <UIKit/UIKit.h>
 #import <objc/runtime.h>
 
-#define FLEXFloor(x) (floor([[UIScreen mainScreen] scale] * (x)) / [[UIScreen mainScreen] scale])
+#define FLEXFloor(x) (floor(UIScreen.mainScreen.scale * (x)) / UIScreen.mainScreen.scale)
 
 #if defined(__IPHONE_13_0)
 #define FLEX_AT_LEAST_IOS13_SDK (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)

+ 11 - 11
Classes/Utility/FLEXUtility.m

@@ -26,7 +26,7 @@
     NSString *description = [[view class] description];
     
     NSString *viewControllerDescription = [[[self viewControllerForView:view] class] description];
-    if ([viewControllerDescription length] > 0) {
+    if (viewControllerDescription.length > 0) {
         description = [description stringByAppendingFormat:@" (%@)", viewControllerDescription];
     }
     
@@ -34,7 +34,7 @@
         description = [description stringByAppendingFormat:@" %@", [self stringForCGRect:view.frame]];
     }
     
-    if ([view.accessibilityLabel length] > 0) {
+    if (view.accessibilityLabel.length > 0) {
         description = [description stringByAppendingFormat:@" · %@", view.accessibilityLabel];
     }
     
@@ -82,7 +82,7 @@
     CGFloat diameter = radius * 2.0;
     UIGraphicsBeginImageContextWithOptions(CGSizeMake(diameter, diameter), NO, 0.0);
     CGContextRef imageContext = UIGraphicsGetCurrentContext();
-    CGContextSetFillColorWithColor(imageContext, [color CGColor]);
+    CGContextSetFillColorWithColor(imageContext, color.CGColor);
     CGContextFillEllipseInRect(imageContext, CGRectMake(0, 0, diameter, diameter));
     UIImage *circularImage = UIGraphicsGetImageFromCurrentImageContext();
     UIGraphicsEndImageContext();
@@ -192,7 +192,7 @@
     
     NSMutableString *mutableString = [originalString mutableCopy];
     
-    NSArray<NSTextCheckingResult *> *matches = [regex matchesInString:mutableString options:0 range:NSMakeRange(0, [mutableString length])];
+    NSArray<NSTextCheckingResult *> *matches = [regex matchesInString:mutableString options:0 range:NSMakeRange(0, mutableString.length)];
     for (NSTextCheckingResult *result in [matches reverseObjectEnumerator]) {
         NSString *foundString = [mutableString substringWithRange:result.range];
         NSString *replacementString = escapingDictionary[foundString];
@@ -295,9 +295,9 @@
     for (NSString *keyValueString in queryComponents) {
         // [a, 1]
         NSArray<NSString *> *components = [keyValueString componentsSeparatedByString:@"="];
-        if ([components count] == 2) {
-            NSString *key = [[components firstObject] stringByRemovingPercentEncoding];
-            id value = [[components lastObject] stringByRemovingPercentEncoding];
+        if (components.count == 2) {
+            NSString *key = [components.firstObject stringByRemovingPercentEncoding];
+            id value = [components.lastObject stringByRemovingPercentEncoding];
 
             // Handle multiple entries under the same key as an array
             id existingEntry = queryDictionary[key];
@@ -343,13 +343,13 @@
 + (NSData *)inflatedDataFromCompressedData:(NSData *)compressedData
 {
     NSData *inflatedData = nil;
-    NSUInteger compressedDataLength = [compressedData length];
+    NSUInteger compressedDataLength = compressedData.length;
     if (compressedDataLength > 0) {
         z_stream stream;
         stream.zalloc = Z_NULL;
         stream.zfree = Z_NULL;
         stream.avail_in = (uInt)compressedDataLength;
-        stream.next_in = (void *)[compressedData bytes];
+        stream.next_in = (void *)compressedData.bytes;
         stream.total_out = 0;
         stream.avail_out = 0;
 
@@ -357,11 +357,11 @@
         if (inflateInit2(&stream, 15 + 32) == Z_OK) {
             int status = Z_OK;
             while (status == Z_OK) {
-                if (stream.total_out >= [mutableData length]) {
+                if (stream.total_out >= mutableData.length) {
                     mutableData.length += compressedDataLength / 2;
                 }
                 stream.next_out = (uint8_t *)[mutableData mutableBytes] + stream.total_out;
-                stream.avail_out = (uInt)([mutableData length] - stream.total_out);
+                stream.avail_out = (uInt)(mutableData.length - stream.total_out);
                 status = inflate(&stream, Z_SYNC_FLUSH);
             }
             if (inflateEnd(&stream) == Z_OK) {

+ 2 - 2
Classes/ViewHierarchy/FLEXHierarchyTableViewCell.m

@@ -31,7 +31,7 @@
         self.depthIndicatorView.backgroundColor = [FLEXUtility hierarchyIndentPatternColor];
         [self.contentView addSubview:self.depthIndicatorView];
         
-        UIImage *defaultCircleImage = [FLEXUtility circularImageWithColor:[UIColor blackColor] radius:5.0];
+        UIImage *defaultCircleImage = [FLEXUtility circularImageWithColor:UIColor.blackColor radius:5.0];
         self.colorCircleImageView = [[UIImageView alloc] initWithImage:defaultCircleImage];
         [self.contentView addSubview:self.colorCircleImageView];
         
@@ -41,7 +41,7 @@
         
         self.viewBackgroundColorView = [[UIView alloc] init];
         self.viewBackgroundColorView.clipsToBounds = YES;
-        self.viewBackgroundColorView.layer.borderColor = [UIColor blackColor].CGColor;
+        self.viewBackgroundColorView.layer.borderColor = UIColor.blackColor.CGColor;
         self.viewBackgroundColorView.layer.borderWidth = 1.0f;
         [self.contentView addSubview:self.viewBackgroundColorView];
     }

+ 3 - 3
Classes/ViewHierarchy/FLEXHierarchyTableViewController.m

@@ -121,7 +121,7 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
 
 - (BOOL)showScopeBar
 {
-    return [self.viewsAtTap count] > 0;
+    return self.viewsAtTap.count > 0;
 }
 
 - (void)updateSearchResults:(NSString *)newText
@@ -143,7 +143,7 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return [self.displayedViews count];
+    return self.displayedViews.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -177,7 +177,7 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
     });
     
     UIColor *viewColour = view.backgroundColor;
-    if (!viewColour || [viewColour isEqual:[UIColor clearColor]]) {
+    if (!viewColour || [viewColour isEqual:UIColor.clearColor]) {
         cell.viewBackgroundColorView.backgroundColor = checkerPatternColour;
     } else {
         cell.viewBackgroundColorView.backgroundColor = viewColour;

+ 3 - 2
Example/UICatalog.xcodeproj/project.pbxproj

@@ -366,6 +366,7 @@
 				ORGANIZATIONNAME = f;
 				TargetAttributes = {
 					5356823918F3656900BAAD62 = {
+						DevelopmentTeam = S6N2F22V2Z;
 						ProvisioningStyle = Automatic;
 					};
 				};
@@ -584,7 +585,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = "";
+				DEVELOPMENT_TEAM = S6N2F22V2Z;
 				EXCLUDED_SOURCE_FILE_NAMES = "";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -607,7 +608,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = "";
+				DEVELOPMENT_TEAM = S6N2F22V2Z;
 				EXCLUDED_SOURCE_FILE_NAMES = "FLEX*";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

+ 1 - 1
Example/UICatalog/AAPLActivityIndicatorViewController.m

@@ -82,7 +82,7 @@
 - (void)configureTintedActivityIndicatorView {
     self.tintedActivityIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
 
-    self.tintedActivityIndicatorView.color = [UIColor aapl_applicationPurpleColor];
+    self.tintedActivityIndicatorView.color = UIColor.aapl_applicationPurpleColor;
 
     [self.tintedActivityIndicatorView startAnimating];
 }

+ 6 - 6
Example/UICatalog/AAPLAppDelegate.m

@@ -112,7 +112,7 @@
     });
 
     // NSURLSession
-    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
+    NSURLSessionConfiguration *config = NSURLSessionConfiguration.defaultSessionConfiguration;
     config.timeoutIntervalForRequest = 10.0;
     NSURLSession *mySession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue mainQueue]];
 
@@ -125,12 +125,12 @@
     [pendingTasks addObject:[mySession downloadTaskWithURL:[NSURL URLWithString:@"https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png?v5"]]];
 
     // Async NSURLSessionDownloadTask
-    [pendingTasks addObject:[[NSURLSession sharedSession] downloadTaskWithURL:[NSURL URLWithString:@"http://lorempixel.com/1024/1024/"] completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) {
+    [pendingTasks addObject:[NSURLSession.sharedSession downloadTaskWithURL:[NSURL URLWithString:@"http://lorempixel.com/1024/1024/"] completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) {
 
     }]];
 
     // Async NSURLSessionDataTask
-    [pendingTasks addObject:[[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"https://api.github.com/emojis"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
+    [pendingTasks addObject:[NSURLSession.sharedSession dataTaskWithURL:[NSURL URLWithString:@"https://api.github.com/emojis"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
 
     }]];
 
@@ -193,9 +193,9 @@
 #if __has_include(<Realm/Realm.h>)
 - (void)setUpRealm
 {
-    NSString *destinationPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
+    NSString *destinationPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
     destinationPath = [destinationPath stringByAppendingPathComponent:@"dogs.realm"];
-    if ([[NSFileManager defaultManager] fileExistsAtPath:destinationPath isDirectory:nil]) {
+    if ([NSFileManager.defaultManager fileExistsAtPath:destinationPath isDirectory:nil]) {
         return;
     }
     
@@ -205,7 +205,7 @@
     }
     
     NSError *error = nil;
-    [[NSFileManager defaultManager] copyItemAtPath:resourcePath toPath:destinationPath error:&error];
+    [NSFileManager.defaultManager copyItemAtPath:resourcePath toPath:destinationPath error:&error];
 }
 #endif
 

+ 5 - 5
Example/UICatalog/AAPLButtonViewController.m

@@ -83,13 +83,13 @@
 }
 
 - (void)configureSystemContactAddButton {
-    self.systemContactAddButton.backgroundColor = [UIColor clearColor];
+    self.systemContactAddButton.backgroundColor = UIColor.clearColor;
     
     [self.systemContactAddButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
 }
 
 - (void)configureSystemDetailDisclosureButton {
-    self.systemDetailDisclosureButton.backgroundColor = [UIColor clearColor];
+    self.systemDetailDisclosureButton.backgroundColor = UIColor.clearColor;
     
     [self.systemDetailDisclosureButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
 }
@@ -100,7 +100,7 @@
     // Remove the title text.
     [self.imageButton setTitle:@"" forState:UIControlStateNormal];
 
-    self.imageButton.tintColor = [UIColor aapl_applicationPurpleColor];
+    self.imageButton.tintColor = UIColor.aapl_applicationPurpleColor;
     
     [self.imageButton setImage:[UIImage imageNamed:@"x_icon"] forState:UIControlStateNormal];
 
@@ -111,11 +111,11 @@
 }
 
 - (void)configureAttributedTextSystemButton {
-    NSDictionary *titleAttributes = @{NSForegroundColorAttributeName: [UIColor aapl_applicationBlueColor], NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)};
+    NSDictionary *titleAttributes = @{NSForegroundColorAttributeName: UIColor.aapl_applicationBlueColor, NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)};
     NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Button", nil) attributes:titleAttributes];
     [self.attributedTextButton setAttributedTitle:attributedTitle forState:UIControlStateNormal];
 
-    NSDictionary *highlightedTitleAttributes = @{NSForegroundColorAttributeName : [UIColor aapl_applicationGreenColor], NSStrikethroughStyleAttributeName: @(NSUnderlineStyleThick)};
+    NSDictionary *highlightedTitleAttributes = @{NSForegroundColorAttributeName : UIColor.aapl_applicationGreenColor, NSStrikethroughStyleAttributeName: @(NSUnderlineStyleThick)};
     NSAttributedString *highlightedAttributedTitle = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Button", nil) attributes:highlightedTitleAttributes];
     [self.attributedTextButton setAttributedTitle:highlightedAttributedTitle forState:UIControlStateHighlighted];
 

+ 1 - 1
Example/UICatalog/AAPLCatalogTableTableViewController.m

@@ -44,7 +44,7 @@
     infoLabel.textAlignment = NSTextAlignmentCenter;
 
     UIView *view = viewController.view;
-    view.backgroundColor = [UIColor whiteColor];
+    view.backgroundColor = UIColor.whiteColor;
     [view addSubview:infoLabel];
 
     [view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[infoLabel]-0-|"

+ 1 - 1
Example/UICatalog/AAPLCustomSearchBarViewController.m

@@ -71,7 +71,7 @@
     self.searchBar.showsCancelButton = YES;
     self.searchBar.showsBookmarkButton = YES;
     
-    self.searchBar.tintColor = [UIColor aapl_applicationPurpleColor];
+    self.searchBar.tintColor = UIColor.aapl_applicationPurpleColor;
     
     self.searchBar.backgroundImage = [UIImage imageNamed:@"search_bar_background"];
 

+ 2 - 2
Example/UICatalog/AAPLCustomToolbarViewController.m

@@ -81,7 +81,7 @@
 - (UIBarButtonItem *)customImageBarButtonItem {
     UIBarButtonItem *customImageBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"tools_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(barButtonItemClicked:)];
 
-    customImageBarButtonItem.tintColor = [UIColor aapl_applicationPurpleColor];
+    customImageBarButtonItem.tintColor = UIColor.aapl_applicationPurpleColor;
 
     return customImageBarButtonItem;
 }
@@ -93,7 +93,7 @@
 - (UIBarButtonItem *)customBarButtonItem {
     UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Button", nil) style:UIBarButtonItemStylePlain target:self action:@selector(barButtonItemClicked:)];
 
-    NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor aapl_applicationPurpleColor]};
+    NSDictionary *attributes = @{NSForegroundColorAttributeName: UIColor.aapl_applicationPurpleColor};
     [barButtonItem setTitleTextAttributes:attributes forState:UIControlStateNormal];
 
     return barButtonItem;

+ 1 - 1
Example/UICatalog/AAPLImageViewController.m

@@ -67,7 +67,7 @@
     imageView.contentMode = UIViewContentModeScaleAspectFit;
     
     // If the image does not have the same aspect ratio as imageView's bounds, then imageView's backgroundColor will be applied to the "empty" space.
-    imageView.backgroundColor = [UIColor whiteColor];
+    imageView.backgroundColor = UIColor.whiteColor;
     
     imageView.animationDuration = 5;
     [imageView startAnimating];

+ 1 - 1
Example/UICatalog/AAPLMasterViewController.m

@@ -79,7 +79,7 @@
     if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
 #pragma clang diagnostic pop
         UINavigationController *newDetailViewController = [segue destinationViewController];
-        UINavigationController *oldDetailViewController = [self.splitViewController.viewControllers lastObject];
+        UINavigationController *oldDetailViewController = self.splitViewController.viewControllers.lastObject;
         
         // In order for a segue to occur when the view controller is in portrait, the "More" bar button item must be visible.
         // However, the "More" bar button item is only visible if the detail view controller's root view controller is

+ 5 - 5
Example/UICatalog/AAPLPageControlViewController.m

@@ -65,7 +65,7 @@
     [super viewDidLoad];
 
     // Set a list of colors that correspond to the selected page.
-    self.colors = @[[UIColor blackColor], [UIColor grayColor], [UIColor redColor], [UIColor greenColor], [UIColor blueColor], [UIColor cyanColor], [UIColor yellowColor], [UIColor magentaColor], [UIColor orangeColor], [UIColor purpleColor]];
+    self.colors = @[UIColor.blackColor, UIColor.grayColor, UIColor.redColor, UIColor.greenColor, UIColor.blueColor, UIColor.cyanColor, UIColor.yellowColor, UIColor.magentaColor, UIColor.orangeColor, UIColor.purpleColor];
 
     [self configurePageControl];
     [self pageControlValueDidChange];
@@ -76,12 +76,12 @@
 
 - (void)configurePageControl {
     // The total number of pages that are available is based on how many available colors we have.
-    self.pageControl.numberOfPages = [self.colors count];
+    self.pageControl.numberOfPages = self.colors.count;
     self.pageControl.currentPage = 2;
 
-    self.pageControl.tintColor = [UIColor aapl_applicationBlueColor];
-    self.pageControl.pageIndicatorTintColor = [UIColor aapl_applicationGreenColor];
-    self.pageControl.currentPageIndicatorTintColor = [UIColor aapl_applicationPurpleColor];
+    self.pageControl.tintColor = UIColor.aapl_applicationBlueColor;
+    self.pageControl.pageIndicatorTintColor = UIColor.aapl_applicationGreenColor;
+    self.pageControl.currentPageIndicatorTintColor = UIColor.aapl_applicationPurpleColor;
 
     [self.pageControl addTarget:self action:@selector(pageControlValueDidChange) forControlEvents:UIControlEventValueChanged];
 }

+ 2 - 2
Example/UICatalog/AAPLProgressViewController.m

@@ -109,8 +109,8 @@ const NSUInteger kProgressViewControllerMaxProgress = 100;
 - (void)configureTintedProgressView {
     self.tintedProgressView.progressViewStyle = UIProgressViewStyleDefault;
 
-    self.tintedProgressView.trackTintColor = [UIColor aapl_applicationBlueColor];
-    self.tintedProgressView.progressTintColor = [UIColor aapl_applicationPurpleColor];
+    self.tintedProgressView.trackTintColor = UIColor.aapl_applicationBlueColor;
+    self.tintedProgressView.progressTintColor = UIColor.aapl_applicationPurpleColor;
 }
 
 

+ 4 - 4
Example/UICatalog/AAPLSegmentedControlViewController.m

@@ -82,7 +82,7 @@
 }
 
 - (void)configureTintedSegmentedControl {
-    self.tintedSegmentedControl.tintColor = [UIColor aapl_applicationBlueColor];
+    self.tintedSegmentedControl.tintColor = UIColor.aapl_applicationBlueColor;
 
     self.tintedSegmentedControl.selectedSegmentIndex = 1;
 
@@ -97,7 +97,7 @@
     };
     
     // Guarantee that the segments show up in the same order.
-    NSArray *sortedSegmentImageNames = [[imageToAccessibilityLabelMappings allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
+    NSArray *sortedSegmentImageNames = [imageToAccessibilityLabelMappings.allKeys sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
 
     [sortedSegmentImageNames enumerateObjectsUsingBlock:^(NSString *segmentImageName, NSUInteger idx, BOOL *stop) {
         UIImage *image = [UIImage imageNamed:segmentImageName];
@@ -126,10 +126,10 @@
     UIFontDescriptor *captionFontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleCaption1];
     UIFont *font = [UIFont fontWithDescriptor:captionFontDescriptor size:0];
 
-    NSDictionary *normalTextAttributes = @{NSForegroundColorAttributeName:[UIColor aapl_applicationPurpleColor], NSFontAttributeName:font};
+    NSDictionary *normalTextAttributes = @{NSForegroundColorAttributeName:UIColor.aapl_applicationPurpleColor, NSFontAttributeName:font};
     [self.customBackgroundSegmentedControl setTitleTextAttributes:normalTextAttributes forState:UIControlStateNormal];
 
-    NSDictionary *highlightedTextAttributes = @{NSForegroundColorAttributeName:[UIColor aapl_applicationGreenColor], NSFontAttributeName:font};
+    NSDictionary *highlightedTextAttributes = @{NSForegroundColorAttributeName:UIColor.aapl_applicationGreenColor, NSFontAttributeName:font};
     [self.customBackgroundSegmentedControl setTitleTextAttributes:highlightedTextAttributes forState:UIControlStateHighlighted];
     
     [self.customBackgroundSegmentedControl addTarget:self action:@selector(selectedSegmentDidChange:) forControlEvents:UIControlEventValueChanged];

+ 2 - 2
Example/UICatalog/AAPLSliderViewController.m

@@ -81,8 +81,8 @@
 }
 
 - (void)configureTintedSlider {
-    self.tintedSlider.minimumTrackTintColor = [UIColor aapl_applicationBlueColor];
-    self.tintedSlider.maximumTrackTintColor = [UIColor aapl_applicationPurpleColor];
+    self.tintedSlider.minimumTrackTintColor = UIColor.aapl_applicationBlueColor;
+    self.tintedSlider.maximumTrackTintColor = UIColor.aapl_applicationPurpleColor;
 
     [self.tintedSlider addTarget:self action:@selector(sliderValueDidChange:) forControlEvents:UIControlEventValueChanged];
 }

+ 4 - 4
Example/UICatalog/AAPLSplitViewControllerDelegate.m

@@ -58,12 +58,12 @@
 - (void)splitViewController:(UISplitViewController *)splitViewController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController {
     barButtonItem.title = NSLocalizedString(@"UICatalog", nil);
 
-    UINavigationController *detailViewController = [splitViewController.viewControllers lastObject];
+    UINavigationController *detailViewController = splitViewController.viewControllers.lastObject;
 
     // It's possible that the detail view controller has more than one view controller currently in its hierarchy. If this is the case, we
     // want to be sure that the root view controller of the navigation controller has its left bar button item set on its navigation item.
     // We don't want to override the navigation controller's top view controller's "Back" bar button item with the "More" bar button item.
-    UIViewController *detailRootViewController = [detailViewController.viewControllers firstObject];
+    UIViewController *detailRootViewController = detailViewController.viewControllers.firstObject;
 
     [detailRootViewController.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
 }
@@ -71,9 +71,9 @@
 // This method is similar to the one above except that it removes the bar button on the detail view controller's root view controller
 // since the interface orientation is now portrait.
 - (void)splitViewController:(UISplitViewController *)splitViewController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
-    UINavigationController *detailViewController = [splitViewController.viewControllers lastObject];
+    UINavigationController *detailViewController = splitViewController.viewControllers.lastObject;
     
-    UIViewController *detailRootViewController = [detailViewController.viewControllers firstObject];
+    UIViewController *detailRootViewController = detailViewController.viewControllers.firstObject;
 
     [detailRootViewController.navigationItem setLeftBarButtonItem:nil animated:YES];
 }

+ 1 - 1
Example/UICatalog/AAPLStepperViewController.m

@@ -86,7 +86,7 @@
 }
 
 - (void)configureTintedStepper {
-    self.tintedStepper.tintColor = [UIColor aapl_applicationBlueColor];
+    self.tintedStepper.tintColor = UIColor.aapl_applicationBlueColor;
 
     self.tintedStepperLabel.text = [NSString stringWithFormat:@"%ld", (long)self.tintedStepper.value];
     [self.tintedStepper addTarget:self action:@selector(stepperValueDidChange:) forControlEvents:UIControlEventValueChanged];

+ 3 - 3
Example/UICatalog/AAPLSwitchViewController.m

@@ -76,9 +76,9 @@
 }
 
 - (void)configureTintedSwitch {
-    self.tintedSwitch.tintColor = [UIColor aapl_applicationBlueColor];
-    self.tintedSwitch.onTintColor = [UIColor aapl_applicationGreenColor];
-    self.tintedSwitch.thumbTintColor = [UIColor aapl_applicationPurpleColor];
+    self.tintedSwitch.tintColor = UIColor.aapl_applicationBlueColor;
+    self.tintedSwitch.onTintColor = UIColor.aapl_applicationGreenColor;
+    self.tintedSwitch.thumbTintColor = UIColor.aapl_applicationPurpleColor;
 
     [self.tintedSwitch addTarget:self action:@selector(switchValueDidChange:) forControlEvents:UIControlEventValueChanged];
 }

+ 4 - 4
Example/UICatalog/AAPLTextFieldViewController.m

@@ -83,8 +83,8 @@
 }
 
 - (void)configureTintedTextField {
-    self.tintedTextField.tintColor = [UIColor aapl_applicationBlueColor];
-    self.tintedTextField.textColor = [UIColor aapl_applicationGreenColor];
+    self.tintedTextField.tintColor = UIColor.aapl_applicationBlueColor;
+    self.tintedTextField.textColor = UIColor.aapl_applicationGreenColor;
 
     self.tintedTextField.placeholder = NSLocalizedString(@"Placeholder text", nil);
     self.tintedTextField.returnKeyType = UIReturnKeyDone;
@@ -127,7 +127,7 @@
 
     // Add an empty view as the left view to ensure inset between the text and the bounding rectangle.
     UIView *leftPaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 0)];
-    leftPaddingView.backgroundColor = [UIColor clearColor];
+    leftPaddingView.backgroundColor = UIColor.clearColor;
     self.customTextField.leftView = leftPaddingView;
     self.customTextField.leftViewMode = UITextFieldViewModeAlways;
 
@@ -149,7 +149,7 @@
 #pragma mark - Actions
 
 - (void)customTextFieldPurpleButtonClicked {
-    self.customTextField.textColor = [UIColor aapl_applicationPurpleColor];
+    self.customTextField.textColor = UIColor.aapl_applicationPurpleColor;
 
     NSLog(@"The custom text field's purple right view button was clicked.");
 }

+ 8 - 8
Example/UICatalog/AAPLTextViewController.m

@@ -71,15 +71,15 @@
     [super viewWillAppear:animated];
     
     // Listen for changes to keyboard visibility so that we can adjust the text view accordingly.
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillShowNotification object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillHideNotification object:nil];
+    [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillShowNotification object:nil];
+    [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillHideNotification object:nil];
 }
 
 - (void)viewDidDisappear:(BOOL)animated {
     [super viewDidDisappear:animated];
     
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
+    [NSNotificationCenter.defaultCenter removeObserver:self name:UIKeyboardWillShowNotification object:nil];
+    [NSNotificationCenter.defaultCenter removeObserver:self name:UIKeyboardWillHideNotification object:nil];
 }
 
 
@@ -135,8 +135,8 @@
     UIFontDescriptor *bodyFontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody];
     self.textView.font = [UIFont fontWithDescriptor:bodyFontDescriptor size:0];
 
-    self.textView.textColor = [UIColor blackColor];
-    self.textView.backgroundColor = [UIColor whiteColor];
+    self.textView.textColor = UIColor.blackColor;
+    self.textView.backgroundColor = UIColor.whiteColor;
     self.textView.scrollEnabled = YES;
 
     // Let's modify some of the attributes of the attributed string.
@@ -158,13 +158,13 @@
     [attributedText addAttribute:NSFontAttributeName value:boldFont range:boldRange];
 
     // Add highlight.
-    [attributedText addAttribute:NSBackgroundColorAttributeName value:[UIColor aapl_applicationGreenColor] range:highlightedRange];
+    [attributedText addAttribute:NSBackgroundColorAttributeName value:UIColor.aapl_applicationGreenColor range:highlightedRange];
 
     // Add underline.
     [attributedText addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:underlinedRange];
 
     // Add tint.
-    [attributedText addAttribute:NSForegroundColorAttributeName value:[UIColor aapl_applicationBlueColor] range:tintedRange];
+    [attributedText addAttribute:NSForegroundColorAttributeName value:UIColor.aapl_applicationBlueColor range:tintedRange];
     
     // Add an image attachment.
     NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];

+ 2 - 2
Example/UICatalog/AAPLTintedToolbarViewController.m

@@ -71,8 +71,8 @@
     // See the UIBarStyle enum for more styles, including UIBarStyleDefault.
     self.toolbar.barStyle = UIBarStyleBlackTranslucent;
 
-    self.toolbar.tintColor = [UIColor aapl_applicationGreenColor];
-    self.toolbar.backgroundColor = [UIColor aapl_applicationBlueColor];
+    self.toolbar.tintColor = UIColor.aapl_applicationGreenColor;
+    self.toolbar.backgroundColor = UIColor.aapl_applicationBlueColor;
     
     NSArray *toolbarButtonItems = @[[self refreshBarButtonItem], [self flexibleSpaceBarButtonItem], [self actionBarButtonItem]];
     [self.toolbar setItems:toolbarButtonItems animated:YES];

+ 6 - 6
Example/UICatalog/AAPLWebViewController.m

@@ -69,8 +69,8 @@
 - (void)viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
     
-    if ([UIApplication sharedApplication].isNetworkActivityIndicatorVisible) {
-        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+    if (UIApplication.sharedApplication.isNetworkActivityIndicatorVisible) {
+        UIApplication.sharedApplication.networkActivityIndicatorVisible = NO;
     }
 }
 
@@ -84,7 +84,7 @@
 #pragma mark - Configuration
 
 - (void)configureWebView {
-    self.webView.backgroundColor = [UIColor whiteColor];
+    self.webView.backgroundColor = UIColor.whiteColor;
     self.webView.scalesPageToFit = YES;
     self.webView.dataDetectorTypes = UIDataDetectorTypeAll;
 }
@@ -93,11 +93,11 @@
 #pragma mark - UIWebViewDelegate
 
 - (void)webViewDidStartLoad:(UIWebView *)webView {
-    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
+    UIApplication.sharedApplication.networkActivityIndicatorVisible = YES;
 }
 
 - (void)webViewDidFinishLoad:(UIWebView *)webView {
-    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+    UIApplication.sharedApplication.networkActivityIndicatorVisible = NO;
 }
 
 - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
@@ -108,7 +108,7 @@
     NSString *errorHTML = [NSString stringWithFormat:errorFormatString, localizedErrorMessage, error.localizedDescription];
     [self.webView loadHTMLString:errorHTML baseURL:nil];
 
-    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+    UIApplication.sharedApplication.networkActivityIndicatorVisible = NO;
 }