I am trying to set Hyperlink in the text. Text appears but i cannot find the link on the text. Can anyone help here. I want to set the link on My Health Action Plan on getStartedDict. but only whole text appears without any links.
let link1 = ["My Health Action Plan"]
var getStartedDict =
["":"Now that you have a glimpse of where you currently are in managing your health, it is time for you to update your Health Action Plan. Use the information in the Health Profile along with the online resources in this portal to help set realistic health goals and to help you work toward better health."]
var linkArray = [[String]]()
override func viewDidLoad(){
super.viewDidLoad()
linkArray.removeAll()
linkArray.append(link1)
CommonUtility.sharedInstance.addBackButton(self)
loadData()
}
//here i tried to set the link
if let getStartedText = self.getStartedDict[self.model.label1]?.htmlStringToAttributedString()
{
let aText = getStartedText
let myRange = NSRange(location: 0, length: aText.length)
aText.addAttribute(NSFontAttributeName, value: UIFont.systemFontOfSize(kFontSize), range: myRange)
print(aText)
cell.detail.setLinksForSubstrings(linkArray, withLinkHandler: handler)
}
Updated: Refer to comment for answer