https://github.com/gavinmn/scrollviewoffset
https://github.com/gavinmn/scrollviewoffset
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/gavinmn/scrollviewoffset
- Owner: gavinmn
- License: mit
- Created: 2024-06-08T21:22:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-08T22:05:00.000Z (about 2 years ago)
- Last Synced: 2025-03-28T19:45:25.250Z (about 1 year ago)
- Language: Swift
- Size: 8.79 KB
- Stars: 31
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScrollViewOffset
ScrollViewOffset is a Swift package that provides a ScrollView with an offset callback.
## Installation
You can add ScrollViewOffset to an Xcode project by adding it as a package dependency.
1. From the **File** menu, select **Add Packages**.
2. Enter the package repository URL: `https://github.com/gavinmn/ScrollViewOffset`
## Sample usage
```swift
struct ScrollViewOffsetTest: View {
var body: some View {
ScrollViewWithOffset() { //ScrollViewWithOffset(axes: .horizontal) for horizontal scrolling
ForEach(0..<40) { _ in
Circle()
.frame(width: 64, height: 64)
}
} onScroll: { offset in
print(offset)
}
}
}
```