Skip to content

Allow Animated Binding Changes

Compare
Choose a tag to compare
@zweigraf zweigraf released this 05 Jun 15:34
· 62 commits to master since this release
79f1044
Allow Dispatching of Actions to be animated (#6)

I finally implemented the default arguments for subscripts. They are a bit weird, as they can only be at the end, and the argument names are removed. I had to fiddle a bit to make this work. 

But I like it a lot now :)

This allows to create bindings like this:

```swift
// Dispatches `select(preset: $0)` from an `withAnimation` block
viewModel.binding[\.selectedPreset, .animated] { .select(preset: $0) }
// Same as above, but does not trigger animation
viewModel.binding[\.selectedPreset] { .select(preset: $0) }
// Does not allow to change the value, only getting.
viewModel.binding[\.selectedPreset]
```