enumerated the main text characters using a for loopįor (i,c) in () Let baseLineOffset = offSet * type.rawValue the enum is used here declaring the required offset Let attString = NSMutableAttributedString(string:string, attributes: ) Define Attributes of the text body, this part can be removed of the function Let scriptFont = UIFont.boldSystemFont(ofSize: scriptFontSize) Let stringFont = UIFont.boldSystemFont(ofSize: fontSize) Define the fonts you want to use and sizes Set The Paragraph aligmnet, you can ignore this part and delet off the function Let paraghraphStyle = NSMutableParagraphStyle() you can modify it by skipping the parts that are not essential to you extension NSMutableAttributedStringįunc characterSubscriptAndSuperscript(string:String,Īlignment:NSTextAlignment)-> NSMutableAttributedString I wrote the following extension or you can use it as a function, it is working well for me.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |