fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.29k stars 172 forks source link

[FEAT] pull to refresh #125

Closed yyl0 closed 4 years ago

yyl0 commented 4 years ago

Is your feature request related to a problem? Please describe. Trying to make a home feed with your pager. Is it possible to add a refresh control when you try to drag down from page 1?

Describe the solution you'd like UIRefreshControl above the pager when pulling down from page 1

Describe alternatives you've considered Tried many hacky ways to do some "onPageChanged" refresh

Additional context Let me know what you think. I tried searching your closed pull requests and issues but couldn't find anything related to this. (Building on iOS 13.7, project is mostly SwiftUI)

Also Thanks for always being so responsive!! You're awesome :o

fermoya commented 4 years ago

Hi @yyl0 , thanks for the kind words.

I’m trying to think of what you need, it doesn’t seem something generic at first glance but rather something specific to your use-case.

So say you have a horizontal Pager. You’d like a UIRefreshControl on pull down. Shouldn’t this be part of your page? I meant this:

Pager(...) {
    MyPage() // has a UIRefreshControl off the screen `.offset(...)`
        .gesture(
            DragGesture()
               .onChanged {
                 // modify offset if your page 
               }
         )
}

I can’t modify the page itself and add elements to it. Pager merely serves as an indexed scroll.

Let me know your thoughts.

yyl0 commented 4 years ago

Thanks for the fast response! I will try that.

yyl0 commented 4 years ago

worked fine ! thanks @fermoya