Chapter 10: Fragnebt Post-Processing

Hello Caroline, today I start to study the chapter 10, but I can not run the playground and I always receive this message: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file post_processing_Sources/Renderer.swift, line 271
So please tell me what can I do?

Do you receive this error when you run the supplied final playground?

What is your hardware? (Device and GPU).

Version of macOS and Xcode?

Hello Caroline, my version of macOS is Big Sur and my Xcode also newest version. I just want to try this final code with simulator

Apple changed the way to make libraries in playgrounds.

In Renderer.swift, change line 169-171 to:

//      guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { return }
//      let source = try String(contentsOfFile: path, encoding: .utf8)
//      let library = try device.makeLibrary(source: source, options: nil)

let library = device.makeDefaultLibrary()!
1 Like

Issue still true for Big Sur 11.2.3 and Xcode Version 12.4 (12D4e). Updated the Renderer.swift lines 133-135. Works.

1 Like