Ryan Olson 12 rokov pred
rodič
commit
ba587b6f8a

+ 2 - 1
Classes/Object Explorers/FLEXObjectExplorerViewController.h

@@ -14,7 +14,8 @@ typedef NS_ENUM(NSUInteger, FLEXObjectExplorerSection) {
     FLEXObjectExplorerSectionProperties,
     FLEXObjectExplorerSectionProperties,
     FLEXObjectExplorerSectionIvars,
     FLEXObjectExplorerSectionIvars,
     FLEXObjectExplorerSectionMethods,
     FLEXObjectExplorerSectionMethods,
-    FLEXObjectExplorerSectionClassMethods
+    FLEXObjectExplorerSectionClassMethods,
+    FLEXObjectExplorerSectionSuperclasses
 };
 };
 
 
 @interface FLEXObjectExplorerViewController : UITableViewController
 @interface FLEXObjectExplorerViewController : UITableViewController

+ 62 - 1
Classes/Object Explorers/FLEXObjectExplorerViewController.m

@@ -56,6 +56,9 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
 @property (nonatomic, strong) NSArray *inheritedClassMethods;
 @property (nonatomic, strong) NSArray *inheritedClassMethods;
 @property (nonatomic, strong) NSArray *filteredClassMethods;
 @property (nonatomic, strong) NSArray *filteredClassMethods;
 
 
+@property (nonatomic, strong) NSArray *superclasses;
+@property (nonatomic, strong) NSArray *filteredSuperclasses;
+
 @property (nonatomic, strong) NSArray *cachedCustomSectionRowCookies;
 @property (nonatomic, strong) NSArray *cachedCustomSectionRowCookies;
 @property (nonatomic, strong) NSIndexSet *customSectionVisibleIndexes;
 @property (nonatomic, strong) NSIndexSet *customSectionVisibleIndexes;
 
 
@@ -166,6 +169,7 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
     [self updateIvars];
     [self updateIvars];
     [self updateMethods];
     [self updateMethods];
     [self updateClassMethods];
     [self updateClassMethods];
+    [self updateSuperclasses];
     [self updateDisplayedData];
     [self updateDisplayedData];
 }
 }
 
 
@@ -176,6 +180,7 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
     [self updateFilteredIvars];
     [self updateFilteredIvars];
     [self updateFilteredMethods];
     [self updateFilteredMethods];
     [self updateFilteredClassMethods];
     [self updateFilteredClassMethods];
+    [self updateFilteredSuperclasses];
     [self.tableView reloadData];
     [self.tableView reloadData];
 }
 }
 
 
@@ -451,6 +456,38 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
 }
 }
 
 
 
 
+#pragma mark - Superclasses
+
++ (NSArray *)superclassesForClass:(Class)class
+{
+    NSMutableArray *superClasses = [NSMutableArray array];
+    while ((class = [class superclass])) {
+        [superClasses addObject:class];
+    }
+    return superClasses;
+}
+
+- (void)updateSuperclasses
+{
+    self.superclasses = [[self class] superclassesForClass:[self.object class]];
+}
+
+- (void)updateFilteredSuperclasses
+{
+    if ([self.filterText length] > 0) {
+        NSMutableArray *filteredSuperclasses = [NSMutableArray array];
+        for (Class superclass in self.superclasses) {
+            if ([NSStringFromClass(superclass) rangeOfString:self.filterText options:NSCaseInsensitiveSearch].length > 0) {
+                [filteredSuperclasses addObject:superclass];
+            }
+        }
+        self.filteredSuperclasses = filteredSuperclasses;
+    } else {
+        self.filteredSuperclasses = self.superclasses;
+    }
+}
+
+
 #pragma mark - Table View Data Helpers
 #pragma mark - Table View Data Helpers
 
 
 - (NSArray *)possibleExplorerSections
 - (NSArray *)possibleExplorerSections
@@ -463,7 +500,8 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
                              @(FLEXObjectExplorerSectionProperties),
                              @(FLEXObjectExplorerSectionProperties),
                              @(FLEXObjectExplorerSectionIvars),
                              @(FLEXObjectExplorerSectionIvars),
                              @(FLEXObjectExplorerSectionMethods),
                              @(FLEXObjectExplorerSectionMethods),
-                             @(FLEXObjectExplorerSectionClassMethods)];
+                             @(FLEXObjectExplorerSectionClassMethods),
+                             @(FLEXObjectExplorerSectionSuperclasses)];
     });
     });
     return possibleSections;
     return possibleSections;
 }
 }
@@ -525,6 +563,10 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
         case FLEXObjectExplorerSectionClassMethods:
         case FLEXObjectExplorerSectionClassMethods:
             numberOfRows = [self.filteredClassMethods count];
             numberOfRows = [self.filteredClassMethods count];
             break;
             break;
+            
+        case FLEXObjectExplorerSectionSuperclasses:
+            numberOfRows = [self.filteredSuperclasses count];
+            break;
     }
     }
     return numberOfRows;
     return numberOfRows;
 }
 }
@@ -556,6 +598,9 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
         case FLEXObjectExplorerSectionClassMethods:
         case FLEXObjectExplorerSectionClassMethods:
             title = [self titleForClassMethodAtIndex:row];
             title = [self titleForClassMethodAtIndex:row];
             break;
             break;
+            
+        case FLEXObjectExplorerSectionSuperclasses:
+            title = NSStringFromClass([self.filteredSuperclasses objectAtIndex:row]);
     }
     }
     return title;
     return title;
 }
 }
@@ -584,6 +629,9 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
             
             
         case FLEXObjectExplorerSectionClassMethods:
         case FLEXObjectExplorerSectionClassMethods:
             break;
             break;
+            
+        case FLEXObjectExplorerSectionSuperclasses:
+            break;
     }
     }
     return subtitle;
     return subtitle;
 }
 }
@@ -626,6 +674,10 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
         case FLEXObjectExplorerSectionClassMethods:
         case FLEXObjectExplorerSectionClassMethods:
             canDrillIn = YES;
             canDrillIn = YES;
             break;
             break;
+            
+        case FLEXObjectExplorerSectionSuperclasses:
+            canDrillIn = YES;
+            break;
     }
     }
     return canDrillIn;
     return canDrillIn;
 }
 }
@@ -673,6 +725,10 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
             }
             }
             title = [self sectionTitleWithBaseName:@"Class Methods" totalCount:totalCount filteredCount:[self.filteredClassMethods count]];
             title = [self sectionTitleWithBaseName:@"Class Methods" totalCount:totalCount filteredCount:[self.filteredClassMethods count]];
         } break;
         } break;
+            
+        case FLEXObjectExplorerSectionSuperclasses: {
+            title = [self sectionTitleWithBaseName:@"Superclasses" totalCount:[self.superclasses count] filteredCount:[self.filteredSuperclasses count]];
+        } break;
     }
     }
     return title;
     return title;
 }
 }
@@ -717,6 +773,11 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
             Method method = [[self.filteredClassMethods objectAtIndex:row] method];
             Method method = [[self.filteredClassMethods objectAtIndex:row] method];
             viewController = [[FLEXMethodCallingViewController alloc] initWithTarget:[self.object class] method:method];
             viewController = [[FLEXMethodCallingViewController alloc] initWithTarget:[self.object class] method:method];
         } break;
         } break;
+            
+        case FLEXObjectExplorerSectionSuperclasses: {
+            Class superclass = [self.filteredSuperclasses objectAtIndex:row];
+            viewController = [FLEXObjectExplorerFactory explorerViewControllerForObject:superclass];
+        }
     }
     }
     return viewController;
     return viewController;
 }
 }