I am getting warning
'init(source:)' was deprecated in iOS 12.0: Core Image Kernel Language API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)
for following code and could not find a solution except silencing the warning.
func createCustomKernel() -> CIColorKernel {
let kernelString = "kernel vec4 chromaKey(__sample s, __color c, float threshold){\n" +
"vec4 diff = s.rgba - c;\n" +
"float distance = length( diff );\n" +
"float alpha = compare( distance - threshold , 0.0, 1.0 );\n" +
"return vec4(s.rgb, alpha );\n" +
"}"
return CIColorKernel(source: kernelString)!
}
The use of the CI Kernel Language for writing Core Image kernels is deprecated for a while now. Instead, CI kernels should be written in Metal.
You can check out this WWDC talk on how this is done.