You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,23 @@ Until then, deprecated features may be removed in any minor version.
6
6
7
7
8
8
9
+
## 0.8
10
+
11
+
Thanks to [@gabrielribeiro](https://github.com/gabrielribeiro), this version adds a `ScrollManager` that can be used to scroll to certain parts of a scroll view.
12
+
13
+
This version also fixes a few 0.7 linting errors.
14
+
15
+
### ✨ Features
16
+
17
+
* The `ScrollManager` is a new type that can be used to scroll within a scroll view.
18
+
* The `ScrollViewWithStickyHeader` can now take a `ScrollManager` in its initializer.
19
+
20
+
### 🐛 Bug Fixes
21
+
22
+
* This version fixes linting errors that were accidentally introduced in 0.7, since Xcode 16.3 isn't able to run build scripts.
// Add your scroll content here, e.g. a `LazyVStack`
42
-
}
43
-
}
44
-
}
45
-
```
46
-
47
-
You can also use the ``ScrollViewOffsetTracker`` together with the ``SwiftUICore/View/scrollViewOffsetTracking(action:)`` view modifier:
48
-
49
-
```swift
50
-
List {
51
-
ScrollViewOffsetTracker {
52
-
ForEach(0...100, id: \.self) {
53
-
Text("\($0)")
54
-
.frame(width: 200, height: 200)
55
-
}
56
-
}
57
-
}
58
-
.scrollViewOffsetTracking { offset in
59
-
print(offset)
60
-
}
61
-
```
62
-
63
-
You use the offset in any way you like, e.g. to fade navigation bar title. This is how ``ScrollViewWithStickyHeader`` is implemented.
64
-
65
-
66
-
67
25
## How to set up a scroll view with a sticky header
68
26
69
27
You can use the ``ScrollViewWithStickyHeader`` view to create a scroll view that has a header view that stretches and transforms when it's pulled down, and sticks to the top as the scroll view content is scrolled:
@@ -109,13 +67,53 @@ The visibleHeaderRatio is how many percent (0-1) that is visible below the navig
109
67
110
68
111
69
112
-
## How to set up a scroll view with a header and overlapping content
70
+
## How to track scroll offset
71
+
72
+
Althouth there are native alternatives, ScrollKit has a ``ScrollViewWithOffsetTracking`` that triggers an action when it's scrolled:
// Add your scroll content here, e.g. a `LazyVStack`
87
+
}
88
+
}
89
+
}
90
+
```
91
+
92
+
You can also use the ``ScrollViewOffsetTracker`` together with the ``SwiftUICore/View/scrollViewOffsetTracking(action:)`` view modifier:
93
+
94
+
```swift
95
+
List {
96
+
ScrollViewOffsetTracker {
97
+
ForEach(0...100, id: \.self) {
98
+
Text("\($0)")
99
+
.frame(width: 200, height: 200)
100
+
}
101
+
}
102
+
}
103
+
.scrollViewOffsetTracking { offset in
104
+
print(offset)
105
+
}
106
+
```
107
+
108
+
You use the offset in any way you like, e.g. to fade navigation bar title. This is how ``ScrollViewWithStickyHeader``, which also provides you with the scroll offset, is implemented.
109
+
110
+
113
111
114
-
A common design pattern is to apply rounded corners to the scroll content, and have it overlay the scroll view header. You can use the ``SwiftUICore/View/scrollViewHeaderRoundedOverlap(_:cornerRadius:)`` view extension to achieve this effect:
112
+
## How to trigger scrolling with code
115
113
116
-

114
+
You can use the ``ScrollManager`` to scroll to certain parts of a scroll view. See the documentation on how to set it up.
117
115
118
-
ScrollKit also has a ``SwiftUICore/View/scrollViewHeaderOverlap(_:)``variant that just applies the overlap, withough any other view modifications.
116
+
The ``ScrollViewWithStickyHeader``applies the propert header and content IDs, and lets you inject a manager and use it to scroll within the scroll view.
0 commit comments