Skip to content

Repository files navigation

RefreshableScrollView

This project is only for SwiftUI

Pull-to-refresh functionality for List and ScrollView controls

Encapsulated UITableView, UIScrollView, UICollectionView can also be used

Supported Platforms

  • iOS 13.0
  • macOS 10.15
  • tvOS 13.0
  • watchOS 6.0

Usage

classViewModel:ObservableObject{@PublishedvarisRefresh:Bool=false}letarray=["text1","text2","text3"]@StateObjectprivatevarvm=ViewModel()varbody:someView{List{ForEach(0..<array.count){ index inlettext=array[index]HStack{Text(text)}}}.pullToRefresh($vm.isRefresh){
// refresh done
DispatchQueue.main.asyncAfter(deadline:.now()+5.0){
vm.isRefresh =false}}}

Installation

You can add RefreshableScrollView to an Xcode project by adding it as a package dependency.

  1. From the File menu, select Swift PackagesAdd Package Dependency…
  2. Enter https://github.com/HumorousGhost/RefreshableScrollView into the package repository URL text field
  3. Link RefreshableScrollView to your application target

About

pull-to-refresh functionality for List and ScrollView controls

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages