Skip to content

Commit

Permalink
Merge pull request #56 from OdNairy/class_in_object_source
Browse files Browse the repository at this point in the history
Support Class object in ObjectSource
  • Loading branch information
Legoless committed Sep 27, 2015
2 parents f891080 + 7eaa22b commit 47def92
Show file tree
Hide file tree
Showing 4 changed files with 294 additions and 270 deletions.
5 changes: 5 additions & 0 deletions Alpha/Model/Object/ALPHAObjectModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
@property (nonatomic, copy) NSString *objectClass;

/*!
* Check is the object is the Class structure
*/
@property (nonatomic, readonly) BOOL objectIsClass;

/*!
* Contains the class name of Apple superclass - usually NSObject, but can be array, set,
* or UIKit. Nil if class or metaclass. This is to ensure we can handle view controller
Expand Down
3 changes: 3 additions & 0 deletions Alpha/Model/Object/ALPHAObjectModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
//

#import "ALPHAObjectModel.h"
#import "ALPHARuntimeUtility.h"

@implementation ALPHAObjectModel

- (void)setObjectPointer:(NSString *)objectPointer
{
_objectPointer = objectPointer;
id<NSObject> object = [ALPHARuntimeUtility objectForPointerString:objectPointer className:nil];
self->_objectIsClass = [object class] == object;

[self updateReferencesWithObjectPointer:objectPointer objectClass:nil];
}
Expand Down
5 changes: 4 additions & 1 deletion Alpha/Plugins/Global/Sources/ALPHAClassSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "ALPHARuntimeUtility.h"

#import "ALPHAClassSource.h"
#import "ALPHAObjectSource.h"

NSString* const ALPHAClassDataIdentifier = @"com.unifiedsense.alpha.data.class";
NSString* const ALPHAClassBinaryParameterKey = @"kALPHAClassBinaryParameterKey";
Expand Down Expand Up @@ -56,7 +57,9 @@ - (ALPHAModel *)modelForRequest:(ALPHARequest *)request
{
ALPHAScreenItem* item = [[ALPHAScreenItem alloc] init];
item.title = class;
item.object = NSClassFromString(class);

ALPHARequest* request = [ALPHARequest requestForObject:NSClassFromString(class)];
item.object = request;

[items addObject:item];
}
Expand Down
Loading

0 comments on commit 47def92

Please sign in to comment.