Possible to insert NSTextAttachment or icon into SKLabelNode?

I have a SKLabelNode which has a string that I'd like to replace with an icon.


let attachment = NSAttributedString(attachment: txt) 
attributedString.replaceCharacters(in: NSRange(location: range.location, length: range.length), with: attachment)


But when actually outputted, there's nothing there! The characters are successfully removed, but no text attachment is inserted. attachmentBounds is also not called when I try to subclass NSTextAttachment.


My question: is there some trick to getting this working or a better way to place an icon within a block of text while using SpriteKit?

Post not yet marked as solved Up vote post of JimmyCricket Down vote post of JimmyCricket
739 views