SwiftUI-Refresher icon indicating copy to clipboard operation
SwiftUI-Refresher copied to clipboard

Refresh status binding

Open AzSiAz opened this issue 3 years ago • 2 comments

Some kind of binding to have a programmatic ability to refresh content or just set view to refresh state

My use case is for when you refresh in subview but navigate back and navigate again to subview but refresh is no longer show Task is launched in global ObservableObject to avoid stopping or losing progress since it's refreshing a lot of item

AzSiAz avatar Jun 01 '22 09:06 AzSiAz

@gh123man is it possible to add

yiweiwoshiniya avatar Sep 02 '24 06:09 yiweiwoshiniya

Hi, You can currently access the underlying binding state via the refreshView argument.

.refresher(refreshView: { bindingState in
            // access bindingState here
            return DefaultRefreshView(state: bindingState)
        }) {
            ...
        }

However it may not be very ergonomic. You will have to mutate the mode and modeAnimated properties of RefresherState.

Let me know if this works for you. If this isn't enough, can you give a code example of what you are trying to accomplish? I'm happy to add support - but I want to make sure we get the API right.

gh123man avatar Sep 02 '24 16:09 gh123man