mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-31 12:54:13 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
| //
 | |
| // FLEXBlockShortcuts.m
 | |
| //  FLEX
 | |
| //
 | |
| //  Created by Tanner on 1/30/20.
 | |
| //  Copyright © 2020 FLEX Team. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import "FLEXBlockShortcuts.h"
 | |
| #import "FLEXShortcut.h"
 | |
| #import "FLEXBlockDescription.h"
 | |
| #import "FLEXObjectExplorerFactory.h"
 | |
| 
 | |
| #pragma mark - 
 | |
| @implementation FLEXBlockShortcuts
 | |
| 
 | |
| #pragma mark Overrides
 | |
| 
 | |
| + (instancetype)forObject:(id)block {
 | |
|     NSParameterAssert([block isKindOfClass:NSClassFromString(@"NSBlock")]);
 | |
|     
 | |
|     FLEXBlockDescription *blockInfo = [FLEXBlockDescription describing:block];
 | |
|     NSMethodSignature *signature = blockInfo.signature;
 | |
|     NSArray *blockShortcutRows = @[blockInfo.summary];
 | |
|     
 | |
|     if (signature) {
 | |
|         blockShortcutRows = @[
 | |
|             blockInfo.summary,
 | |
|             blockInfo.sourceDeclaration,
 | |
|             signature.debugDescription,
 | |
|             [FLEXActionShortcut title:@"View Method Signature"
 | |
|                 subtitle:^NSString *(id block) {
 | |
|                     return signature.description ?: @"unsupported signature";
 | |
|                 }
 | |
|                 viewer:^UIViewController *(id block) {
 | |
|                     return [FLEXObjectExplorerFactory explorerViewControllerForObject:signature];
 | |
|                 }
 | |
|                 accessoryType:^UITableViewCellAccessoryType(id view) {
 | |
|                     if (signature) {
 | |
|                         return UITableViewCellAccessoryDisclosureIndicator;
 | |
|                     }
 | |
|                     return UITableViewCellAccessoryNone;
 | |
|                 }
 | |
|             ]
 | |
|         ];
 | |
|     }
 | |
|     
 | |
|     return [self forObject:block additionalRows:blockShortcutRows];
 | |
| }
 | |
| 
 | |
| - (NSString *)title {
 | |
|     return @"Metadata";
 | |
| }
 | |
| 
 | |
| - (NSInteger)numberOfLines {
 | |
|     return 0;
 | |
| }
 | |
| 
 | |
| @end
 | 
