Lesson 11 Challenge (14 day challenge)

I decided to give Challenge 11 a go, I am able to increment and multiply the value of the text box. However I am unable to get the text box to appear on another line other than being horizontal. The code that I have is below.

//
//  ContentView.swift
//  Shared
//
//  Created by Eric Beecroft on 9/6/21.
//

import SwiftUI

struct ContentView: View {
    @State private var score = 0;
    var body: some View {
        HStack{
            Button(action: {
                score += 2
            }, label: {
                SwiftUI.Text("Increment Score")
            })

            Button(action: {
                score *= 2
            }, label: {
                HStack{
                    SwiftUI.Text("Multiply Score")
                }
            })
            VStack{
            SwiftUI.Text(String(score))
            }
        }
    }
}

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

If you want Views to be configured so that they are above each other (Vertical), then use a VStack. If you want them side by side (horizontal) then use a HStack as you have done.

(edit)
Also you do not need to prefix your View elements with SwiftUI.

Okay it appears to be working now, but before it threw an error message about needing to prefix the text field. No idea why that happened but its not happening now. Thanks. :slight_smile: