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 {
Spacer()
Button(“Click Me”, action: {
print("Hello, world!")
})
.padding()
.background(Color.blue)
.foregroundColor(.white)
Spacer()
Button("Click Me", action: {
print("Hello, world!")
})
.padding ()
.background(Color.green)
.foregroundColor(Color.white)
Spacer()
}
}