{"id":20478117,"url":"https://github.com/swiftui-plus/refreshable","last_synced_at":"2025-04-13T13:13:14.798Z","repository":{"id":43404813,"uuid":"400877894","full_name":"SwiftUI-Plus/Refreshable","owner":"SwiftUI-Plus","description":"A backport of the new `refreshable` modifier with support for all SwiftUI versions. (iOS, tvOS, watchOS, macOS)","archived":false,"fork":false,"pushed_at":"2022-07-06T21:54:53.000Z","size":7,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T04:12:42.826Z","etag":null,"topics":["ios","macos","refresh","refreshable","swift","swiftui","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://benkau.com/packages.json","language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftUI-Plus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-28T19:49:24.000Z","updated_at":"2024-10-17T01:54:46.000Z","dependencies_parsed_at":"2022-07-08T05:32:18.678Z","dependency_job_id":null,"html_url":"https://github.com/SwiftUI-Plus/Refreshable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FRefreshable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FRefreshable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FRefreshable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FRefreshable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftUI-Plus","download_url":"https://codeload.github.com/SwiftUI-Plus/Refreshable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717237,"owners_count":21150389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","refresh","refreshable","swift","swiftui","tvos","watchos"],"created_at":"2024-11-15T15:35:15.683Z","updated_at":"2025-04-13T13:13:14.765Z","avatar_url":"https://github.com/SwiftUI-Plus.png","language":"Swift","readme":"![ios](https://img.shields.io/badge/iOS-13-green)\n![tv](https://img.shields.io/badge/tvOS-13-green)\n![watch](https://img.shields.io/badge/watchOS-6-green)\n![mac](https://img.shields.io/badge/macOS-10.15-green)\n\n----\n\n\u003e This backport is now available as `Backport.Refreshable`, in a single Backports library, with a LOT more additions. This should simply my efforts and allow me and others to contribute more backports in the near future.\n\u003e [SwiftUI Backports](https://github.com/shaps80/SwiftUIBackports)\n\n----\n\n# Refreshable\n\n\u003e Also available as a part of my [SwiftUI+ Collection](https://benkau.com/packages.json) – just add it to Xcode 13+\n\nA backport of the new `refreshable` modifier with support for all SwiftUI versions.\n\nThis includes support for a `refreshAction` in the `Environment` as well as a convenient `RefreshableView` that makes it easy to build your own trigger's for _any_ refresh action.\n\n\u003e Note: This package does not (_yet_) include a pull-to-refresh like component.\n\n## Example\n\nTo avoid naming issues, the modifier is called `onRefresh` and to provide a familiar API for ending the refresh, the closure returns a `Refresh` instance that can be used (similary to `presentationMode`), to notify the UI that it should stop refreshing.\n\n```swift\nScrollView {\n    // content\n}\n.onRefresh { refresh in\n    URLSession.shared.dataTask(with: url) { _, _, _ in\n        refresh.wrappedValue.end()\n    }\n}\n```\n\nThen, to provide some UI that triggers the refresh:\n\n```swift\nRefreshableView { phase in\n    switch phase {\n    case let .idle(refresher, action):\n        Button {\n            refresher.perform(action)\n        } label: {\n            Text(title)\n        }\n    case .refreshing:\n        ProgressView()\n    case .notSupported:\n        // `onRefresh` modifier has not been added\n        Text(\"Not refreshable\")\n    }\n}\n```\n\n## Installation\n\nThe code is packaged as a framework. You can install manually (by copying the files in the `Sources` directory) or using Swift Package Manager (**preferred**)\n\nTo install using Swift Package Manager, add this to the `dependencies` section of your `Package.swift` file:\n\n`.package(url: \"https://github.com/SwiftUI-Plus/Refreshable.git\", .upToNextMinor(from: \"1.0.0\"))`\n\n## Other Packages\n\nIf you want easy access to this and more packages, add the following collection to your Xcode 13+ configuration:\n\n`https://benkau.com/packages.json`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftui-plus%2Frefreshable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftui-plus%2Frefreshable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftui-plus%2Frefreshable/lists"}