Skip to content

Instantly share code, notes, and snippets.

@pookjw
Created April 9, 2025 14:01
Show Gist options
  • Save pookjw/c48cc113883d17b72289cfe5da50599b to your computer and use it in GitHub Desktop.
Save pookjw/c48cc113883d17b72289cfe5da50599b to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State private var value: Bool = false
var body: some View {
VStack {
EquatableView(content: MyView(value: value))
// MyView(value: value).equatable()
Toggle(isOn: $value) {}
}
.padding()
}
}
struct MyView: UIViewRepresentable, Equatable {
static func ==(lhs: MyView, rhs: MyView) -> Bool {
true
}
let value: Bool
func makeUIView(context: Context) -> ContentView {
.init()
}
func updateUIView(_ uiView: ContentView, context: Context) {
print(#function)
}
final class ContentView: UIView {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment