Skip to content

Instantly share code, notes, and snippets.

@BandarHL
Created February 20, 2020 22:09
Show Gist options
  • Save BandarHL/2a26ec78689ae0ebbf12da98eeaad4b4 to your computer and use it in GitHub Desktop.
Save BandarHL/2a26ec78689ae0ebbf12da98eeaad4b4 to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
%hook UITextView
- (void)layoutSubviews {
%orig;
UILongPressGestureRecognizer *longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress)];
[self addGestureRecognizer:longTap];
}
%new - (void)handleLongPress {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = [self.textStorage string];
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment