Solucionado (ver solução)

Importante

Você está vendo a versão anterior da nova experiência da Alura que estamos preparando para você. Em breve, ela ganha uma identidade visual novinha totalmente pensada em potencializar seus estudos!

Solucionado
(ver solução)
1
resposta

[Bug] atributoString

Código:

atributoString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: 1, range: NSMakeRange(0, atributoString.length)) precoSemDescontoLabel.attributedText = atributoString

Erro:

Value of type 'NSMutableString' has no member 'addAttribute'

Cannot assign value of type 'NSMutableString' to type 'NSAttributedString?'

1 resposta
solução!

Solucionado:

let atributoString: NSMutableAttributedString = NSMutableAttributedString(string: "R$ (viagem?.precoSemDesconto ?? 0)") atributoString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: 1, range: NSMakeRange(0, atributoString.length))