|
|
@@ -104,31 +104,33 @@
|
|
|
|
|
|
- (void)registerGlobalEntryWithName:(NSString *)entryName objectFutureBlock:(id (^)(void))objectFutureBlock
|
|
|
{
|
|
|
- [self registerGlobalEntryWithName:entryName objectFutureBlock:objectFutureBlock forceObjectExplorer:YES];
|
|
|
+ NSParameterAssert(entryName);
|
|
|
+ NSParameterAssert(objectFutureBlock);
|
|
|
+ NSAssert([NSThread isMainThread], @"This method must be called from the main thread.");
|
|
|
+
|
|
|
+ entryName = entryName.copy;
|
|
|
+ FLEXGlobalsTableViewControllerEntry *entry = [FLEXGlobalsTableViewControllerEntry entryWithNameFuture:^NSString *{
|
|
|
+ return entryName;
|
|
|
+ } viewControllerFuture:^UIViewController *{
|
|
|
+ return [FLEXObjectExplorerFactory explorerViewControllerForObject:objectFutureBlock()];
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.userGlobalEntries addObject:entry];
|
|
|
}
|
|
|
|
|
|
-- (void)registerGlobalEntryWithName:(NSString *)entryName
|
|
|
- objectFutureBlock:(id (^)(void))objectFutureBlock
|
|
|
- forceObjectExplorer:(BOOL)forceObjectExplorer
|
|
|
+- (void)registerGlobalEntryWithName:(NSString *)entryName viewControllerFutureBlock:(UIViewController * (^)(void))viewControllerFutureBlock
|
|
|
{
|
|
|
NSParameterAssert(entryName);
|
|
|
- NSParameterAssert(objectFutureBlock);
|
|
|
+ NSParameterAssert(viewControllerFutureBlock);
|
|
|
NSAssert([NSThread isMainThread], @"This method must be called from the main thread.");
|
|
|
|
|
|
entryName = entryName.copy;
|
|
|
FLEXGlobalsTableViewControllerEntry *entry = [FLEXGlobalsTableViewControllerEntry entryWithNameFuture:^NSString *{
|
|
|
return entryName;
|
|
|
} viewControllerFuture:^UIViewController *{
|
|
|
- id object = objectFutureBlock();
|
|
|
-
|
|
|
- if([object_getClass(object) isSubclassOfClass:[UIViewController class]] && forceObjectExplorer == NO)
|
|
|
- {
|
|
|
- return object;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return [FLEXObjectExplorerFactory explorerViewControllerForObject:object];
|
|
|
- }
|
|
|
+ UIViewController *viewController = viewControllerFutureBlock();
|
|
|
+ NSCAssert(viewController, @"'%@' entry returned nil viewController. viewControllerFutureBlock should never return nil.", entryName);
|
|
|
+ return viewControllerFutureBlock();
|
|
|
}];
|
|
|
|
|
|
[self.userGlobalEntries addObject:entry];
|