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
49
49
ScrollKit has a ` ScrollViewWithStickyHeader ` that makes it easy to set up a stretchy, sticky header:
50
50
51
51
``` swift
52
+ import SwiftUI
53
+ import ScrollKit
54
+
52
55
struct MyView : View {
53
56
54
57
@State
55
- private var offset = CGPoint.zero
56
-
58
+ private var scrollOffset = CGPoint.zero
59
+
57
60
@State
58
61
private var visibleRatio = CGFloat.zero
59
62
@@ -63,7 +66,7 @@ struct MyView: View {
63
66
headerHeight : 250 , // The resting header height
64
67
headerMinHeight : 150 , // The minimum header height
65
68
headerStretch : false , // Disables the stretch effect
66
- contentCornerRadius : 20 // An optional corner radius mask
69
+ contentCornerRadius : 20 , // An optional corner radius mask
67
70
onScroll : handleScroll // An optional scroll handler action
68
71
) {
69
72
// Add your scroll content here, e.g. a `LazyVStack`
@@ -79,7 +82,7 @@ struct MyView: View {
79
82
ZStack {
80
83
Color.red
81
84
ScrollViewHeaderGradient () // By default a dark gradient
82
- Text (" Scroll offset: \( offset .y ) " )
85
+ Text (" Scroll offset: \( scrollOffset .y ) " )
83
86
}
84
87
}
85
88
}
You can’t perform that action at this time.
0 commit comments