fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.27k stars 168 forks source link

[FEAT] Provide example of how to dynamically update/replace complete data. #285

Closed knurldamer closed 2 years ago

knurldamer commented 2 years ago

Is your feature request related to a problem? Please describe. I'm using SwiftUI and Combine. I'm populating my pager based on the results of a (potentially repeated) network request. Prior to displaying pages I'm displaying a "Loading..." screen. I'd like to have updates to the Pager(data:) property cause the pager to reload. I can manually update the page property if required. Is this possible, and if so, could it be added to the usage examples? This is similar to dynamic additions to the data but from a position of starting with no pages. Would it be possible to have these properties be reactive Combine properties?

Love the control, by the way, thanks. For static data it's worked great!

knurldamer commented 2 years ago

Closing as not required. I tested with empty arrays in the dynamic addition example app and all works as expected. I think my SwiftUI/Combine binding was awry.