Answers for "set font in attributed string 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
0

how to set the font of text in swiftui

Text("Simple Swift Guide").font(.system(size: 45, weight: .bold, design: .default))
Posted by: Guest on December-09-2020

Code answers related to "set font in attributed string swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language