AppPear/SwiftUI-PullToRefresh
소개
Pull to refresh in SwiftUI for List, NavigationView
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSwiftUI-PullToRefresh
Pull to refresh implementation in SwiftUI for List and NavigationView
This article helped me a lot: https://swiftui-lab.com/scrollview-pull-to-refresh/ Thanks!

Installation:
It requires iOS 13 and Xcode 11!
In Xcode got to File -> Swift Packages -> Add Package Dependency and paste inthe repo's url: https://github.com/AppPear/SwiftUI-PullToRefresh
Usage:
You need to add RefreshableNavigationView(title: String, action: () -> Void, content: () -> 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.
Example:
import SwiftUIPullToRefresh
struct ContentView: View {
@State var numbers:[Int] = [23,45,76,54,76,3465,24,423]
var body: some View {
RefreshableNavigationView(title: "Numbers", action:{
self.numbers = self.generateRandomNumbers()
}){
ForEach(self.numbers, id: \.self){ number in
VStack(alignment: .leading){
Text("\(number)")
Divider()
}
}
}
}
func generateRandomNumbers() -> [Int] {
var sequence = [Int]()
for _ in 0...30 {
sequence.append(Int.random(in: 0 ..< 100))
}
return sequence
}
}
관련 프로젝트 살펴보기
불러오는 중…