<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFontDescriptor/object(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIFontDescriptor(im)objectForKey:"
  },
  "title" : "object(forKey:)"
}
-->

# object(forKey:)

Returns the font attribute that the corresponding key specifies.

```
func object(forKey anAttribute: UIFontDescriptor.AttributeName) -> Any?
```

## Parameters

`anAttribute`

The font attribute key.

## Return Value

The font attribute corresponding to `anAttribute`. For valid values of `anAttribute`, see [`UIFontDescriptor.AttributeName`](/documentation/UIKit/UIFontDescriptor/AttributeName).

## See Also

[`+  fontDescriptorWithFontAttributes:`](/documentation/UIKit/UIFontDescriptor/fontDescriptorWithFontAttributes:)

Returns a font descriptor with a dictionary of attributes.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)