https://github.com/bibinjacobpulickal/bbrefreshablescrollview
A simple implementation of the very commonly used (yet surprisingly unavailable in SwiftUI framework) UIScrollView's pull to refresh functionality implemented natively in SwiftUI without using UIViewRepresentable.
https://github.com/bibinjacobpulickal/bbrefreshablescrollview
Last synced: 3 months ago
JSON representation
A simple implementation of the very commonly used (yet surprisingly unavailable in SwiftUI framework) UIScrollView's pull to refresh functionality implemented natively in SwiftUI without using UIViewRepresentable.
- Host: GitHub
- URL: https://github.com/bibinjacobpulickal/bbrefreshablescrollview
- Owner: bibinjacobpulickal
- License: mit
- Created: 2021-03-04T06:33:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-04T20:28:40.000Z (over 4 years ago)
- Last Synced: 2025-01-11T01:24:14.907Z (5 months ago)
- Language: Swift
- Homepage: https://github.com/bibinjacobpulickal/BBRefreshableScrollView-PullToRefresh
- Size: 547 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BBRefreshableScrollView
A simple implementation of the very commonly used (yet surprisingly unavailable in SwiftUI framework) UIScrollView's pull to refresh functionality implemented natively in SwiftUI without using UIViewRepresentable. Package is compiled using Xcode 12.0 on MacOS 10.15.7 using Swift 5.3 compiler.
---
## Support

[](https://www.apple.com/in/macos/catalina/)
[](https://developer.apple.com/xcode/)
[](https://developer.apple.com/swift/)---
## Code```swift
import SwiftUI
import BBRefreshableScrollViewstruct ContentView: View {
@State private var rows = [1, 2, 3, 4]
var body: some View {
NavigationView {
BBRefreshableScrollView { completion in
addNewRow {
completion()
}
} content: {
VStack {
Divider()
ForEach(rows, id: \.self) { row in
HStack {
Text("Row \(row)")
.fontWeight(.semibold)
.padding()
Spacer()
}
}
}
}
.navigationTitle("iOS Example")
}
}func addNewRow(completion: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
rows.append(rows.count + 1)
completion()
}
}
}
```
---
## Screenshots
Dark mode
Light mode
![]()
![]()
---
## Installation### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but BBAlert does support its use on supported platforms.
Once you have your Swift package set up, adding BBAlert as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/bibinjacobpulickal/BBRefreshableScrollView", .upToNextMajor(from: "1.0.0"))
]
```
---
## Example
Clone or download the project. Open `.xcodeproj` file in Xcode. Change target to iOSExample and run on a device or simulator.## License
BBAlert is released under the MIT license. [See LICENSE](https://github.com/bibinjacobpulickal/BBRefreshableScrollView/blob/master/LICENSE) for details.