<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIVector",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIVector"
  },
  "title" : "CIVector"
}
-->

# CIVector

The Core Image class that defines a vector object.

```
class CIVector
```

## Overview

A `CIVector` can store one or more `CGFloat` in one object. They can store a group of float values
for a variety of different uses such as coordinate points, direction vectors, geometric rectangles,
transform matrices, convolution weights, or just a list a parameter values.

You use `CIVector` objects in conjunction with other Core Image classes, such as [`CIFilter`](/documentation/CoreImage/CIFilter-swift.class)
and [`CIKernel`](/documentation/CoreImage/CIKernel).  Many of the built-in Core Image filters have one or more `CIVector` inputs that
you can set to affect the filter’s behavior.

## Topics

### Creating a Vector

[`vectorWithValues:count:`](/documentation/CoreImage/CIVector/vectorWithValues:count:)

Create a Core Image vector object that is initialized with the specified values.

[`vectorWithX:`](/documentation/CoreImage/CIVector/vectorWithX:)

Create a Core Image vector object that is initialized with one value.

[`vectorWithX:Y:`](/documentation/CoreImage/CIVector/vectorWithX:Y:)

Create a Core Image vector object that is initialized with two values.

[`vectorWithX:Y:Z:`](/documentation/CoreImage/CIVector/vectorWithX:Y:Z:)

Create a Core Image vector object that is initialized with three values.

[`vectorWithX:Y:Z:W:`](/documentation/CoreImage/CIVector/vectorWithX:Y:Z:W:)

Create a Core Image vector object that is initialized with four values.

[`vectorWithString:`](/documentation/CoreImage/CIVector/vectorWithString:)

Create a Core Image vector object with values provided in a string representation.

[`init(cgAffineTransform:)`](/documentation/CoreImage/CIVector/init(cgAffineTransform:)-59e4k)

Create a Core Image vector object that is initialized with six values provided by a `CGAffineTransform` structure.

[`init(cgPoint:)`](/documentation/CoreImage/CIVector/init(cgPoint:)-3mobm)

Create a Core Image vector object that is initialized with two values provided by a `CGPoint` structure.

[`init(cgRect:)`](/documentation/CoreImage/CIVector/init(cgRect:)-3undj)

Create a Core Image vector object that is initialized with four values provided by a `CGRect` structure.

### Initializing a Vector

[`init(values:count:)`](/documentation/CoreImage/CIVector/init(values:count:))

Initialize a Core Image vector object with the specified the values.

[`init(x:)`](/documentation/CoreImage/CIVector/init(x:))

Initialize a Core Image vector object with one value.

[`init(x:y:)`](/documentation/CoreImage/CIVector/init(x:y:)-4grr)

Initialize a Core Image vector object with two values.

[`init(x:y:z:)`](/documentation/CoreImage/CIVector/init(x:y:z:)-zais)

Initialize a Core Image vector object with three values.

[`init(x:y:z:w:)`](/documentation/CoreImage/CIVector/init(x:y:z:w:)-75emo)

Initialize a Core Image vector object with four values.

[`init(string:)`](/documentation/CoreImage/CIVector/init(string:))

Initialize a Core Image vector object with values provided in a string representation.

[`init(cgAffineTransform:)`](/documentation/CoreImage/CIVector/init(cgAffineTransform:)-6o8gl)

Initialize a Core Image vector object with six values provided by a `CGAffineTransform` structure.

[`init(cgPoint:)`](/documentation/CoreImage/CIVector/init(cgPoint:)-8cf9j)

Initialize a Core Image vector object with two values provided by a `CGPoint` structure.

[`init(cgRect:)`](/documentation/CoreImage/CIVector/init(cgRect:)-6bolw)

Initialize a Core Image vector object with four values provided by a `CGRect` structure.

### Getting Values From a Vector

[`value(at:)`](/documentation/CoreImage/CIVector/value(at:))

Returns a value from a specific position in the vector.

[`count`](/documentation/CoreImage/CIVector/count)

The number of items in the vector.

[`x`](/documentation/CoreImage/CIVector/x)

The value located in the first position in the vector.

[`y`](/documentation/CoreImage/CIVector/y)

The value located in the second position in the vector.

[`z`](/documentation/CoreImage/CIVector/z)

The value located in the third position in the vector.

[`w`](/documentation/CoreImage/CIVector/w)

The value located in the forth position in the vector.

[`stringRepresentation`](/documentation/CoreImage/CIVector/stringRepresentation)

Returns a formatted string with all the values of a `CIVector`.

[`cgAffineTransformValue`](/documentation/CoreImage/CIVector/cgAffineTransformValue)

Returns the values in the vector as a `CGAffineTransformValue` structure.

[`cgPointValue`](/documentation/CoreImage/CIVector/cgPointValue)

Returns the values in the vector as a `CGPoint` structure.

[`cgRectValue`](/documentation/CoreImage/CIVector/cgRectValue)

Returns the values in the vector as a `CGRect` structure.



---

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)