Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geri-borbas/ios.blog.swiftui_pull_to_refresh
✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) condensed into a single modifier.
https://github.com/geri-borbas/ios.blog.swiftui_pull_to_refresh
foreach ios ios13 ios14 list pull-to-refresh refresh scrollview swift swiftui tableview uikit uirefreshcontrol uitableview
Last synced: about 2 months ago
JSON representation
✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) condensed into a single modifier.
- Host: GitHub
- URL: https://github.com/geri-borbas/ios.blog.swiftui_pull_to_refresh
- Owner: Geri-Borbas
- Created: 2020-07-26T01:15:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-30T01:28:54.000Z (almost 3 years ago)
- Last Synced: 2023-08-01T04:27:17.853Z (over 1 year ago)
- Topics: foreach, ios, ios13, ios14, list, pull-to-refresh, refresh, scrollview, swift, swiftui, tableview, uikit, uirefreshcontrol, uitableview
- Language: Swift
- Homepage: https://blog.eppz.eu/swiftui-pull-to-refresh/
- Size: 6.5 MB
- Stars: 35
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# SwiftUI Pull to Refresh
⬇️🔄 SwiftUI Pull to Refresh (for iOS 13 and iOS 14) condensed into a single modifier.Complementary repository for article [SwiftUI Pull to Refresh (for iOS 13 and iOS 14)]. With this extension you can **backport the iOS 15 refreshable modifier to iOS 13 and iOS 14**, and use the exact same code across the board.
https://user-images.githubusercontent.com/1779614/160678139-6f16e4e5-2ec6-4dd6-8f79-87fcdcb05df6.mp4
```Swift
struct ContentView: View {
...
var body: some View {
List {
...
}
.refreshable {
await viewModel.fetch()
}
}
}
```Alternatively, you can opt into the **closure-based API** below to spare using async await API.
```Swift
struct ContentView: View {
...
var body: some View {
List {
...
}
.onRefresh { refreshControl in
viewModel.fetch {
refreshControl.endRefreshing()
}
}
}
}
```## Quick Start
See details in `OnRefreshModifier.swift` and `RefreshableModifier.swift` in [`Refreshable`] package. Find the examples above in the [`Examples`] folder.
For your own projects, simply use [`Refreshable`] Swift Package.
## License
> Licensed under the [**MIT License**](https://en.wikipedia.org/wiki/MIT_License).
[SwiftUI Pull to Refresh (for iOS 13 and iOS 14)]: https://blog.eppz.eu/swiftui-pull-to-refresh/
[`Refreshable`]: https://github.com/Geri-Borbas/iOS.Package.Refreshable
[`Examples`]: SwiftUI_Pull_to_Refresh/Examples