<!--
{
  "availability" : [
    "iOS: 8.0.0 - 12.0.0",
    "iPadOS: 8.0.0 - 12.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.10.0 - 10.14.0",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIKernel/init(source:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIKernel(cm)kernelWithString:"
  },
  "title" : "init(source:)"
}
-->

# init(source:)

Creates a single kernel object.

```
convenience init?(source string: String)
```

## Parameters

`string`

A program in the Core Image Kernel Language that contains a single routine marked using the `kernel` keyword.

## Return Value

A new kernel object. The class of the returned object can be [`CIKernel`](/documentation/CoreImage/CIKernel), [`CIColorKernel`](/documentation/CoreImage/CIColorKernel), or [`CIWarpKernel`](/documentation/CoreImage/CIWarpKernel) depending on the type of routine specified in the Core Image Kernel Language source code string.

## Discussion

The Core Image Kernel Language is a dialect of the OpenGL Shading Language. See [Core Image Kernel Language Reference](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CIKernelLangRef/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004397) and [Core Image Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185) for more details.

## See Also

  [Core Image Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185)

  [Core Image Kernel Language Reference](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CIKernelLangRef/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004397)



---

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)