---
title: NSAffineTransform
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsaffinetransform
---

# NSAffineTransform

A graphics coordinate transformation.

## Declaration

```swift
class NSAffineTransform
```

## Overview

Overview In Swift, this object bridges to AffineTransform; use NSAffineTransform when you need reference semantics or other Foundation-specific behavior. A transformation specifies how points in one coordinate system are transformed to points in another coordinate system. An affine transformation is a special type of transformation that preserves parallel lines in a path but does not necessarily preserve lengths or angles. Scaling, rotation, and translation are the most commonly used manipulations supported by affine transforms, but shearing is also possible. note: In OS X 10.3 and earlier the NSAffineTransform class was declared and implemented entirely in the Application Kit framework. As of macOS 10.4 the NSAffineTransform class has been split across the Foundation and Application Kit frameworks. Methods for applying affine transformations to the current graphics context and a method for applying an affine transformation to an NSBezierPath object are described in NSAffineTransform Additions Reference in the Application Kit. important: The Swift overlay to the Foundation framework provides the AffineTransform structure, which bridges to the NSAffineTransform class. For more information about value types, see Working with Foundation Types.

## Topics

### Creating an Affine Transform

- [init()](foundation/nsaffinetransform/init().md)
- [init(transform:)](foundation/nsaffinetransform/init(transform:).md)

### Accumulating Transformations

- [rotate(byDegrees:)](foundation/nsaffinetransform/rotate(bydegrees:).md)
- [rotate(byRadians:)](foundation/nsaffinetransform/rotate(byradians:).md)
- [scale(by:)](foundation/nsaffinetransform/scale(by:).md)
- [scaleX(by:yBy:)](foundation/nsaffinetransform/scalex(by:yby:).md)
- [translateX(by:yBy:)](foundation/nsaffinetransform/translatex(by:yby:).md)
- [append(_:)](foundation/nsaffinetransform/append(_:).md)
- [prepend(_:)](foundation/nsaffinetransform/prepend(_:).md)
- [invert()](foundation/nsaffinetransform/invert().md)

### Transforming Data and Objects

- [transform(_:)](foundation/nsaffinetransform/transform(_:)-41p16.md)
- [transform(_:)](foundation/nsaffinetransform/transform(_:)-5r6ol.md)
- [transform(_:)](foundation/nsaffinetransform/transform(_:)-6z1xo.md)

### Accessing the Transformation Matrix

- [transformStruct](foundation/nsaffinetransform/transformstruct.md)
- [NSAffineTransformStruct](foundation/nsaffinetransformstruct.md)

### Setting and Building the Current Transformation Matrix

- [set()](foundation/nsaffinetransform/set().md)
- [concat()](foundation/nsaffinetransform/concat().md)

### Initializers

- [init(coder:)](foundation/nsaffinetransform/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
