---
title: "decodeClassName(_:asClassName:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsunarchiver/decodeclassname(_:asclassname:)-swift.method"
---

# decodeClassName(_:asClassName:)

Instructs the receiver to use the class with a given name when instantiating objects whose ostensible class, according to the archived data, is another given name.

## Declaration

```swift
func decodeClassName(_ inArchiveName: String, asClassName trueName: String)
```

## Parameters

- `inArchiveName`: The ostensible name of a class in an archive.
- `trueName`: The name of the class to use when instantiating objects whose ostensible class, according to the archived data, is nameInArchive.

## Discussion

Discussion This method enables easy conversion of unarchived data when the name of a class has changed since the archive was created. Note that there’s also a class method of the same name. The class method has precedence in case of conflicts.

## See Also

### Substituting classes or objects

- [classNameDecoded(forArchiveClassName:)](foundation/nsunarchiver/classnamedecoded(forarchiveclassname:)-swift.type.method.md)
- [decodeClassName(_:asClassName:)](foundation/nsunarchiver/decodeclassname(_:asclassname:)-swift.type.method.md)
- [classNameDecoded(forArchiveClassName:)](foundation/nsunarchiver/classnamedecoded(forarchiveclassname:)-swift.method.md)
- [replace(_:with:)](foundation/nsunarchiver/replace(_:with:).md)
