Created
April 8, 2017 10:17
-
-
Save duraiganesh0/2020a66b09d345bbf546991e209a9e01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func getPartOfStringBoldandItalic(_ italicPart:String, font:UIFont)-> NSAttributedString{ | |
let attributtedString = NSMutableAttributedString(string: self) | |
let attrs = [NSFontAttributeName:font] | |
let rangePart: NSRange = (attributtedString.string as NSString).range(of: italicPart) | |
attributtedString.addAttributes(attrs, range: rangePart) | |
return attributtedString | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment