I'm really struggling to get a simple SwiftUI text view to update when using @State. Code below. Any help appreciated (I'm sure it's something daft but I'm new to all this - can't even copy/paste the code snippet correctly). Thank you.
struct ContentView : View {
@State var tappedToggle: Bool = false
var body: some View {
Text("First: \(printRandomFactoid())").multilineTextAlignment(.center)
.onTapGesture {
self.tappedToggle.toggle()
Text("Latest... \r \(printRandomFactoid())").multilineTextAlignment(.center)
}
}
}