{"id":13699164,"url":"https://github.com/AppPear/SwiftUI-PullToRefresh","last_synced_at":"2025-05-04T07:31:45.579Z","repository":{"id":40601747,"uuid":"208638749","full_name":"AppPear/SwiftUI-PullToRefresh","owner":"AppPear","description":"Pull to refresh in SwiftUI for List, NavigationView","archived":false,"fork":false,"pushed_at":"2020-05-29T09:41:18.000Z","size":498,"stargazers_count":411,"open_issues_count":8,"forks_count":51,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-09T19:39:47.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"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/AppPear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-15T18:30:58.000Z","updated_at":"2024-11-06T13:47:27.000Z","dependencies_parsed_at":"2022-09-20T12:16:36.496Z","dependency_job_id":null,"html_url":"https://github.com/AppPear/SwiftUI-PullToRefresh","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FSwiftUI-PullToRefresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FSwiftUI-PullToRefresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FSwiftUI-PullToRefresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FSwiftUI-PullToRefresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AppPear","download_url":"https://codeload.github.com/AppPear/SwiftUI-PullToRefresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224390582,"owners_count":17303579,"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":[],"created_at":"2024-08-02T19:01:07.248Z","updated_at":"2024-11-13T04:30:29.325Z","avatar_url":"https://github.com/AppPear.png","language":"Swift","funding_links":[],"categories":["Swift","UI","🌎 by the community"],"sub_categories":["Pull to refresh"],"readme":"# SwiftUI-PullToRefresh\n\nPull to refresh implementation in SwiftUI for **List and NavigationView**\n\nThis article helped me a lot: https://swiftui-lab.com/scrollview-pull-to-refresh/\nThanks!\n\n![pulltorefresh](./pull.gif \"pulltorefresh\")\n\n## Installation: \n\nIt requires iOS 13 and Xcode 11!\n\nIn Xcode got to `File -\u003e Swift Packages -\u003e Add Package Dependency` and paste inthe repo's url: `https://github.com/AppPear/SwiftUI-PullToRefresh`  \n\n## Usage: \nYou need to add `RefreshableNavigationView(title: String, action: () -\u003e Void, content: () -\u003e View)` to your View. Title is the navigationView title, and the action takes the refresh function. RefreshableNavigationView already encapsulates a List() so in the content you only need to define your cells. If you want TableViewCellSeparators don't forget to add a `Divider()` at the bottom of your cell.\n\nExample: \n\n```swift\nimport SwiftUIPullToRefresh\n\nstruct ContentView: View {\n    @State var numbers:[Int] = [23,45,76,54,76,3465,24,423]\n    \n    var body: some View {\n        RefreshableNavigationView(title: \"Numbers\", action:{\n            self.numbers = self.generateRandomNumbers()\n        }){\n            ForEach(self.numbers, id: \\.self){ number in\n                VStack(alignment: .leading){\n                    Text(\"\\(number)\")\n                    Divider()\n                }\n            }\n        }\n    }\n    \n    func generateRandomNumbers() -\u003e [Int] {\n        var sequence = [Int]()\n        for _ in 0...30 {\n            sequence.append(Int.random(in: 0 ..\u003c 100))\n        }\n        return sequence\n    }\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppPear%2FSwiftUI-PullToRefresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAppPear%2FSwiftUI-PullToRefresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppPear%2FSwiftUI-PullToRefresh/lists"}