File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,14 @@ ScrollViewWithOffsetTracking { offset in
4949ScrollKit has a ` ScrollViewWithStickyHeader ` that makes it easy to set up a stretchy, sticky header:
5050
5151``` swift
52+ import SwiftUI
53+ import ScrollKit
54+
5255struct MyView : View {
5356
5457 @State
55- private var offset = CGPoint.zero
56-
58+ private var scrollOffset = CGPoint.zero
59+
5760 @State
5861 private var visibleRatio = CGFloat.zero
5962
@@ -63,7 +66,7 @@ struct MyView: View {
6366 headerHeight : 250 , // The resting header height
6467 headerMinHeight : 150 , // The minimum header height
6568 headerStretch : false , // Disables the stretch effect
66- contentCornerRadius : 20 // An optional corner radius mask
69+ contentCornerRadius : 20 , // An optional corner radius mask
6770 onScroll : handleScroll // An optional scroll handler action
6871 ) {
6972 // Add your scroll content here, e.g. a `LazyVStack`
@@ -79,7 +82,7 @@ struct MyView: View {
7982 ZStack {
8083 Color.red
8184 ScrollViewHeaderGradient () // By default a dark gradient
82- Text (" Scroll offset: \( offset .y ) " )
85+ Text (" Scroll offset: \( scrollOffset .y ) " )
8386 }
8487 }
8588}
You can’t perform that action at this time.
0 commit comments