<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CGSize",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@S@CGSize"
  },
  "title" : "CGSize"
}
-->

# CGSize

A structure that contains width and height values.

```
struct CGSize
```

## Overview

A [`CGSize`](/documentation/CoreFoundation/CGSize) structure is sometimes used to represent a distance vector, rather than a physical size. As a vector, its values can be negative. To normalize a [`CGRect`](/documentation/CoreFoundation/CGRect) structure so that its size is represented by positive values, call the [`standardized`](/documentation/CoreFoundation/CGRect/standardized) function.

## Topics

### Geometric Properties

[`var width: Double`](/documentation/CoreFoundation/CGSize/width)

A width value.

[`var height: Double`](/documentation/CoreFoundation/CGSize/height)

A height value.

### Special Values

[`static var zero: CGSize`](/documentation/CoreFoundation/CGSize/zero)

[`init()`](/documentation/CoreFoundation/CGSize/init())

Creates a size with zero width and height.

### Transforming Sizes

[`func applying(CGAffineTransform) -> CGSize`](/documentation/CoreFoundation/CGSize/applying(_:))

### Alternate Representations

[`var dictionaryRepresentation: CFDictionary`](/documentation/CoreFoundation/CGSize/dictionaryRepresentation)

[`init?(dictionaryRepresentation: CFDictionary)`](/documentation/CoreFoundation/CGSize/init(dictionaryRepresentation:))

[`var customPlaygroundQuickLook: PlaygroundQuickLook`](/documentation/CoreFoundation/CGSize/customPlaygroundQuickLook)

A custom playground Quick Look for this instance.

### Comparing Sizes

  <doc://com.apple.documentation/documentation/CoreGraphics/CGSizeEqualToSize(_:_:)>

### Initializers

[`init(CVImageSize)`](/documentation/CoreFoundation/CGSize/init(_:))

Convert `CVImageSize` to [`CGSize`](/documentation/CoreFoundation/CGSize)

[`init(width: Double, height: Double)`](/documentation/CoreFoundation/CGSize/init(width:height:)-2du3k)

[`init(width: Double, height: Double)`](/documentation/CoreFoundation/CGSize/init(width:height:)-63ffm)

[`init(width: Int, height: Int)`](/documentation/CoreFoundation/CGSize/init(width:height:)-83b96)

### Instance Properties

[`var formattedDescription: String`](/documentation/CoreFoundation/CGSize/formattedDescription)

### Instance Methods

[`func equalTo(CGSize) -> Bool`](/documentation/CoreFoundation/CGSize/equalTo(_:))

## Relationships

### Conforms To

[`Decodable`](/documentation/Swift/Decodable)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`Hashable`](/documentation/Swift/Hashable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Escapable`](/documentation/Swift/Escapable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Encodable`](/documentation/Swift/Encodable)

[`CVAttachmentValueRepresentable`](/documentation/CoreVideo/CVAttachmentValueRepresentable)

[`Copyable`](/documentation/Swift/Copyable)

[`Animatable`](/documentation/SwiftUI/Animatable)

---

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)