Beautifying your text
Have you ever heard the phrase, "The quick brown fox jumps over the lazy dog?" Why is it so famous? The reason is that it is an English pangram, which means a phrase with every letter from the alphabet.
Pangrams are useful when you want to visualize properties of a font, such as size, color or bold. In this recipe, we will check different fonts using NSAttributedString
and playground.
Getting ready
Create a new playground called Chapter 6 Text
and remove the string that comes with itby default.
How to do it...
To add the beautifying text feature, follow these steps:
First, let's create our attributed string:
var string = NSMutableAttributedString(string: "The quick brown fox jumps over the lazy dog")
After this, you will see a new icon with the letter appearing, which means that the playground has recognized it as an attributed string. Click on the quick look icon, and you will see the current string with its attributes.
Now, let's choose some font sizes and colors for our text...