Browse Source

Prefix some categories, fix #496

Tanner Bennett 3 years ago
parent
commit
e63f2ee3ad
27 changed files with 75 additions and 72 deletions
  1. 1 1
      Classes/Core/Views/Carousel/FLEXCarouselCell.m
  2. 1 1
      Classes/Core/Views/Carousel/FLEXScopeCarousel.m
  3. 0 5
      Classes/FLEX-Categories.h
  4. 2 2
      Classes/GlobalStateExplorers/RuntimeBrowser/DataSources/FLEXRuntimeClient.m
  5. 3 3
      Classes/GlobalStateExplorers/RuntimeBrowser/FLEXKeyPathSearchController.m
  6. 1 1
      Classes/Utility/Categories/NSArray+FLEX.h
  7. 1 1
      Classes/Utility/Categories/NSArray+FLEX.m
  8. 1 1
      Classes/Utility/Categories/NSTimer+FLEX.h
  9. 1 1
      Classes/Utility/Categories/NSTimer+FLEX.m
  10. 0 0
      Classes/Utility/Categories/Private/NSDictionary+ObjcRuntime.h
  11. 0 0
      Classes/Utility/Categories/Private/NSDictionary+ObjcRuntime.m
  12. 0 0
      Classes/Utility/Categories/Private/NSMapTable+FLEX_Subscripting.h
  13. 0 0
      Classes/Utility/Categories/Private/NSMapTable+FLEX_Subscripting.m
  14. 2 2
      Classes/Utility/Categories/NSString+FLEX.h
  15. 2 2
      Classes/Utility/Categories/NSString+FLEX.m
  16. 0 0
      Classes/Utility/Categories/Private/NSString+ObjcRuntime.h
  17. 0 0
      Classes/Utility/Categories/Private/NSString+ObjcRuntime.m
  18. 23 0
      Classes/Utility/Categories/Private/UIView+FLEX_Layout.h
  19. 9 9
      Classes/Utility/Categories/UIView+FLEX_Layout.m
  20. 2 2
      Classes/Utility/Categories/UIGestureRecognizer+Blocks.h
  21. 5 5
      Classes/Utility/Categories/UIGestureRecognizer+Blocks.m
  22. 1 1
      Classes/Utility/Categories/UITextField+Range.h
  23. 1 1
      Classes/Utility/Categories/UITextField+Range.m
  24. 0 23
      Classes/Utility/Categories/UIView+FLEX_Layout.h
  25. 0 1
      Classes/Utility/FLEXUtility.h
  26. 1 0
      Classes/ViewHierarchy/TreeExplorer/FLEXHierarchyTableViewController.m
  27. 18 10
      FLEX.xcodeproj/project.pbxproj

+ 1 - 1
Classes/Core/Views/Carousel/FLEXCarouselCell.m

@@ -77,7 +77,7 @@
     self.selectionIndicatorStripe.translatesAutoresizingMaskIntoConstraints = NO;
 
     UIView *superview = self.contentView;
-    [self.titleLabel pinEdgesToSuperviewWithInsets:UIEdgeInsetsMake(10, 15, 8 + stripeHeight, 15)];
+    [self.titleLabel flex_pinEdgesToSuperviewWithInsets:UIEdgeInsetsMake(10, 15, 8 + stripeHeight, 15)];
 
     [self.selectionIndicatorStripe.leadingAnchor constraintEqualToAnchor:superview.leadingAnchor].active = YES;
     [self.selectionIndicatorStripe.bottomAnchor constraintEqualToAnchor:superview.bottomAnchor].active = YES;

+ 1 - 1
Classes/Core/Views/Carousel/FLEXScopeCarousel.m

@@ -118,7 +118,7 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
 - (void)updateConstraints {
     if (!self.constraintsInstalled) {
         self.collectionView.translatesAutoresizingMaskIntoConstraints = NO;
-        [self.collectionView pinEdgesToSuperview];
+        [self.collectionView flex_pinEdgesToSuperview];
         
         self.constraintsInstalled = YES;
     }

+ 0 - 5
Classes/FLEX-Categories.h

@@ -12,16 +12,11 @@
 #import <FLEX/CALayer+FLEX.h>
 #import <FLEX/UIFont+FLEX.h>
 #import <FLEX/UIGestureRecognizer+Blocks.h>
-#import <FLEX/UIView+FLEX_Layout.h>
 #import <FLEX/UIPasteboard+FLEX.h>
 #import <FLEX/UIMenu+FLEX.h>
 #import <FLEX/UITextField+Range.h>
 
 #import <FLEX/NSObject+FLEX_Reflection.h>
 #import <FLEX/NSArray+FLEX.h>
-#import <FLEX/NSDictionary+ObjcRuntime.h>
-#import <FLEX/NSString+ObjcRuntime.h>
-#import <FLEX/NSString+FLEX.h>
 #import <FLEX/NSUserDefaults+FLEX.h>
-#import <FLEX/NSMapTable+FLEX_Subscripting.h>
 #import <FLEX/NSTimer+FLEX.h>

+ 2 - 2
Classes/GlobalStateExplorers/RuntimeBrowser/DataSources/FLEXRuntimeClient.m

@@ -303,14 +303,14 @@ static inline NSString * TBWildcardMap(NSString *token, NSString *candidate, TBW
         if (options == TBWildcardOptionsAny) {
             return [[bundles flex_flatmapped:^NSArray *(NSString *bundlePath, NSUInteger idx) {
                 return [self classNamesInImageAtPath:bundlePath];
-            }] sortedUsingSelector:@selector(caseInsensitiveCompare:)];
+            }] flex_sortedUsingSelector:@selector(caseInsensitiveCompare:)];
         }
 
         return [[bundles flex_flatmapped:^NSArray *(NSString *bundlePath, NSUInteger idx) {
             return [[self classNamesInImageAtPath:bundlePath] flex_mapped:^id(NSString *className, NSUInteger idx) {
                 return TBWildcardMap(query, className, options);
             }];
-        }] sortedUsingSelector:@selector(caseInsensitiveCompare:)];
+        }] flex_sortedUsingSelector:@selector(caseInsensitiveCompare:)];
     }
 }
 

+ 3 - 3
Classes/GlobalStateExplorers/RuntimeBrowser/FLEXKeyPathSearchController.m

@@ -101,7 +101,7 @@
 
     // Change "Bundle.fooba" to "Bundle.foobar."
     NSString *orig = self.delegate.searchController.searchBar.text;
-    NSString *keyPath = [orig stringByReplacingLastKeyPathComponent:text];
+    NSString *keyPath = [orig flex_stringByReplacingLastKeyPathComponent:text];
     self.delegate.searchController.searchBar.text = keyPath;
 
     self.keyPath = [FLEXRuntimeKeyPathTokenizer tokenizeString:keyPath];
@@ -130,7 +130,7 @@
     // Available since at least iOS 9, still present in iOS 13
     UITextField *field = [searchBar valueForKey:@"_searchBarTextField"];
 
-    if ([self searchBar:searchBar shouldChangeTextInRange:field.selectedRange replacementText:text]) {
+    if ([self searchBar:searchBar shouldChangeTextInRange:field.flex_selectedRange replacementText:text]) {
         [field replaceRange:field.selectedTextRange withText:text];
     }
 }
@@ -266,7 +266,7 @@
             self.filteredClasses = nil;
         }
 
-        self.timer = [NSTimer fireSecondsFromNow:0.15 block:^{
+        self.timer = [NSTimer flex_fireSecondsFromNow:0.15 block:^{
             [self updateTable];
         }];
     }

+ 1 - 1
Classes/Utility/Categories/NSArray+FLEX.h

@@ -27,6 +27,6 @@
 + (instancetype)flex_forEachUpTo:(NSUInteger)bound map:(T(^)(NSUInteger i))block;
 + (instancetype)flex_mapped:(id<NSFastEnumeration>)collection block:(id(^)(T obj, NSUInteger idx))mapFunc;
 
-- (instancetype)sortedUsingSelector:(SEL)selector;
+- (instancetype)flex_sortedUsingSelector:(SEL)selector;
 
 @end

+ 1 - 1
Classes/Utility/Categories/NSArray+FLEX.m

@@ -104,7 +104,7 @@
     return array;
 }
 
-- (instancetype)sortedUsingSelector:(SEL)selector {
+- (instancetype)flex_sortedUsingSelector:(SEL)selector {
     if (FLEXArrayClassIsMutable(self)) {
         NSMutableArray *me = (id)self;
         [me sortUsingSelector:selector];

+ 1 - 1
Classes/Utility/Categories/NSTimer+FLEX.h

@@ -11,7 +11,7 @@ typedef void (^VoidBlock)(void);
 
 @interface NSTimer (Blocks)
 
-+ (instancetype)fireSecondsFromNow:(NSTimeInterval)delay block:(VoidBlock)block;
++ (instancetype)flex_fireSecondsFromNow:(NSTimeInterval)delay block:(VoidBlock)block;
 
 // Forward declaration
 //+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block;

+ 1 - 1
Classes/Utility/Categories/NSTimer+FLEX.m

@@ -14,7 +14,7 @@
 #pragma clang diagnostic ignored "-Wincomplete-implementation"
 @implementation NSTimer (Blocks)
 
-+ (instancetype)fireSecondsFromNow:(NSTimeInterval)delay block:(VoidBlock)block {
++ (instancetype)flex_fireSecondsFromNow:(NSTimeInterval)delay block:(VoidBlock)block {
     if (@available(iOS 10, *)) {
         return [self scheduledTimerWithTimeInterval:delay repeats:NO block:(id)block];
     } else {

Classes/Utility/Categories/NSDictionary+ObjcRuntime.h → Classes/Utility/Categories/Private/NSDictionary+ObjcRuntime.h


Classes/Utility/Categories/NSDictionary+ObjcRuntime.m → Classes/Utility/Categories/Private/NSDictionary+ObjcRuntime.m


Classes/Utility/Categories/NSMapTable+FLEX_Subscripting.h → Classes/Utility/Categories/Private/NSMapTable+FLEX_Subscripting.h


Classes/Utility/Categories/NSMapTable+FLEX_Subscripting.m → Classes/Utility/Categories/Private/NSMapTable+FLEX_Subscripting.m


+ 2 - 2
Classes/Utility/Categories/NSString+FLEX.h

@@ -27,7 +27,7 @@
 
 @interface NSString (KeyPaths)
 
-- (NSString *)stringByRemovingLastKeyPathComponent;
-- (NSString *)stringByReplacingLastKeyPathComponent:(NSString *)replacement;
+- (NSString *)flex_stringByRemovingLastKeyPathComponent;
+- (NSString *)flex_stringByReplacingLastKeyPathComponent:(NSString *)replacement;
 
 @end

+ 2 - 2
Classes/Utility/Categories/NSString+FLEX.m

@@ -128,7 +128,7 @@
 
 @implementation NSString (KeyPaths)
 
-- (NSString *)stringByRemovingLastKeyPathComponent {
+- (NSString *)flex_stringByRemovingLastKeyPathComponent {
     if (![self containsString:@"."]) {
         return @"";
     }
@@ -138,7 +138,7 @@
     return mself;
 }
 
-- (NSString *)stringByReplacingLastKeyPathComponent:(NSString *)replacement {
+- (NSString *)flex_stringByReplacingLastKeyPathComponent:(NSString *)replacement {
     // replacement should not have any escaped '.' in it,
     // so we escape all '.'
     if ([replacement containsString:@"."]) {

Classes/Utility/Categories/NSString+ObjcRuntime.h → Classes/Utility/Categories/Private/NSString+ObjcRuntime.h


Classes/Utility/Categories/NSString+ObjcRuntime.m → Classes/Utility/Categories/Private/NSString+ObjcRuntime.m


+ 23 - 0
Classes/Utility/Categories/Private/UIView+FLEX_Layout.h

@@ -0,0 +1,23 @@
+//
+//  UIView+FLEX_Layout.h
+//  FLEX
+//
+//  Created by Tanner Bennett on 7/18/19.
+//  Copyright © 2020 FLEX Team. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#define Padding(p) UIEdgeInsetsMake(p, p, p, p)
+
+@interface UIView (FLEX_Layout)
+
+- (void)flex_centerInView:(UIView *)view;
+- (void)flex_pinEdgesTo:(UIView *)view;
+- (void)flex_pinEdgesTo:(UIView *)view withInsets:(UIEdgeInsets)insets;
+- (void)flex_pinEdgesToSuperview;
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets;
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets aboveView:(UIView *)sibling;
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets belowView:(UIView *)sibling;
+
+@end

+ 9 - 9
Classes/Utility/Categories/UIView+FLEX_Layout.m

@@ -10,14 +10,14 @@
 
 @implementation UIView (FLEX_Layout)
 
-- (void)centerInView:(UIView *)view {
+- (void)flex_centerInView:(UIView *)view {
     [NSLayoutConstraint activateConstraints:@[
         [self.centerXAnchor constraintEqualToAnchor:view.centerXAnchor],
         [self.centerYAnchor constraintEqualToAnchor:view.centerYAnchor],
     ]];
 }
 
-- (void)pinEdgesTo:(UIView *)view {
+- (void)flex_pinEdgesTo:(UIView *)view {
    [NSLayoutConstraint activateConstraints:@[
        [self.topAnchor constraintEqualToAnchor:view.topAnchor],
        [self.leftAnchor constraintEqualToAnchor:view.leftAnchor],
@@ -26,7 +26,7 @@
    ]]; 
 }
 
-- (void)pinEdgesTo:(UIView *)view withInsets:(UIEdgeInsets)i {
+- (void)flex_pinEdgesTo:(UIView *)view withInsets:(UIEdgeInsets)i {
     [NSLayoutConstraint activateConstraints:@[
         [self.topAnchor constraintEqualToAnchor:view.topAnchor constant:i.top],
         [self.leftAnchor constraintEqualToAnchor:view.leftAnchor constant:i.left],
@@ -35,15 +35,15 @@
     ]];
 }
 
-- (void)pinEdgesToSuperview {
-    [self pinEdgesTo:self.superview];
+- (void)flex_pinEdgesToSuperview {
+    [self flex_pinEdgesTo:self.superview];
 }
 
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets {
-    [self pinEdgesTo:self.superview withInsets:insets];
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets {
+    [self flex_pinEdgesTo:self.superview withInsets:insets];
 }
 
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)i aboveView:(UIView *)sibling {
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)i aboveView:(UIView *)sibling {
     UIView *view = self.superview;
     [NSLayoutConstraint activateConstraints:@[
         [self.topAnchor constraintEqualToAnchor:view.topAnchor constant:i.top],
@@ -53,7 +53,7 @@
     ]];
 }
 
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)i belowView:(UIView *)sibling {
+- (void)flex_pinEdgesToSuperviewWithInsets:(UIEdgeInsets)i belowView:(UIView *)sibling {
     UIView *view = self.superview;
     [NSLayoutConstraint activateConstraints:@[
         [self.topAnchor constraintEqualToAnchor:sibling.bottomAnchor constant:i.top],

+ 2 - 2
Classes/Utility/Categories/UIGestureRecognizer+Blocks.h

@@ -13,9 +13,9 @@ typedef void (^GestureBlock)(UIGestureRecognizer *gesture);
 
 @interface UIGestureRecognizer (Blocks)
 
-+ (instancetype)action:(GestureBlock)action;
++ (instancetype)flex_action:(GestureBlock)action;
 
-@property (nonatomic) GestureBlock action;
+@property (nonatomic, setter=flex_setAction:) GestureBlock flex_action;
 
 @end
 

+ 5 - 5
Classes/Utility/Categories/UIGestureRecognizer+Blocks.m

@@ -14,22 +14,22 @@
 
 static void * actionKey;
 
-+ (instancetype)action:(GestureBlock)action {
++ (instancetype)flex_action:(GestureBlock)action {
     UIGestureRecognizer *gesture = [[self alloc] initWithTarget:nil action:nil];
     [gesture addTarget:gesture action:@selector(flex_invoke)];
-    gesture.action = action;
+    gesture.flex_action = action;
     return gesture;
 }
 
 - (void)flex_invoke {
-    self.action(self);
+    self.flex_action(self);
 }
 
-- (GestureBlock)action {
+- (GestureBlock)flex_action {
     return objc_getAssociatedObject(self, &actionKey);
 }
 
-- (void)setAction:(GestureBlock)action {
+- (void)flex_setAction:(GestureBlock)action {
     objc_setAssociatedObject(self, &actionKey, action, OBJC_ASSOCIATION_COPY);
 }
 

+ 1 - 1
Classes/Utility/Categories/UITextField+Range.h

@@ -9,6 +9,6 @@
 
 @interface UITextField (Range)
 
-@property (nonatomic, readonly) NSRange selectedRange;
+@property (nonatomic, readonly) NSRange flex_selectedRange;
 
 @end

+ 1 - 1
Classes/Utility/Categories/UITextField+Range.m

@@ -9,7 +9,7 @@
 
 @implementation UITextField (Range)
 
-- (NSRange)selectedRange {
+- (NSRange)flex_selectedRange {
     UITextRange *r = self.selectedTextRange;
     if (r) {
         NSInteger loc = [self offsetFromPosition:self.beginningOfDocument toPosition:r.start];

+ 0 - 23
Classes/Utility/Categories/UIView+FLEX_Layout.h

@@ -1,23 +0,0 @@
-//
-//  UIView+FLEX_Layout.h
-//  FLEX
-//
-//  Created by Tanner Bennett on 7/18/19.
-//  Copyright © 2020 FLEX Team. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-#define Padding(p) UIEdgeInsetsMake(p, p, p, p)
-
-@interface UIView (FLEX_Layout)
-
-- (void)centerInView:(UIView *)view;
-- (void)pinEdgesTo:(UIView *)view;
-- (void)pinEdgesTo:(UIView *)view withInsets:(UIEdgeInsets)insets;
-- (void)pinEdgesToSuperview;
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets;
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets aboveView:(UIView *)sibling;
-- (void)pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets belowView:(UIView *)sibling;
-
-@end

+ 0 - 1
Classes/Utility/FLEXUtility.h

@@ -15,7 +15,6 @@
 #import "FLEXAlert.h"
 #import "NSArray+FLEX.h"
 #import "UIFont+FLEX.h"
-#import "NSMapTable+FLEX_Subscripting.h"
 #import "FLEXMacros.h"
 
 #if !FLEX_AT_LEAST_IOS13_SDK

+ 1 - 0
Classes/ViewHierarchy/TreeExplorer/FLEXHierarchyTableViewController.m

@@ -8,6 +8,7 @@
 
 #import "FLEXColor.h"
 #import "FLEXHierarchyTableViewController.h"
+#import "NSMapTable+FLEX_Subscripting.h"
 #import "FLEXUtility.h"
 #import "FLEXHierarchyTableViewCell.h"
 #import "FLEXObjectExplorerViewController.h"

+ 18 - 10
FLEX.xcodeproj/project.pbxproj

@@ -1087,6 +1087,23 @@
 			path = Objc;
 			sourceTree = "<group>";
 		};
+		C31E4E53259D4A4100712288 /* Private */ = {
+			isa = PBXGroup;
+			children = (
+				C362AE7F23C7E9D1005A86AE /* NSMapTable+FLEX_Subscripting.h */,
+				C362AE8023C7E9D1005A86AE /* NSMapTable+FLEX_Subscripting.m */,
+				C387C88122E0D24A00750E58 /* UIView+FLEX_Layout.h */,
+				C387C88222E0D24A00750E58 /* UIView+FLEX_Layout.m */,
+				C3F9777F2311B38F0032776D /* NSDictionary+ObjcRuntime.h */,
+				C3F9777E2311B38E0032776D /* NSDictionary+ObjcRuntime.m */,
+				C3F9777D2311B38E0032776D /* NSString+ObjcRuntime.h */,
+				C3F977802311B38F0032776D /* NSString+ObjcRuntime.m */,
+				C398627423AD79B6007E6793 /* NSString+FLEX.h */,
+				C398627523AD79B7007E6793 /* NSString+FLEX.m */,
+			);
+			path = Private;
+			sourceTree = "<group>";
+		};
 		C33CF16B22D664E600F9C6C0 /* FileBrowser */ = {
 			isa = PBXGroup;
 			children = (
@@ -1216,10 +1233,9 @@
 		C387C88022E0D22600750E58 /* Categories */ = {
 			isa = PBXGroup;
 			children = (
+				C31E4E53259D4A4100712288 /* Private */,
 				C3DFCDB62418336D00BB7084 /* NSUserDefaults+FLEX.h */,
 				C3DFCDB72418336D00BB7084 /* NSUserDefaults+FLEX.m */,
-				C387C88122E0D24A00750E58 /* UIView+FLEX_Layout.h */,
-				C387C88222E0D24A00750E58 /* UIView+FLEX_Layout.m */,
 				C398627023AD7951007E6793 /* UIGestureRecognizer+Blocks.h */,
 				C398627123AD7951007E6793 /* UIGestureRecognizer+Blocks.m */,
 				C3F646BF239EAA8F00D4A011 /* UIPasteboard+FLEX.h */,
@@ -1234,18 +1250,10 @@
 				C3BFD06F233C23ED0015FB82 /* NSArray+FLEX.m */,
 				C3F977812311B38F0032776D /* NSObject+FLEX_Reflection.h */,
 				C3F977822311B38F0032776D /* NSObject+FLEX_Reflection.m */,
-				C3F9777F2311B38F0032776D /* NSDictionary+ObjcRuntime.h */,
-				C3F9777E2311B38E0032776D /* NSDictionary+ObjcRuntime.m */,
-				C3F9777D2311B38E0032776D /* NSString+ObjcRuntime.h */,
-				C3F977802311B38F0032776D /* NSString+ObjcRuntime.m */,
-				C398627423AD79B6007E6793 /* NSString+FLEX.h */,
-				C398627523AD79B7007E6793 /* NSString+FLEX.m */,
 				C3E5D9FB2316E83700E655DB /* FLEXRuntime+Compare.h */,
 				C3E5D9FC2316E83700E655DB /* FLEXRuntime+Compare.m */,
 				C34C9BDB23A7F2740031CA3E /* FLEXRuntime+UIKitHelpers.h */,
 				C34C9BDC23A7F2740031CA3E /* FLEXRuntime+UIKitHelpers.m */,
-				C362AE7F23C7E9D1005A86AE /* NSMapTable+FLEX_Subscripting.h */,
-				C362AE8023C7E9D1005A86AE /* NSMapTable+FLEX_Subscripting.m */,
 				C36B096323E0D4A1008F5D47 /* UIMenu+FLEX.h */,
 				C36B096423E0D4A1008F5D47 /* UIMenu+FLEX.m */,
 				C3694DC023EA147F006625D7 /* UIBarButtonItem+FLEX.h */,