AsyncDisplayKit

Swift

extension _ASDisplayView: LokaliseStringExtractable {
    public func extractString() -> String? {
        let selector = Selector(("asyncdisplaykit_node"))
        if responds(to: selector), let object = perform(selector)?.takeUnretainedValue() {
   if let node = object as? ASTextNode {
return node.attributedText?.string
   }
   if let node = object as? ASEditableTextNode {
return node.attributedText?.string
   }
            if let node = object as? ASButtonNode {
return node.attributedTitle(for: .normal)?.string
   }
}
return nil
    }
}

Objective-C

@interface _ASDisplayView (LokaliseSupport) <LokaliseStringExtractable>
@end

@implementation _ASDisplayView (LokaliseSupport)

- (NSString *)extractString {
    id node = [self performSelector:sel_getUid("asyncdisplaykit_node")];
    if (node) {
if ([node isKindOfClass:[ASTextNode self]]) {
   return ((ASTextNode*)node).attributedText.string;
}
if ([node isKindOfClass:[ASEditableTextNode self]]) {
   return ((ASEditableTextNode*)node).attributedText.string;
}
if ([node isKindOfClass:[ASButtonNode self]]) {
   return [((ASButtonNode*)node) attributedTitleForState:UIControlStateNormal].string;
}
    }
    return nil;
}
@end
Did this answer your question?