Created
February 26, 2020 11:59
-
-
Save tieleman/652ff72d66e8956af8abdba90639d841 to your computer and use it in GitHub Desktop.
ContentView.swift v2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var name: String = "" | |
private var greeterText: String { | |
name.isEmpty ? "" : "Nice to meet you, \(name)." | |
} | |
var body: some View { | |
VStack { | |
Text("Please enter your name below") | |
.accessibility(identifier: "enterNameLabel") | |
TextField("Your name", text: $name) | |
Text(greeterText) | |
.accessibility(identifier: "greetingTextLabel") | |
}.padding() | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment