Learn Courses My Dashboard

Lesson 10: Output not appearing in the console

Hi, everyone. Swift is my first coding language and I’m running through the initial 14-day course. I’m on Lesson 10 and am having trouble getting an outcome to print in the console.

Is there something I’m doing wrong?

Any help would be much appreciated.

Chris

import SwiftUI

struct ContentView: View {
var body: some View {

    VStack {
        // Button instance with closure
        Button("Click me", action: {
            print("Hellow world")
        })
        
        // Button instance with trailing closure
        Button("Click me")
        {print("Hellow world")
    
    }
      
}

}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
}

You need to run the app in the simulator (top left corner: play button), not just in the preview