Skip to content

Commit

Permalink
Class Methods view. Properties view.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGabilondoAngulo committed Sep 15, 2019
1 parent da2a42b commit 8543543
Show file tree
Hide file tree
Showing 21 changed files with 1,092 additions and 164 deletions.
26 changes: 24 additions & 2 deletions Organismo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
03007BB1232A1C3700DAF421 /* ORGElementPropertiesView.h in Headers */ = {isa = PBXBuildFile; fileRef = 03007BAF232A1C3700DAF421 /* ORGElementPropertiesView.h */; };
03007BB2232A1C3700DAF421 /* ORGElementPropertiesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 03007BB0232A1C3700DAF421 /* ORGElementPropertiesView.m */; };
0300F9D922EECA73007DF323 /* ORGUITreeNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0300F9D722EECA73007DF323 /* ORGUITreeNode.m */; };
0300F9DA22EECA73007DF323 /* ORGUITreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0300F9D822EECA73007DF323 /* ORGUITreeNode.h */; };
031F745F1D4015F400DDC876 /* UITextView+ORG.h in Headers */ = {isa = PBXBuildFile; fileRef = 031F745D1D4015F400DDC876 /* UITextView+ORG.h */; };
Expand Down Expand Up @@ -85,6 +87,8 @@
03A06CC92033752D00751692 /* ORGRequestClassHierarchy.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A06CC72033752D00751692 /* ORGRequestClassHierarchy.h */; };
03A06CCA2033752D00751692 /* ORGRequestClassHierarchy.m in Sources */ = {isa = PBXBuildFile; fileRef = 03A06CC82033752D00751692 /* ORGRequestClassHierarchy.m */; };
03A89A6F1D92CCE7000AB035 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 033677F31D3E6974009B86A4 /* UIKit.framework */; };
03AF319D232ABE2E00437482 /* ORGElementClassView.h in Headers */ = {isa = PBXBuildFile; fileRef = 03AF319B232ABE2E00437482 /* ORGElementClassView.h */; };
03AF319E232ABE2E00437482 /* ORGElementClassView.m in Sources */ = {isa = PBXBuildFile; fileRef = 03AF319C232ABE2E00437482 /* ORGElementClassView.m */; };
03B588B21D04082D0083DF15 /* NSDate+ORG.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B588B01D04082D0083DF15 /* NSDate+ORG.h */; };
03B588B31D04082D0083DF15 /* NSDate+ORG.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B588B11D04082D0083DF15 /* NSDate+ORG.m */; };
03C2CD001E9395DB00508AD9 /* ORGRequestLongPress.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C2CCFE1E9395DB00508AD9 /* ORGRequestLongPress.h */; };
Expand Down Expand Up @@ -193,6 +197,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
03007BAF232A1C3700DAF421 /* ORGElementPropertiesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ORGElementPropertiesView.h; path = Organismo/ORGElementPropertiesView.h; sourceTree = "<group>"; };
03007BB0232A1C3700DAF421 /* ORGElementPropertiesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ORGElementPropertiesView.m; path = Organismo/ORGElementPropertiesView.m; sourceTree = "<group>"; };
0300F9D722EECA73007DF323 /* ORGUITreeNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ORGUITreeNode.m; path = Organismo/Mac/ORGUITreeNode.m; sourceTree = "<group>"; };
0300F9D822EECA73007DF323 /* ORGUITreeNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ORGUITreeNode.h; path = Organismo/Mac/ORGUITreeNode.h; sourceTree = "<group>"; };
0300F9DD22EECB56007DF323 /* mac-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "mac-Info.plist"; path = "Organismo/Mac/mac-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -271,6 +277,8 @@
039DA6D71D8EBC3000F6937A /* ORGRequestTap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ORGRequestTap.m; sourceTree = "<group>"; };
03A06CC72033752D00751692 /* ORGRequestClassHierarchy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORGRequestClassHierarchy.h; sourceTree = "<group>"; };
03A06CC82033752D00751692 /* ORGRequestClassHierarchy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORGRequestClassHierarchy.m; sourceTree = "<group>"; };
03AF319B232ABE2E00437482 /* ORGElementClassView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ORGElementClassView.h; path = Organismo/Mac/ORGElementClassView.h; sourceTree = "<group>"; };
03AF319C232ABE2E00437482 /* ORGElementClassView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ORGElementClassView.m; path = Organismo/Mac/ORGElementClassView.m; sourceTree = "<group>"; };
03B588B01D04082D0083DF15 /* NSDate+ORG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+ORG.h"; sourceTree = "<group>"; };
03B588B11D04082D0083DF15 /* NSDate+ORG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+ORG.m"; sourceTree = "<group>"; };
03C2CCFE1E9395DB00508AD9 /* ORGRequestLongPress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ORGRequestLongPress.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -450,10 +458,14 @@
034B1B6422CFA7F300CFEDD0 /* ORGUITree.m */,
0300F9D822EECA73007DF323 /* ORGUITreeNode.h */,
0300F9D722EECA73007DF323 /* ORGUITreeNode.m */,
0394907722D335BE0029BB9B /* ORGInspectorWindowController.h */,
0394907822D335BE0029BB9B /* ORGInspectorWindowController.m */,
0394907F22D351790029BB9B /* ORGTableCellView.h */,
0394908022D351790029BB9B /* ORGTableCellView.m */,
0394907722D335BE0029BB9B /* ORGInspectorWindowController.h */,
0394907822D335BE0029BB9B /* ORGInspectorWindowController.m */,
03007BAF232A1C3700DAF421 /* ORGElementPropertiesView.h */,
03007BB0232A1C3700DAF421 /* ORGElementPropertiesView.m */,
03AF319B232ABE2E00437482 /* ORGElementClassView.h */,
03AF319C232ABE2E00437482 /* ORGElementClassView.m */,
033DCF9C22D4D69A00295555 /* Categories */,
034B1B6222CE4FA000CFEDD0 /* Resources */,
0300F9DC22EECB40007DF323 /* Supporting Files */,
Expand Down Expand Up @@ -783,10 +795,12 @@
039C338C22C7D63600E61DA8 /* Organismo.h in Headers */,
032C9FE822C8CC2600B2DBEA /* OrganismoPrefixHeader-mac.pch in Headers */,
033DCF9F22D4D6C800295555 /* NSWindow+ORG.h in Headers */,
03AF319D232ABE2E00437482 /* ORGElementClassView.h in Headers */,
0300F9DA22EECA73007DF323 /* ORGUITreeNode.h in Headers */,
0394908122D351790029BB9B /* ORGTableCellView.h in Headers */,
034B1B6022CE4F9A00CFEDD0 /* ORGNSViewHierarchy.h in Headers */,
0394907A22D335BE0029BB9B /* ORGInspectorWindowController.h in Headers */,
03007BB1232A1C3700DAF421 /* ORGElementPropertiesView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -943,6 +957,7 @@
TargetAttributes = {
039C32F422C7D63600E61DA8 = {
DevelopmentTeam = NRRF7234ZC;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
};
03DA66861CBCEE4700E26CAA = {
Expand Down Expand Up @@ -1095,9 +1110,11 @@
033DCFA422D4D6EA00295555 /* NSControl+ORG.m in Sources */,
034B1B6622CFA7F300CFEDD0 /* ORGUITree.m in Sources */,
0394907B22D335BE0029BB9B /* ORGInspectorWindowController.m in Sources */,
03AF319E232ABE2E00437482 /* ORGElementClassView.m in Sources */,
034B1B6122CE4F9A00CFEDD0 /* ORGNSViewHierarchy.m in Sources */,
033DCFA822D4D70200295555 /* NSButton+ORG.m in Sources */,
032C9FE622C8CA2700B2DBEA /* NSApplication+ORG.m in Sources */,
03007BB2232A1C3700DAF421 /* ORGElementPropertiesView.m in Sources */,
033DCFA022D4D6C800295555 /* NSWindow+ORG.m in Sources */,
0394908222D351790029BB9B /* ORGTableCellView.m in Sources */,
);
Expand Down Expand Up @@ -1203,6 +1220,7 @@
039C339222C7D63600E61DA8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -1241,13 +1259,16 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 0;
};
name = Debug;
};
039C339322C7D63600E61DA8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -1286,6 +1307,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 0;
};
name = Release;
Expand Down
95 changes: 95 additions & 0 deletions Organismo.xcodeproj/xcshareddata/xcschemes/Organismo-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03DA66861CBCEE4700E26CAA"
BuildableName = "Organismo-iOS.framework"
BlueprintName = "Organismo-iOS"
ReferencedContainer = "container:Organismo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03DA66861CBCEE4700E26CAA"
BuildableName = "Organismo-iOS.framework"
BlueprintName = "Organismo-iOS"
ReferencedContainer = "container:Organismo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03DA66901CBCEE4700E26CAA"
BuildableName = "OrganismoTests.xctest"
BlueprintName = "OrganismoTests"
ReferencedContainer = "container:Organismo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03DA66861CBCEE4700E26CAA"
BuildableName = "Organismo-iOS.framework"
BlueprintName = "Organismo-iOS"
ReferencedContainer = "container:Organismo.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03DA66861CBCEE4700E26CAA"
BuildableName = "Organismo-iOS.framework"
BlueprintName = "Organismo-iOS"
ReferencedContainer = "container:Organismo.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "NSScrollView.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "NSScrollView-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "NSScrollView-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Organismo/Mac/ORGElementClassView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ORGElementClassView.h
// Organismo-mac
//
// Created by Jon Gabilondo on 12/09/2019.
// Copyright © 2019 organismo-mobile. All rights reserved.
//

#import <Cocoa/Cocoa.h>

NS_ASSUME_NONNULL_BEGIN

@class ORGUITreeNode;

@interface ORGElementClassView : NSView

- (void)showElement:(ORGUITreeNode*)node;

@end

NS_ASSUME_NONNULL_END
72 changes: 72 additions & 0 deletions Organismo/Mac/ORGElementClassView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// ORGElementClassView.m
// Organismo-mac
//
// Created by Jon Gabilondo on 12/09/2019.
// Copyright © 2019 organismo-mobile. All rights reserved.
//

#import "ORGElementClassView.h"
#import "ORGUITreeNode.h"
#import <objc/runtime.h>

@interface ORGElementClassView()

@property (weak) IBOutlet NSTableView *methodsTableView;
@property (strong) IBOutlet NSArrayController *methodsArrayController;

@property (nonatomic) ORGUITreeNode *node;
@property (nonatomic) NSMutableArray<NSString*> *methods;
@property (nonatomic) NSArray<NSString*> *classHierarchy;

- (NSArray*)buildClassHierarchy:(Class)class;
- (void)showClass:(Class)class;
@end

@implementation ORGElementClassView

- (void)showElement:(ORGUITreeNode*)node {

self.node = node;
self.classHierarchy = [self buildClassHierarchy:node.uiElement.class];
[self showClass:node.uiElement.class];
}

- (NSArray*)buildClassHierarchy:(Class)class {
NSMutableArray *hierarchy = [NSMutableArray array];
for ( Class currentClass = class; currentClass; currentClass = currentClass.superclass) {
[hierarchy addObject:NSStringFromClass(currentClass)];
}
return hierarchy;
}

- (IBAction)hierarchyPathChanged:(NSPopUpButton *)sender {

NSString *className = self.classHierarchy[sender.indexOfSelectedItem];
if (!className) {
return;
}
[self showClass:NSClassFromString(className)];
}

- (void)showClass:(Class)class {

if (self.methods) {
[self.methodsArrayController removeObjects:self.methods];
} else {
self.methods = [NSMutableArray array];
self.methodsArrayController.content = self.methods;
}

unsigned int classCount;
Method *methodsList = class_copyMethodList(class, &classCount);
for (unsigned int i = 0; i < classCount; i++) {
SEL selector = method_getName(methodsList[i]);
[self.methodsArrayController addObject:NSStringFromSelector(selector)];
}
free(methodsList);

[self.methodsTableView reloadData];
}

@end
7 changes: 7 additions & 0 deletions Organismo/Mac/ORGInspectorWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

NS_ASSUME_NONNULL_BEGIN

@class ORGUITreeNode;

@interface ORGInspectorWindowController : NSWindowController <NSWindowDelegate>

@property (nonatomic) NSString *classHierarchy;
@property (nonatomic, nullable) ORGUITreeNode *selectedNode;
@property (strong) IBOutlet NSArrayController *methodsArrayController;


@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 8543543

Please sign in to comment.