change font of substring swift April 14, 2023 by wordlinkanswers change font of substring swift Comment 0 let longestWordRange = (longString as NSString).range(of: longestWord)</p> <p>let attributedString = NSMutableAttributedString(string: longString, attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 20)])</p> <p>attributedString.setAttributes([NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 20), NSAttributedStringKey.foregroundColor : UIColor.red], range: longestWordRange) Popularity 5/10 Helpfulness 4/10 Language swift Source: stackoverflow.com Tags: substring swift Share Link to this answer Share Contributed on Mar 05 2020 Tender Tiger 0 Answers Avg Quality 2/10