|
|
@@ -9,12 +9,15 @@
|
|
|
#import "FLEXMethodCallingViewController.h"
|
|
|
#import "FLEXRuntimeUtility.h"
|
|
|
#import "FLEXFieldEditorView.h"
|
|
|
+#import "FLEXObjectExplorerFactory.h"
|
|
|
+#import "FLEXObjectExplorerViewController.h"
|
|
|
#import "FLEXArgumentInputView.h"
|
|
|
#import "FLEXArgumentInputViewFactory.h"
|
|
|
|
|
|
@interface FLEXMethodCallingViewController ()
|
|
|
|
|
|
@property (nonatomic, assign) Method method;
|
|
|
+@property (nonatomic, assign) FLEXTypeEncoding *returnType;
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -25,7 +28,8 @@
|
|
|
self = [super initWithTarget:target];
|
|
|
if (self) {
|
|
|
self.method = method;
|
|
|
- self.title = [self isClassMethod] ? @"Class Method" : @"Method";
|
|
|
+ self.returnType = [FLEXRuntimeUtility returnTypeForMethod:method];
|
|
|
+ self.title = [self isClassMethod] ? @"Class Method" : @"Method";;
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
@@ -34,7 +38,11 @@
|
|
|
{
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
- self.fieldEditorView.fieldDescription = [FLEXRuntimeUtility prettyNameForMethod:self.method isClassMethod:[self isClassMethod]];
|
|
|
+ NSString *returnType = @((const char *)self.returnType);
|
|
|
+ NSString *methodDescription = [FLEXRuntimeUtility prettyNameForMethod:self.method isClassMethod:[self isClassMethod]];
|
|
|
+ NSString *format = @"Signature:\n%@\n\nReturn Type:\n%@";
|
|
|
+ NSString *info = [NSString stringWithFormat:format, methodDescription, returnType];
|
|
|
+ self.fieldEditorView.fieldDescription = info;
|
|
|
|
|
|
NSArray<NSString *> *methodComponents = [FLEXRuntimeUtility prettyArgumentComponentsForMethod:self.method];
|
|
|
NSMutableArray<FLEXArgumentInputView *> *argumentInputViews = [NSMutableArray array];
|
|
|
@@ -52,6 +60,12 @@
|
|
|
self.fieldEditorView.argumentInputViews = argumentInputViews;
|
|
|
}
|
|
|
|
|
|
+- (void)dealloc
|
|
|
+{
|
|
|
+ free(self.returnType);
|
|
|
+ self.returnType = NULL;
|
|
|
+}
|
|
|
+
|
|
|
- (BOOL)isClassMethod
|
|
|
{
|
|
|
return self.target && self.target == [self.target class];
|
|
|
@@ -84,6 +98,11 @@
|
|
|
NSString *message = [error localizedDescription];
|
|
|
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
|
|
|
[alert show];
|
|
|
+ } else if (returnedObject) {
|
|
|
+ // For non-nil (or void) return types, push an explorer view controller to display the returned object
|
|
|
+ returnedObject = [FLEXRuntimeUtility potentiallyUnwrapBoxedPointer:returnedObject type:self.returnType];
|
|
|
+ FLEXObjectExplorerViewController *explorerViewController = [FLEXObjectExplorerFactory explorerViewControllerForObject:returnedObject];
|
|
|
+ [self.navigationController pushViewController:explorerViewController animated:YES];
|
|
|
} else {
|
|
|
[self exploreObjectOrPopViewController:returnedObject];
|
|
|
}
|