0 Replies
      Latest reply on Jul 29, 2019 7:28 PM by JimmyCricket
      JimmyCricket Level 1 Level 1 (10 points)

        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?