I have a UITableview
that gets data from the database and I display it in a UILabel
. I want to make a portion of the text that says " ... Read Less" to be bold while leaving the rest of the text alone. The code below simply checks if the post has more than 120 characters if so then I append " ... Read Less " that statement appended I would like to make bold. Right now I have my entire post bold instead of just the appended string any suggestions would be great
func HomeProfilePlaceTVC(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "HomeTVC", for: indexPath) as! HomeTVC
cell.post.tag = indexPath.row
if streamsModel.Posts[indexPath.row].count > 120 {
cell.post.text = String(streamsModel.Posts[indexPath.row]).appending(" ... Read Less")
cell.post.font = UIFont(name:"HelveticaNeue-Bold", size: 15.0)
}
else {
cell.post.text = streamsModel.Posts[indexPath.row]
}
return cell
}