mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-31 04:44:14 -04:00 
			
		
		
		
	added files via upload
This commit is contained in:
		
							
								
								
									
										36
									
								
								Tweaks/FLEX/Utility/Categories/UIGestureRecognizer+Blocks.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Tweaks/FLEX/Utility/Categories/UIGestureRecognizer+Blocks.m
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| // | ||||
| //  UIGestureRecognizer+Blocks.m | ||||
| //  FLEX | ||||
| // | ||||
| //  Created by Tanner Bennett on 12/20/19. | ||||
| //  Copyright © 2020 FLEX Team. All rights reserved. | ||||
| // | ||||
|  | ||||
| #import "UIGestureRecognizer+Blocks.h" | ||||
| #import <objc/runtime.h> | ||||
|  | ||||
|  | ||||
| @implementation UIGestureRecognizer (Blocks) | ||||
|  | ||||
| static void * actionKey; | ||||
|  | ||||
| + (instancetype)flex_action:(GestureBlock)action { | ||||
|     UIGestureRecognizer *gesture = [[self alloc] initWithTarget:nil action:nil]; | ||||
|     [gesture addTarget:gesture action:@selector(flex_invoke)]; | ||||
|     gesture.flex_action = action; | ||||
|     return gesture; | ||||
| } | ||||
|  | ||||
| - (void)flex_invoke { | ||||
|     self.flex_action(self); | ||||
| } | ||||
|  | ||||
| - (GestureBlock)flex_action { | ||||
|     return objc_getAssociatedObject(self, &actionKey); | ||||
| } | ||||
|  | ||||
| - (void)flex_setAction:(GestureBlock)action { | ||||
|     objc_setAssociatedObject(self, &actionKey, action, OBJC_ASSOCIATION_COPY); | ||||
| } | ||||
|  | ||||
| @end | ||||
		Reference in New Issue
	
	Block a user
	 Balackburn
					Balackburn