RefreshableList

1.0.1

A Pull down to refresh List. Also supports to perform an action when scrolling to the last row.
phuhuynh2411/RefreshableList

What's New

Pull to refresh for List

2020-04-07T15:32:31Z
  • Add pull to refresh feature to the List
  • Perform an action when scrolling to the last row.

RefreshableList

A refreshable List. Performing an action when scrolling to the last row.

Pull to refresh

Installation

In XCode, go to File -> Swift Packages -> Add Package Dependency, and add the following url. https://github.com/phuhuynh2411/RefreshableList.git

Usage

Supports two main functions

  • onRefreshPerform: performs an action when pulling the list down and releases.
  • onLastPerform: performs an action when scrolling to the last row.
struct ContentView: View {
    @State var showRefresh: Bool = false
    var body: some View {
        RefreshableList(showRefreshView: $showRefresh){
            ForEach(0..<20, id: \.self) { index in
                VStack(alignment: .leading){
                    Text("Item \(index)")
                    Divider()
                }
            }
        }
        .onRefreshPerform {
            print("add your action here")
            self.showRefresh = false
        }
        .onLastPerform {
            // add your code here
            print("on last row")
        }
    }
}

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 19:25:10 GMT-0900 (Hawaii-Aleutian Daylight Time)