wayfair / vsm-ios

An iOS framework for the VSM Architecture
MIT License
9 stars 2 forks source link

New Observe function to support Pull To Refresh in SwiftUI #53

Open bdunay3 opened 3 weeks ago

bdunay3 commented 3 weeks ago

Description

SwiftUI has a unique way of support Pull to Refresh. To enable the feature you need to support the refreshable view modifier with takes an async closure. The refresh "task" run and when it completes, SwiftUI will then refresh the view.

The problem we run into with VSM is that when using the existing observable functions inside the refreshable async task, state gets updated before the task completes. This then causes a complete refresh of the view which has two side effects:

  1. It cancels the refreshable task
  2. The update causes the entire view to "snap into place" which is VERY jarring to see as a user. Instead of the content smoothly animating back up into place it snaps right into position.

What this PR does is adds a new "

Type of Change

Checklist