mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-10-30 12:23:58 -04:00
32 lines
894 B
Objective-C
32 lines
894 B
Objective-C
//
|
|
// UIPasteboard+FLEX.m
|
|
// FLEX
|
|
//
|
|
// Created by Tanner Bennett on 12/9/19.
|
|
// Copyright © 2020 FLEX Team. All rights reserved.
|
|
//
|
|
|
|
#import "UIPasteboard+FLEX.h"
|
|
|
|
@implementation UIPasteboard (FLEX)
|
|
|
|
- (void)flex_copy:(id)object {
|
|
if (!object) {
|
|
return;
|
|
}
|
|
|
|
if ([object isKindOfClass:[NSString class]]) {
|
|
UIPasteboard.generalPasteboard.string = object;
|
|
} else if([object isKindOfClass:[NSData class]]) {
|
|
[UIPasteboard.generalPasteboard setData:object forPasteboardType:@"public.data"];
|
|
} else if ([object isKindOfClass:[NSNumber class]]) {
|
|
UIPasteboard.generalPasteboard.string = [object stringValue];
|
|
} else {
|
|
// TODO: make this an alert instead of an exception
|
|
[NSException raise:NSInternalInconsistencyException
|
|
format:@"Tried to copy unsupported type: %@", [object class]];
|
|
}
|
|
}
|
|
|
|
@end
|