Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 3 commits into from

Conversation

bdunay3
Copy link
Contributor

@bdunay3 bdunay3 commented Aug 22, 2024

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

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@bdunay3 bdunay3 linked an issue Aug 22, 2024 that may be closed by this pull request
Bill Dunay added 3 commits August 22, 2024 16:36
…e. This is different from the method that takes an async closure that returns a StateSequence.
Copy link

Automatically marking pull request as stale due to lack of activity

@github-actions github-actions bot added the stale label Oct 27, 2024
Copy link

github-actions bot commented Nov 3, 2024

Automatically closing this pull request as stale

@github-actions github-actions bot closed this Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SwiftUI Pull-to-Refresh
1 participant