Here's how to make the example you proposed:
import SwiftUI
struct ContentView: View {
@State var buttonText = ""
var body: some View {
VStack {
TextField("Text Here", text: $buttonText)
.padding()
.textFieldStyle(RoundedBorderTextFieldStyle())
Button(self.buttonText) {
/* code to be executed when button is pressed */
}
}
}
}
I suggest that you read about the @State property wrapper and how SwiftUI Views work in general.
In short, SwiftUI is a state-driven UI framework, meaning that every variable which is somehow displayed on screen that you change at some point in time will immediate refresh the view with the new data. It makes updating things and listening to changes an absolute breeze.
I hope I helped!
Post
Replies
Boosts
Views
Activity
@eskimo then this is a good question: how the hell does Parallels Desktop and VMWare work, if Apple Hypervisor is broken?
I do not see it being output to the console.
In the end, I couldn't fix it but I found the issue in my decoder and fixed it. The example I gave didn't really reflect my situation. My situation involved many different structs from many different places in my code. Putting them in here would be... unproductive and very confusing, to say the least.
Thanks for your attention though!