|
@@ -21,7 +21,7 @@
|
|
|
#import "FLEXUtility.h"
|
|
#import "FLEXUtility.h"
|
|
|
|
|
|
|
|
@implementation FLEXObjectExplorerFactory
|
|
@implementation FLEXObjectExplorerFactory
|
|
|
-static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
|
|
|
|
|
|
|
+static NSMutableDictionary<id<NSCopying>, Class> *classesToRegisteredSections = nil;
|
|
|
|
|
|
|
|
+ (void)initialize {
|
|
+ (void)initialize {
|
|
|
if (self == [FLEXObjectExplorerFactory class]) {
|
|
if (self == [FLEXObjectExplorerFactory class]) {
|
|
@@ -33,9 +33,9 @@ static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
|
|
|
// For example, if we used class names, this would result in
|
|
// For example, if we used class names, this would result in
|
|
|
// the object explorer trying to render a color preview for
|
|
// the object explorer trying to render a color preview for
|
|
|
// the UIColor class object, which is not a color itself.
|
|
// the UIColor class object, which is not a color itself.
|
|
|
- #define ClassKey(name) (Class<NSCopying>)[name class]
|
|
|
|
|
- #define ClassKeyByName(str) (Class<NSCopying>)NSClassFromString(@ #str)
|
|
|
|
|
- #define MetaclassKey(meta) (Class<NSCopying>)object_getClass([meta class])
|
|
|
|
|
|
|
+ #define ClassKey(name) (id<NSCopying>)[name class]
|
|
|
|
|
+ #define ClassKeyByName(str) (id<NSCopying>)NSClassFromString(@ #str)
|
|
|
|
|
+ #define MetaclassKey(meta) (id<NSCopying>)object_getClass([meta class])
|
|
|
classesToRegisteredSections = [NSMutableDictionary dictionaryWithDictionary:@{
|
|
classesToRegisteredSections = [NSMutableDictionary dictionaryWithDictionary:@{
|
|
|
MetaclassKey(NSObject) : [FLEXClassShortcuts class],
|
|
MetaclassKey(NSObject) : [FLEXClassShortcuts class],
|
|
|
ClassKey(NSArray) : [FLEXCollectionContentSection class],
|
|
ClassKey(NSArray) : [FLEXCollectionContentSection class],
|
|
@@ -75,7 +75,7 @@ static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
|
|
|
Class sectionClass = nil;
|
|
Class sectionClass = nil;
|
|
|
Class cls = object_getClass(object);
|
|
Class cls = object_getClass(object);
|
|
|
do {
|
|
do {
|
|
|
- sectionClass = classesToRegisteredSections[(Class<NSCopying>)cls];
|
|
|
|
|
|
|
+ sectionClass = classesToRegisteredSections[(id<NSCopying>)cls];
|
|
|
} while (!sectionClass && (cls = [cls superclass]));
|
|
} while (!sectionClass && (cls = [cls superclass]));
|
|
|
|
|
|
|
|
if (!sectionClass) {
|
|
if (!sectionClass) {
|
|
@@ -89,7 +89,7 @@ static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ (void)registerExplorerSection:(Class)explorerClass forClass:(Class)objectClass {
|
|
+ (void)registerExplorerSection:(Class)explorerClass forClass:(Class)objectClass {
|
|
|
- classesToRegisteredSections[(Class<NSCopying>)objectClass] = explorerClass;
|
|
|
|
|
|
|
+ classesToRegisteredSections[(id<NSCopying>)objectClass] = explorerClass;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - FLEXGlobalsEntry
|
|
#pragma mark - FLEXGlobalsEntry
|
|
@@ -184,7 +184,7 @@ static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
|
|
|
return [self explorerViewControllerForObject:NSThread.mainThread];
|
|
return [self explorerViewControllerForObject:NSThread.mainThread];
|
|
|
case FLEXGlobalsRowOperationQueue:
|
|
case FLEXGlobalsRowOperationQueue:
|
|
|
return [self explorerViewControllerForObject:NSOperationQueue.mainQueue];
|
|
return [self explorerViewControllerForObject:NSOperationQueue.mainQueue];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
case FLEXGlobalsRowKeyWindow:
|
|
case FLEXGlobalsRowKeyWindow:
|
|
|
return [FLEXObjectExplorerFactory
|
|
return [FLEXObjectExplorerFactory
|
|
|
explorerViewControllerForObject:FLEXUtility.appKeyWindow
|
|
explorerViewControllerForObject:FLEXUtility.appKeyWindow
|