Brandon Bradley Brandon Bradley - 1 year ago 100
Swift Question

What Are The Accepted Keys for NSTextView.typingAttributes?

In Swift on macOS, I have the following Text View and want to set the font size of text that is entered into it, like so:

myTextView.typingAttributes = ["Unknown" : NSFont(name: "Helvetica", size: 18)]

I am currently unable to do this, as I do not know, nor could a find on the
Apple Documentation Page, what the accepted keys are for typingAttributes.

Does anyone know what these are, or where to find them?

Answer Source

You can find the supported attribute names in the documentation for NSAttributedString under Character Attributes. For the font, you would use NSFontAttributeName.