UIPasteboard+FLEX.m 768 B

123456789101112131415161718192021222324252627
  1. //
  2. // UIPasteboard+FLEX.m
  3. // FLEX
  4. //
  5. // Created by Tanner Bennett on 12/9/19.
  6. // Copyright © 2019 Flipboard. All rights reserved.
  7. //
  8. #import "UIPasteboard+FLEX.h"
  9. @implementation UIPasteboard (FLEX)
  10. - (void)flex_copy:(id)object {
  11. if ([object isKindOfClass:[NSString class]]) {
  12. UIPasteboard.generalPasteboard.string = object;
  13. } else if([object isKindOfClass:[NSData class]]) {
  14. [UIPasteboard.generalPasteboard setData:object forPasteboardType:@"public.data"];
  15. } else if ([object isKindOfClass:[NSNumber class]]) {
  16. UIPasteboard.generalPasteboard.string = [object stringValue];
  17. }
  18. [NSException raise:NSInternalInconsistencyException
  19. format:@"Tried to copy unsupported type: %@", [object class]];
  20. }
  21. @end