Change Font Of Substring Swift

[Solved] Change Font Of Substring Swift | Swift - Code Explorer | yomemimo.com
Question : change font of substring swift

Answered by : tender-tiger-uvjt29jjx98r

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)

Source : https://stackoverflow.com/questions/29165560/ios-swift-is-it-possible-to-change-the-font-style-of-a-certain-word-in-a-string | Last Update : Thu, 12 Mar 20

Answers related to change font of substring swift

Code Explorer Popular Question For Swift