<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCoder/decodeCGAffineTransform(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoder(im)decodeCGAffineTransformForKey:"
  },
  "title" : "decodeCGAffineTransform(forKey:)"
}
-->

# decodeCGAffineTransform(forKey:)

Decodes and returns the Core Graphics affine transform structure associated with the specified key in the coder’s archive.

```
func decodeCGAffineTransform(forKey key: String) -> CGAffineTransform
```

## Parameters

`key`

The key that identifies the affine transform.

## Return Value

The affine transform.

## Discussion

Use this method to decode size information that was previously encoded using the [`encode(_:forKey:)`](/documentation/Foundation/NSCoder/encode(_:forKey:)-29jyx) method.

## See Also

[`encode(_:forKey:)`](/documentation/Foundation/NSCoder/encode(_:forKey:)-29jyx)

Encodes an affine transform and associates it with the specified key in the receiver’s archive.



---

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)