NSAttributedStringKey giving an unresolved identifier error : <p>I'm following an online tutorial to build a magazine type iOS application. I'm attempting to use NSAttributedStringKey but keep getting the error shown below. Any ideas?</p>

<p>This is the line of code that is causing the error:</p>

<pre><code>let attrs = [NSAttributedStringKey.foregroundColor: color, NSAttributedStringKey.font: font] as [NSAttributedStringKey : Any]
</code></pre>
