If I change @State var pan: Int to this:
@State var pan: Int {
set(x) {
self.pan = min(max((x), -50), 50)
}
get {
return self.pan
}
}
I get the error: Cannot apply property wrapper to computed property. The error goes away when I remove the @State wrapper.
But then I get the message, Cannot assign to property: 'self' is immutable
Is there some way that I can get both?
Long story short: No, you can't get both.
Why not simply a second (computed) property
Or alternatively a
@Binding