Como definir a cor da imagem do modelo no NSTextAttachment

Como definir a cor de uma imagem de modelo que é um anexo em uma sequência atribuída?

Fundo:

Eu tenho um UILabel e estou definindo seu attributeText para um NSAttributedString. O NSAttributedString inclui um NSTextAttachment com uma imagem pequena. Agora, quero que a cor da minha imagem corresponda à cor do texto e não consigo descobrir como fazê-la funcionar.

Eu normalmente esperaria colorir a imagem, definindo seu modo de renderização como UIImageRenderingModeAlwaysTemplate e, em seguida, definindo o tintColor no UIView que o contém. Eu tentei definir o tintColor no meu UILabel, mas isso não tem efeito.

Aqui está o meu código. Está em Ruby (RubyMotion), então a sintaxe pode parecer um pouco engraçada, mas mapeia 1: 1 com o Objetivo C.

attachment = NSTextAttachment.alloc.initWithData(nil, ofType: nil)
attachment.image = UIImage.imageNamed(icon_name).imageWithRenderingMode(UIImageRenderingModeAlwaysTemplate)

label_string = NSMutableAttributedString.attributedStringWithAttachment(attachment)
label_string.appendAttributedString(NSMutableAttributedString.alloc.initWithString('my text', attributes: { NSFontAttributeName => UIFont.preferredFontForTextStyle(UIFontTextStyleFootnote), NSForegroundColorAttributeName => foreground_color }))

label = UILabel.alloc.initWithFrame(CGRectZero)
label.tintColor = foreground_color
label.attributedText = label_string
label.textAlignment = NSTextAlignmentCenter
label.numberOfLines = 0

questionAnswers(4)

yourAnswerToTheQuestion