Adding custom attribute to NSAttributedString on iOS

NSAttributedString is used for displaying rich text on Apple platforms. There are many attributes available for styling the text. Let's see how to add new attribute and how to draw it in UITextView. Drawing custom attribute Defining a new attribute is just a matter of extending NSAttributedString.Key and defining a new static variable. Difficult part …