---
title: "className(for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nskeyedarchiver/classname(for:)-swift.method"
---

# className(for:)

Returns the class name with which this archiver encodes instances of a given class.

## Declaration

```swift
func className(for cls: AnyClass) -> String?
```

## Parameters

- `cls`: The class for which to determine the translation mapping.

## Return Value

Return Value The class name with which the receiver encodes instances of cls. Returns nil if the receiver does not have a translation mapping for cls. The class’s separate translation map is not searched.

## See Also

### Managing Classes and Class Names

- [setClassName(_:for:)](foundation/nskeyedarchiver/setclassname(_:for:)-swift.type.method.md)
- [className(for:)](foundation/nskeyedarchiver/classname(for:)-swift.type.method.md)
- [setClassName(_:for:)](foundation/nskeyedarchiver/setclassname(_:for:)-swift.method.md)
