I am making a swift app and I want to add a url to a TTTAttributedLabel. I have got addLinkToUrl but it wants a NSRange. What should I put. I am new to swift. I want the url to be for the entire text.
//PersonTalking is a TTTAttributedLabel
var characterSpeaking:NSDictionary = item["characterspeaking"] as NSDictionary
var characterSpeakingString:String = characterSpeaking["text"] as String
var characterHref:String = characterSpeaking["href"] as String
var characterUrl = NSURL(string: characterHref)
println(characterSpeakingString)
PersonTalking.text = characterSpeakingString
PersonTalking.addLinkToURL(characterUrl, withRange: )
What can I do?
Thanks
If the link is meant to include the full label, then your range should be the full length of your text.
PersonTalking.addLinkToURL(characterUrl,
withRange:NSMakeRange(0,
countElements(characterSpeakingString))