Open1

TCAでアニメーションを使う時の注意点

ようすけようすけ

TCAのやり方のアニメーションの送り方をせずに実装したら、
動かなくて困ったことがありました。 以下でのやり方でアクションを送信したほうが良いみたいです

actionの送り方は

Button("Test Animation Action") {
    viewStore.send(.someAction, animation: .easeInOut(duration: 0.1))
 }

Reducerでは

            case .someAnimationAction:
                state.isShowing = false
                return Effect(value: .disappeared)
                    .delay(for: .seconds(1), scheduler: environment.mainQueue.animation())
                    .eraseToEffect()