Learn Courses My Dashboard

Xcode not printing to Console

Hey guys, my name is Derek Gaspard I am new here to the community. I just wanted to know why my action : print (“Hello, World!”) isn’t printing to the console. I am on the 14 day challenge on Lesson 10 Challenge. The Challenge is to make two buttons side by side and make one print something to console.
I have my buttons and they are working, just nothing is printing to the console. Do you guys know why?
More than likely I just did something wrong, but I will show you what I have now.

I am on Xcode 13.3 version. It looks just like Chris’s from the video but nothing is printing to console.

This is my code I have copied and pasted here.

HStack {
Button(“Click Me”, action: {

            print("Hello, world!")
    Button("Click Me", action: {
        print("Hello, world!")
    .padding ()


Welcome to the community Derek!

Are you running the project on the simulator, and not in the preview window?

Hey Thank you! I am running it in the preview window not the Simulator, yes.

I just had to fix a curly bracket and then I did it in the Simulator and I got it! Thanks! Isn’t is supposed to print to console in the live preview as well though, or no?

No! The preview canvas only shows you UI related things, it doesn’t “fully” run the application

Ohhh ok gotcha!!! Thanks!