Answers for "attributed string font swift"

0

change font of substring swift

let longestWordRange = (longString as NSString).range(of: longestWord)

let attributedString = NSMutableAttributedString(string: longString, attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 20)])

attributedString.setAttributes([NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 20), NSAttributedStringKey.foregroundColor : UIColor.red], range: longestWordRange)
Posted by: Guest on March-05-2020

Code answers related to "attributed string font swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language