Adapt SwiftUI's Refreshable to iOS13 and iOS14
- Xcode 12.x
- Swift 5.x
- File -> Swift Packages -> Add Package Dependency...
- Enter package URL :https://github.com/sandsn123/LSRefreshable.git, choose the latest release
ScrollView {
ForEach(0..<array.count, id: \.self) { index in
let text = array[index]
HStack {
Text(text)
}
}
}
.makeRefreshable {
try? await Task.sleep(nanoseconds: 2_000_000_000)
}