mchirico / zDaily

Playground to hack and test ideas with Zoe
1 stars 2 forks source link

Day 41: iOS ... simple example #45

Open mchirico opened 3 years ago

mchirico commented 3 years ago

Day 41 Video

import SwiftUI

struct ContentView: View {
    // variable
    @State var label: String = "Nothing yet..."

    var body: some View {

        Text(self.label)
            .padding()
    // Button
        Button(action: {
            self.label = "hi"
        }) {
            Text("Button")
        }

    }

}

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

<img src=https://user-images.githubusercontent.com/755710/99908557-5f061600-2cb1-11eb-92e0-ea608a6f5617.png width=300 />

Reference

option-command-enter if you lose preview.

tacomonkautobot[bot] commented 3 years ago

mchirico, Thanks for opening this issue!