Build Metal-based Core Image kernels with Xcode - not working

I attempted to follow the steps to create a core image kernel using the build settings outlined in the video. I could not get the metal core image kernels to link properly into the project. Does anyone have working sample code for integrating metal and core image together.

I've written with metal shaders and I've had no issues integrating that into my apps. However, the steps for compiling into core image seem to be much more complicated.
The process is actually not too hard:
  1. Put the Metal code of your kernel function (e.g., myKernel) into a file with the following naming scheme: <file_name>.ci.metal (like MyFilter.ci.metal).

  2. Add the two Build Rules described by David in the session. But be aware that the -I $MTL_HEADER_SEARCH_PATHS flag seems to cause trouble, so better just omit that.

  3. This will compile all the .ci.metal files into .ci.metallib files with the same <file_name>. You can then load your kernel function into a CIKernel like this:

Code Block swift
let url = Bundle(for: type(of: self)).url(forResource: "MyFilter", withExtension: "ci.metallib")!
do {
    let data = try Data(contentsOf: url)
    self.kernel = try CIKernel(functionName: "myKernel", fromMetalLibraryData: data)
} catch {
    fatalError("Failed to create kernel: \(error.localizedDescription)")
}

Maybe you can elaborate on what errors you are getting?
Build Metal-based Core Image kernels with Xcode - not working
 
 
Q