Skip to content

Commit

Permalink
Fix bug in new FLEXMirror usage
Browse files Browse the repository at this point in the history
  • Loading branch information
NSExceptional committed Apr 27, 2022
1 parent a31da07 commit 8e1db20
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Classes/ObjectExplorers/FLEXObjectExplorer.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,21 @@ - (id)initWithObject:(id)objectOrClass {
return self;
}

- (id<FLEXMirror>)initialMirror {
- (id<FLEXMirror>)mirrorForClass:(Class)cls {
static Class FLEXSwiftMirror = nil;

id obj = _object;

// Should we use Reflex?
if (FLEXIsSwiftObjectOrClass(obj) && FLEXObjectExplorer.reflexAvailable) {
if (FLEXIsSwiftObjectOrClass(cls) && FLEXObjectExplorer.reflexAvailable) {
// Initialize FLEXSwiftMirror class if needed
if (!FLEXSwiftMirror) {
FLEXSwiftMirror = NSClassFromString(@"FLEXSwiftMirror");
}

return [(id<FLEXMirror>)[FLEXSwiftMirror alloc] initWithSubject:obj];
return [(id<FLEXMirror>)[FLEXSwiftMirror alloc] initWithSubject:cls];
}

// No; not swift object, or Reflex unavailable
return [FLEXMirror reflect:obj];
return [FLEXMirror reflect:cls];
}


Expand Down Expand Up @@ -178,9 +176,9 @@ - (void)reloadMetadata {
Class superclass = nil;
NSInteger count = self.classHierarchyClasses.count;
NSInteger rootIdx = count - 1;
id<FLEXMirror> mirror = self.initialMirror;
for (NSInteger i = 0; i < count; i++) {
Class cls = self.classHierarchyClasses[i];
id<FLEXMirror> mirror = [self mirrorForClass:cls];
superclass = (i < rootIdx) ? self.classHierarchyClasses[i+1] : nil;

[allProperties addObject:[self
Expand Down

0 comments on commit 8e1db20

Please sign in to comment.