Is it possible to use custom Metal shader code in an iPad Swift Playground?
If so, how does one get the *.metal file or code (or its pre-compiled object) onto an iPad to use with a Playground and Swift code? Is the use of Xcode on a Mac required to help?
(this question is not about using the built-in performance shaders, or about running stuff in a Playground on a Mac)
You have two options: either create an iOS playground in Xcode and send it to your iPad but then you are not allowed to edit the .metal file, just read it, like in this example; or you can create your shaders file as a multiline string (now possible in Swift 4 and Xcode 9 beta) and create your library from that string. A more cumbersome way is to concatenate string lines in Xcode 8/Swift 3 like in this example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With