Structure

CGPoint

A structure that contains a point in a two-dimensional coordinate system.

Declaration

struct CGPoint

Topics

Creating Point Values

init(x: Double, y: Double)

Creates a point with coordinates specified as floating-point values.

init(x: Int, y: Int)

Creates a point with coordinates specified as integer values.

init(x: CGFloat, y: CGFloat)

Creates a point with coordinates specified as CGFloat values.

Special Values

static var zero: CGPoint

The point with location (0,0).

init()

Creates a point with location (0,0).

Geometric Properties

var x: CGFloat

The x-coordinate of the point.

var y: CGFloat

The y-coordinate of the point.

Transforming Points

func applying(CGAffineTransform) -> CGPoint

Returns the point resulting from an affine transformation of an existing point.

Alternate Representations

var dictionaryRepresentation: CFDictionary

Returns a dictionary representation of the specified point.

init?(dictionaryRepresentation: CFDictionary)

Creates a point from a canonical dictionary representation.

var debugDescription: String

A textual representation of the point’s coordinate values.

var customMirror: Mirror

A representation of the point’s structure and display style for use in debugging.

var customPlaygroundQuickLook: PlaygroundQuickLook

A representation of the point for use in Playgrounds.

Deprecated

Comparing Points

func equalTo(CGPoint) -> Bool

Returns whether two points are equal.

See Also

Geometric Data Types

struct CGFloat

The basic type for floating-point scalar values in Core Graphics and related frameworks.

struct CGSize

A structure that contains width and height values.

struct CGRect

A structure that contains the location and dimensions of a rectangle.

struct CGVector

A structure that contains a two-dimensional vector.

struct CGAffineTransform

An affine transformation matrix for use in drawing 2D graphics.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software