Chapter 4 playgrounds not compiling Xcode 12.0.1

It appears Apple have just changed the way playgrounds access Metal shaders, as I was asked this yesterday too.

You used to have to access it via the bundle, but it seems that we can now just use makeDefaultLibrary() as we do in an app.

So change the method in Utility.swift:

public func createLibrary() -> MTLLibrary {
  device.makeDefaultLibrary()!
}
12 Likes