SpriteKit transparently supports both OpenGL and Metal, with the click of a mouse button (more precisely, with one setting in the Info.plist file).
Perhaps a bit too transparently.
The problem is, shaders in OpenGL and in Metal use slightly different syntax, and are thus not interchangeable. Unless you restrict yourself to an astonishingly small common overlapping subset of both, you need to know which kind of shader source to supply to SKShader.
But how? As far as I can gather, there is no way of knowing which API is being currently used. Either one could, and there's no way of knowing. There appears to be no way of forcing the application to use only Metal. It could be either one, and there doesn't seem to be any way of knowing which. (For a concrete example, if you enable Metal, your app will probably run using the Metal API on an iOS/tvOS device, but still using OpenGL on the simulator. There doesn't seem to be any way of making the simulator use Metal. And anyway, I suppose in theory with some devices the app could still be run using OpenGL.)
If you supply the wrong shader source code to SKShader, it will probably not compile, and the shader won't work at all.
How is this supposed to be done?