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: README.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,28 @@ Set the absolute offset to a fixed value:
63
63
}
64
64
```
65
65
66
+
### `waitForHeightChange`
67
+
68
+
It may be desirable for `shouldLoadMore` to be called whenever the user scrolls - even if the scroll view content didn't change. You can change this behavior with `waitForHeightChange`:
69
+
```swift
70
+
.shouldLoadMore(waitForHeightChange: .never) {
71
+
// Will be called regardless of if the height changed from a previous update
72
+
}
73
+
```
74
+
75
+
```swift
76
+
.shouldLoadMore(waitForHeightChange: .always) {
77
+
// Will only be called if the content height changed since last time
78
+
}
79
+
```
80
+
81
+
```swift
82
+
.shouldLoadMore(waitForHeightChange: .after(2)) {
83
+
// Will only be called if the content height changed since last time or after 2 seconds of no change
84
+
}
85
+
```
86
+
and now `shouldLoadMore` will be called whenever it's in the offset threshold. By default `waitForHeightChange` is `true` so the function doesn't get called in quick succession when no content updates are made.
87
+
66
88
## More details
67
89
68
90
- The callback will only be called once when the bottom approaches.
@@ -72,6 +94,17 @@ Set the absolute offset to a fixed value:
72
94
73
95
# More Examples
74
96
97
+
## Using a completion handler instead of `async`
98
+
99
+
```swift
100
+
.shouldLoadMore { done in
101
+
loadYourContent {
102
+
data.append(data.last!+1)
103
+
done() // Call done so shouldLoadMore can be called again later
0 commit comments