目录

SwiftUIPullToRefresh

SwiftUIPullToRefresh is designed for ‘pull to refresh’ feature for List and ScrollView elements in SwiftUI.

Installation

Swift Package Manager

You should use Xcode 11 to open your project. Click File -> Swift Packages -> Add Package Dependency, enter CocoaPods repo’s URL. Or you can login Xcode with your GitHub account and just type CocoaPods to search.

https://github.com/muhammedtanriverdi/SwiftUIPullToRefresh.git

Usage

ScrollView

    @EnvironmentObject var viewModel: ViewModel

    ScrollView {
            ForEach(viewModel.data) { item in
                ...
            } 
        } 
        .background(SwiftUIPullToRefresh(action: {
            viewModel.reloadData()
        }, isShowing: $viewModel.dataIsLoading))

List

    @EnvironmentObject var viewModel: ViewModel

    List (viewModel.data) { item in
           ...
        } 
        .background(SwiftUIPullToRefresh(action: {
            viewModel.reloadData()
        }, isShowing: $viewModel.dataIsLoading))

Licence

SwiftUIPullToRefresh is available under the MIT license. See the LICENSE file for more info.

关于
44.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号