<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AffineTransform",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation15AffineTransformV"
  },
  "title" : "AffineTransform"
}
-->

# AffineTransform

A graphics coordinate transformation.

```
struct AffineTransform
```

## Topics

### Creating Transforms

[`init()`](/documentation/Foundation/AffineTransform/init())

Creates an affine transformation matrix with identity values.

[`init(rotationByDegrees:)`](/documentation/Foundation/AffineTransform/init(rotationByDegrees:))

Creates an affine transformation matrix from a rotation angle.

[`init(rotationByRadians:)`](/documentation/Foundation/AffineTransform/init(rotationByRadians:))

Creates an affine transformation matrix from a rotation angle.

[`init(scale:)`](/documentation/Foundation/AffineTransform/init(scale:))

Creates an affine transformation matrix from scaling a single value.

[`init(scaleByX:byY:)`](/documentation/Foundation/AffineTransform/init(scaleByX:byY:))

Creates an affine transformation matrix from scaling values.

[`init(translationByX:byY:)`](/documentation/Foundation/AffineTransform/init(translationByX:byY:))

Creates an affine transformation matrix from translation values.

[`init(m11:m12:m21:m22:tX:tY:)`](/documentation/Foundation/AffineTransform/init(m11:m12:m21:m22:tX:tY:))

Creates an affine transformation.

### Getting the Identity Transform

[`identity`](/documentation/Foundation/AffineTransform/identity)

An identity affine transformation matrix.

### Accumulating Tranformations

[`rotate(byDegrees:)`](/documentation/Foundation/AffineTransform/rotate(byDegrees:))

Mutates an affine transformation matrix to apply a rotation.

[`rotate(byRadians:)`](/documentation/Foundation/AffineTransform/rotate(byRadians:))

Mutates an affine transformation matrix to apply a rotation.

[`scale(_:)`](/documentation/Foundation/AffineTransform/scale(_:))

Mutates an affine transformation matrix to apply scaling in both x and y dimensions.

[`scale(x:y:)`](/documentation/Foundation/AffineTransform/scale(x:y:))

Mutates an affine transformation matrix to apply scaling in each of the x and y dimensions.

[`translate(x:y:)`](/documentation/Foundation/AffineTransform/translate(x:y:))

Mutates an affine transformation matrix to perform the specified translation.

[`append(_:)`](/documentation/Foundation/AffineTransform/append(_:))

Mutates an affine transformation by appending another affine transform.

[`prepend(_:)`](/documentation/Foundation/AffineTransform/prepend(_:))

Mutates an affine transformation by prepending another affine transform.

[`invert()`](/documentation/Foundation/AffineTransform/invert())

Inverts the transformation matrix, if possible.

[`inverted()`](/documentation/Foundation/AffineTransform/inverted())

Returns an inverted version of the matrix, if possible, or nil if not.

### Transforming Data and Objects

[`transform(_:)`](/documentation/Foundation/AffineTransform/transform(_:)-1ozpp)

Applies the affine transform to the specified point.

[`transform(_:)`](/documentation/Foundation/AffineTransform/transform(_:)-6fze6)

Applies the affine transform to the specified size.

### Accessing the Transformation Matrix

[`m11`](/documentation/Foundation/AffineTransform/m11)

An element of the transform matrix that contributes scaling, rotation, and shear.

[`m12`](/documentation/Foundation/AffineTransform/m12)

An element of the transform matrix that contributes scaling, rotation, and shear.

[`m21`](/documentation/Foundation/AffineTransform/m21)

An element of the transform matrix that contributes scaling, rotation, and shear.

[`m22`](/documentation/Foundation/AffineTransform/m22)

An element of the transform matrix that contributes scaling, rotation, and shear.

[`tX`](/documentation/Foundation/AffineTransform/tX)

An element of the transform matrix that contributes translation.

[`tY`](/documentation/Foundation/AffineTransform/tY)

An element of the transform matrix that contributes translation.

### Using Reference Types

[`NSAffineTransform`](/documentation/Foundation/NSAffineTransform)

A graphics coordinate transformation.

## Relationships

### Conforms To

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

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

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

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

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

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

[`ReferenceConvertible`](/documentation/Foundation/ReferenceConvertible)

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

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

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

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

---

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)