I'm reading text from an .rtf file that was created in Xcode (File -> New File -> RTF file). I can read the text from the file no problem and then add that text to a UITextView. However, after I read the text I want to change the font size. I think I need to add an attribute to do this? - but I can't figure out where. Any help appreciated.
if let rtfPath = Bundle.main.url(forResource: "Module\(moduleNumber)Text", withExtension: "rtf") {
do {
let attributedStringWithRtf = try NSAttributedString(url: rtfPath, options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.rtf], documentAttributes: nil)
moduleText.attributedText = attributedStringWithRtf
} catch {
print("Error loading text")
}
}Cheers
Grant.