---
title: "object(forKey:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsfontdescriptor/object(forkey:)"
---

# object(forKey:)

Returns the font attribute specified by the given key.

## Declaration

```swift
func object(forKey attribute: NSFontDescriptor.AttributeName) -> Any?
```

## Parameters

- `attribute`: The font attribute key.

## Return Value

Return Value The font attribute corresponding to anAttribute. For valid values of anAttribute, see Font Attributes.

## See Also

### Related Documentation

- [symbolicTraits](appkit/nsfontdescriptor/symbolictraits-swift.property.md)

### Getting the Font Attributes

- [fontAttributes](appkit/nsfontdescriptor/fontattributes.md)
- [NSFontDescriptor.AttributeName](appkit/nsfontdescriptor/attributename.md)
- [NSFontDescriptor.SymbolicTraits](appkit/nsfontdescriptor/symbolictraits-swift.struct.md)
- [matrix](appkit/nsfontdescriptor/matrix.md)
- [pointSize](appkit/nsfontdescriptor/pointsize.md)
- [postscriptName](appkit/nsfontdescriptor/postscriptname.md)
- [NSFontDescriptor.FeatureKey](appkit/nsfontdescriptor/featurekey.md)
- [NSFontFamilyClass](appkit/nsfontfamilyclass.md)
- [NSFontFamilyClassMask](appkit/nsfontfamilyclassmask.md)
- [Typeface Information](appkit/typeface-information.md)
- [NSFontDescriptor.VariationKey](appkit/nsfontdescriptor/variationkey.md)
