<!--
{
  "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/decodeCGSize(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoder(im)decodeCGSizeForKey:"
  },
  "title" : "decodeCGSize(forKey:)"
}
-->

# decodeCGSize(forKey:)

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

```
func decodeCGSize(forKey key: String) -> CGSize
```

## Parameters

`key`

The key that identifies the size information.

## Return Value

The `CGSize` structure.

## Discussion

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

## See Also

[`encode(_:forKey:)`](/documentation/Foundation/NSCoder/encode(_:forKey:)-6wq3n)

Encodes size information and associates it with the specified key in the coder’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)