SwiftUI-PullToRefresh 1.0.1

SwiftUI-PullToRefresh 1.0.1

Yuantong Lu 维护。



  • 作者:
  • Yuantong Lu

SwiftUI-PullToRefresh

介绍

SwiftUI 的 ScrollView 不支持下拉刷新,这个库为它添加了刷新控件。

安装

  • Cocoapod. pod SwiftUI-PullToRefresh

  • SPM. https://github.com/YuantongL/SwiftUI-PullToRefresh.git

  • 只需将 /Source/RefreshableScrollView.swift 下的源文件复制即可。

使用

如下使用此库中的 RefreshableScrollView 组件:

@State private var isLoading: Bool = false

RefreshableScrollView(isLoading: $isLoading,
                      onRefresh: {
                        // Update your data and
                        self.isLoading = false
                      },
                      content: {
                          // Draw your content view here
                      })

您还可以查看示例应用。