mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
38 lines
1.2 KiB
Mathematica
38 lines
1.2 KiB
Mathematica
![]() |
//
|
||
|
// StoryTitleAttributedString.m
|
||
|
// NewsBlur
|
||
|
//
|
||
|
// Created by Nicholas Riley on 1/6/2018.
|
||
|
// Copyright © 2018 NewsBlur. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "StoryTitleAttributedString.h"
|
||
|
|
||
|
@implementation StoryTitleAttributedString
|
||
|
|
||
|
- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr plainString:(NSString *)plainStr {
|
||
|
if ( (self = [self init]) != nil) {
|
||
|
attributedString = attrStr;
|
||
|
plainString = plainStr;
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
+ (NSArray<NSString *> *)writableTypeIdentifiersForItemProvider {
|
||
|
return NSAttributedString.writableTypeIdentifiersForItemProvider;
|
||
|
}
|
||
|
|
||
|
#pragma mark - NSItemProviderWriting
|
||
|
|
||
|
- (nullable NSProgress *)loadDataWithTypeIdentifier:(nonnull NSString *)typeIdentifier forItemProviderCompletionHandler:(nonnull void (^)(NSData * _Nullable, NSError * _Nullable))completionHandler {
|
||
|
|
||
|
NSLog(@"requested: %@", typeIdentifier);
|
||
|
|
||
|
if ([typeIdentifier isEqualToString:(NSString *)kUTTypeUTF8PlainText])
|
||
|
return [plainString loadDataWithTypeIdentifier:typeIdentifier forItemProviderCompletionHandler:completionHandler];
|
||
|
|
||
|
return [attributedString loadDataWithTypeIdentifier:typeIdentifier forItemProviderCompletionHandler:completionHandler];
|
||
|
}
|
||
|
|
||
|
@end
|