title: Create custom NSAttributedString.Key
body: <p>I'm trying to build a simple note app. At the moment, I'm focusing on the possibility to set the text with different text styles (e.g. body, headline, bold, italic, etc.). I used a <code>NSAttributedString</code> to set the different text styles. Now, I'd like to detect which style has been applied to the selected text.</p>
  <p>I thought a good way to do it would have been to create a custom NSAttributedString.<strong>Key</strong>, so that I can assign it when setting the attributes (e.g. <code>.textStyle: &quot;headline&quot;</code>, and read it when I need to detect it. I tried implementing it as an extension of NSAttributedString.Key but without success. What would be the correct way to do it?
  Is there a better alternative?</p>