Replies: 2 comments 4 replies
-
So apparently removing on of the removeDuplicates allows this to compile. Not sure why. |
Beta Was this translation helpful? Give feedback.
-
Hi @wshamp, I'm not sure there is much we can do here. It just seems like Swift has a problem compiling these expressions, and I think the I was even able to reproduce the problem in vanilla SwiftUI with the struct V: View {
@State var value = 0
var body: some View {
Form {
}
.onChange(of: value, removeDuplicates: ==) { oldValue, newValue in
}
.onChange(of: value, removeDuplicates: ==) { oldValue, newValue in
}
.onChange(of: value, removeDuplicates: ==) { oldValue, newValue in
}
}
}
extension View {
public func onChange<V>(
of value: V,
removeDuplicates: (V, V) -> Bool,
@ViewBuilder _ action: @escaping (_ oldValue: V, _ newValue: V) -> some View
) -> some View {
EmptyView()
}
} So, perhaps we should get rid of the |
Beta Was this translation helpful? Give feedback.
-
Bringing this here from Slack. I was trying to observe two @BindingState properties and the compiler gives me the old unable to type check routine. Just curious if this should work or not. Here is a real simple example that the compiler blows up on.
Beta Was this translation helpful? Give feedback.
All reactions