Stuck at Home base (Hello Metal) on

Hi everyone,

Just got the book and very excited to start trying things out, however I can’t get past the very first sample - I’ve followed the coding to the T and can’t seem to render the red circle in Playground, there aren’t any errors nor warnings being reported, I just can’t get to see the circle in Live View. I must add that building it on my iPad Mini2 XCode project works perfectly. Has anyone experienced this with playground?

@thehumbleog - I’m sorry to hear that you are having problems.

Which version of Xcode are you using?
Which macOS?
Are you sure you created a macOS playground and not an iOS one?
Did you try and run the playground from the book’s accompanying code?
What’s happening in the Live View? Is there an activity indicator? Are you sure you have the Live View on the right, and not the Manual option?

Sometimes playgrounds can be disappointing, especially in Xcode 10. Quit Xcode, then re-open the playground with no other projects open. Wait a minute for it to completely load everything, then try running it. Often you’ll get a weird error in the debug console, but the second time it should run.

It’s good to know that building the project on your iPad works though :smiley:

Hi Caroline,
thanks for the expeditious response, I created a macOS playground with the live view on the right not the manual option. I do see those little grey boxes (whatcha ma call it) right beside the little eye icon on the right side of the panel but for the last piece of code Playground current page view I see nothing. I can do without working in playground but thought it’s best to do so in order to follow the book.

Playground Fails on
Xcode 9.4.1
macOS High Sierra 10.13

I’m glad it does work on my iPad though so all hope isn’t lost.

1 Like

I forgot to ask what computer you have so that, if we have one, we can see if it failed here.

And you tried the provided playground from the project code?

Pardon me, I forgot to answer that part of the question. I ran the playground on an iMac 27 inch - retina 5K display running macOS 10.13 (High Sierra) but funnily enough when I ran it on my 8yr old Mac Book Pro 13 inch / macOS 10.13 built for iPad Mini2 everything works fine. Lastly, I haven’t tested the provided playground project code (I should soon as I get access to the iMac as it’s not at my residence). Hope that helps.

@thehumbleog, I agree with Caroline. take a look at the provided playground and then compare with yours to see what is different.

I am using the exact code from the provided project and it works fine with results on my iPad so I don’t believe there’s anything wrong with the provided project’s code(sorry I should have clarified that), I do think it’s Xcode acting up every now and then; unfortunately I can’t test anything macOS playground as am running on a system (Mac Book pro mid 2010) that isn’t Metal compliant hence why am building on my iPad. Thanks

1 Like

@thehumbleog Thanks for letting us know. The playground was originally built on a 27" iMac running High Sierra and Xcode 9.4, but unfortunately playgrounds sometimes have issues.
:crossed_fingers: that Xcode 10 brings more stability when it’s finally released.
In the meantime, I hope that you can continue on other platforms. Most chapters use projects, and as you work through the book, you’ll be able to easily convert the playgrounds to projects if necessary.

Hi Caroline, I’m running MacOS Mojave developer beta 3 on a MacBook Pro Retina TouchPad 2016, Xcode developer beta 3, loaded your playground (to lazy to type;-)) and I don’t see the red sphere either. Just want you to know… The GPU is a AMD Radeon Pro 460 4 GB vram. Copied the code and pasted it into a playground on an iPad Pro and I get a beautiful red sphere on an cream colored background :smile:

@ralph42 that is interesting because I have your exact setup and it is working for me. I am attaching a screenshot that shows the two things I did: first, click on the top right side button named “Show the Assistant Editor” and second, click the bottom left button to start the playground. I hope this helps because as you can see I am able to see the red sphere.

I got problems with the playground (as of 11/17/2018).

Xcode 10.0 / macMini Late 2012 / macOS 10.13.6

The playground stops at

guard let commandBuffer = commandQueue.makeCommandBuffer(),
let descriptor = view.currentRenderPassDescriptor,
let renderEncoder =
commandBuffer.makeRenderCommandEncoder(descriptor: descriptor)
else { fatalError() }

I created a macOS-App with the same code and using instead of a code created MTKView a storyboard MTKView and it didn’t work either.
Setting the storyboards MTKViews device in code helped. The macOS-App now runs without error.

Same changes (setting the device for the view) in playground doesn’t help.

Hi - have you tried running the supplied final playground?

Playgrounds can be a bit temperamental. You can try quitting Xcode and reloading the playground and wait for a minute for it to load properly before running it.

When you say it stops does it perform fatalError()? Or does it just hang?

I don’t know why the storyboard MTKView wouldn’t work. It should.

Well done for getting a working project!


I always start, if available, with the final project to see,

a) what is the goal?
b) does it work?

It is not uncommon to find tutorials with problems because of a changing or complex environment. Nobody can handle all available combinations of systems.

I just repeated my port to macOS and here are my findings:

There is an error with a double use of „descriptor". You use the name for a RenderPipelineDescriptor and a RenderPassDescriptor. In the macOS project this is a compile time error, in playgrounds no error is displayed.

I changed the Command Buffer Guard to

guard let commandBuffer = commandQueue.makeCommandBuffer(),
let passDescriptor = view.currentRenderPassDescriptor,
let renderEncoder =
commandBuffer.makeRenderCommandEncoder(descriptor: passDescriptor)
else { fatalError() }

and the macOS App runs fine.

This does not help the playground!

It stops after line 83

let pipelineState = try view.device?.makeRenderPipelineState(descriptor: descriptor)

without further warnings or information.

@caroline Can you please help with this when you get a chance? Thank you - much appreciated! :]