Go to file
Alvaro Sanz Rodrigo fdb558631d Merge branch 'main' of https://github.com/AlvaroSanzRodrigo/SuperScrollView 2023-05-26 13:24:48 +02:00
Demo Initial commit 2023-05-26 13:01:49 +02:00
Sources/SuperScrollView Initial commit 2023-05-26 13:01:49 +02:00
.gitattributes Initial commit 2023-05-26 13:01:49 +02:00
.gitignore Initial commit 2023-05-26 13:01:49 +02:00
LICENSE Create LICENSE 2023-05-26 13:23:18 +02:00
Package.resolved Initial commit 2023-05-26 13:01:49 +02:00
Package.swift Initial commit 2023-05-26 13:01:49 +02:00
README.md Update README.md 2023-05-26 13:24:35 +02:00

README.md

SuperScrollView

This package add the SuperScrollView, an scroll view that provides scrollOffset, scrollSize and isScrolling, it also brings ScrollViewProxy in case you need it.

Requirements

.iOS(.v14),

.macOS(.v12),

.macCatalyst(.v14),

Installation

dependencies: [
  .package(url: "https://github.com/AlvaroSanzRodrigo/SuperScrollView")
]

Usage

This SuperScrollView uses bindings to give you updated data

    @State private var scrollOffset: CGPoint = .zero
    @State private var scrollSize: CGSize = .zero
    @State private var isScrolling: Bool = false
    
    var body: some View {
        VStack {
            Text("Offset: \(scrollOffset.y)")
            Text("Size Width: \(scrollSize.width)")
            Text("Size Height: \(scrollSize.height)")
            Text("Is scrolling: \(isScrolling.description)")
            HStack {
                SuperScrollView(offset: $scrollOffset, size: $scrollSize, isScrolling: $isScrolling) { scrollViewProxy in
                    ForEach(0..<100) { index in
                        Text("This is row \(index)")
                    }
                }
            }
        }
        .padding()
    }

Dependencies

This libary uses IsScrolling from fatbobman/IsScrolling

License

This library is released under the MIT license. See LICENSE for details.