Post

Replies

Boosts

Views

Activity

Reply to Captured previous value in onChange is equal to the new value not the old value
In my case I was missing the part in square brackets which captures the old value. Wrong .onChange(of: isSubscribed) { newState in       print("debug", isSubscribed, newState) // will print the same value twice       } Correct .onChange(of: isSubscribed) { [isSubscribed] newState in       print("debug", isSubscribed, newState) // will print two values - old, then new }
Oct ’21