I am trying to get myself going with swiftUI. I was playing with the code below and trying to get the print() to work to see some variables during runtime in the preview window. Unfortunately it won't run once I add the print(), I get an Expected Declaration flag. Any info on using print() would be great as I have spent a few hours wondering around Google looking for answers with no luck so far.import SwiftUI
struct ContentView : View {
@State var username: String = ""
let word1 = "Username"
let word2 = "Password"
print()
var body: some View {
VStack(alignment: .leading) {
Text("Login")
.font(.title)
.multilineTextAlignment(.center)
.lineLimit(nil)
Text("Please")
.font(.subheadline)
HStack(alignment: .center, spacing: 10) {
Text("Username: ")
TextField($username, placeholder: Text("type something here..."))
.textFieldStyle(.roundedBorder)
}
HStack(alignment: .center, spacing: 10) {
Text("Password: ")
TextField($username, placeholder: Text("type something here..."))
.textFieldStyle(.roundedBorder)
}
}.padding()
}
}
Selecting any option will automatically load the page