<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveHeader/field(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple Archive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B6HeaderC5field6forKeyAC5FieldOSgAC0gF0V_tF"
  },
  "title" : "field(forKey:)"
}
-->

# field(forKey:)

Returns the field for a specified key.

```
func field(forKey key: ArchiveHeader.FieldKey) -> ArchiveHeader.Field?
```

## Parameters

`key`

The key that the function looks up in the header.

## Return Value

The field that matches the specified key, or `nil` if the key was not found.

---

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)