---
title: "init(ofType:context:options:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cidetector/init(oftype:context:options:)"
---

# init(ofType:context:options:)

Creates and returns a configured detector.

## Declaration

```swift
init?(ofType type: String, context: CIContext?, options: [String : Any]? = nil)
```

## Parameters

- `type`: A string indicating the kind of detector you are interested in. See doc://com.apple.coreimage/documentation/CoreImage/detector-types.
- `context`: A Core Image context that the detector can use when analyzing an image.
- `options`: A dictionary containing details on how you want the detector to be configured. See doc://com.apple.coreimage/documentation/CoreImage/detector-configuration-keys.

## Return Value

Return Value A configured detector.

## Discussion

Discussion A CIDetector object can potentially create and hold a significant amount of resources. Where possible, reuse the same CIDetector instance. Also, when processing images with a detector object, your application performs better if the CIContext used to initialize the detector is the same context used to process the ciImage objects.
