Skip to content

Instantly share code, notes, and snippets.

@pookjw
Created February 2, 2026 11:48
Show Gist options
  • Select an option

  • Save pookjw/4c1759df02f51b25f7beb5a657798a45 to your computer and use it in GitHub Desktop.

Select an option

Save pookjw/4c1759df02f51b25f7beb5a657798a45 to your computer and use it in GitHub Desktop.
import SwiftUI
struct MyData: Equatable {
static func == (lhs: MyData, rhs: MyData) -> Bool {
return true
}
var number: Int
}
struct ContentView: View {
@State private var myData = MyData(number: 0)
@State private var trigger: UInt8 = 0
var body: some View {
Text(trigger.description)
Button(myData.number.description) {
myData.number &+= 1
trigger &+= 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment