<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CATransition/filter",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CATransition(py)filter"
  },
  "title" : "filter"
}
-->

# filter

An optional Core Image filter object that provides the transition.

```
var filter: Any? { get set }
```

## Discussion

If specified, the filter must support both <doc://com.apple.documentation/documentation/CoreImage/kCIInputImageKey> and <doc://com.apple.documentation/documentation/CoreImage/kCIInputTargetImageKey> input keys, and the <doc://com.apple.documentation/documentation/CoreImage/kCIOutputImageKey> output key.  The filter may optionally support the <doc://com.apple.documentation/documentation/CoreImage/kCIInputExtentKey> input key, which is set to a rectangle describing the region in which the transition should run. If `filter` does not support the required input and output keys the behavior is undefined.

Defaults to `nil`. When a transition filter is specified the [`type`](/documentation/QuartzCore/CATransition/type) and [`subtype`](/documentation/QuartzCore/CATransition/subtype) properties are ignored.

The <doc://com.apple.documentation/documentation/AppKit/NSView> that contains the transitioning layer must have its <doc://com.apple.documentation/documentation/AppKit/NSView/layerUsesCoreImageFilters> set to <doc://com.apple.documentation/documentation/Swift/true>.

The following code shows how you can transition between the two states of a [`CATextLayer`](/documentation/QuartzCore/CATextLayer) named `transitioningLayer`. When the layer is first created, its [`backgroundColor`](/documentation/QuartzCore/CALayer/backgroundColor) is set to red and its [`string`](/documentation/QuartzCore/CATextLayer/string) property is set to `Red`. When the `runTransition()` function is called, a new [`CATransition`](/documentation/QuartzCore/CATransition) object is created and added to `transitioningLayer`, and the state of the layer is changed so that its background color is blue and its rendered text reads `Blue`.

The end result is that the transition animates from the red state to the blue state using a [CICopyMachineTransition](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CICopyMachineTransition) transition.

```swift
override func viewDidLoad() {
    super.viewDidLoad()
    
    view.layerUsesCoreImageFilters = true
    
    view.layer = CALayer()
    
    transitioningLayer.frame = CGRect(x: 10, y: 10,
                                      width: 320, height: 160)
    
    view.layer!.addSublayer(transitioningLayer)
    
    // Initial "red" state
    transitioningLayer.backgroundColor = NSColor.red.cgColor
    transitioningLayer.string = "Red"
}
     
func runTransition() {
    let transition = CATransition()
    transition.duration = 2
    
    transition.filter = CIFilter(name: "CICopyMachineTransition")
    transitioningLayer.add(transition,
                           forKey: "transition")
    
    // Transition to "blue" state
    transitioningLayer.backgroundColor = NSColor.blue.cgColor
    transitioningLayer.string = "Blue"
}
```

### Special Considerations

This property is not supported on layers in iOS.

---

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)