<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/filterWithName:keysAndValues:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)filterWithName:keysAndValues:"
  },
  "title" : "filterWithName:keysAndValues:"
}
-->

# filterWithName:keysAndValues:

Creates a [`CIFilter`](/documentation/CoreImage/CIFilter-swift.class) object for a specific kind of filter and initializes the input values with a `nil`-terminated list of arguments.

```
+ (CIFilter *) filterWithName:(NSString *) name keysAndValues:(id) key0;
```

## Parameters

`name`

The name of the filter. You must make sure the name is spelled correctly, otherwise your app will run but not produce any output images. For that reason, you should check for the existence of the filter after calling this method.

`key0`

A list of key-value pairs to set as input values to the filter. Each key is a constant that specifies the name of the input value to set, and must be followed by a value. You signal the end of the list by passing a `nil` value.

## Return Value

A [`CIFilter`](/documentation/CoreImage/CIFilter-swift.class) object whose input values are initialized.

## Discussion

As with all Objective-C methods that accept `nil`-terminated argument lists, to prevent unintended behavior you must take take care not to pass a `nil` value before the intended end of the argument list. You can avoid such issues by using the [`init(name:withInputParameters:)`](/documentation/CoreImage/CIFilter-swift.class/init(name:withInputParameters:)) method to create a filter, expressing the parameter list as a dictionary literal.

---

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)