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
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,35 @@ AdvancedList(yourData, content: { item in
32
32
.lineLimit(nil)
33
33
}, loadingStateView: {
34
34
Text("Loading ...")
35
-
}, pagination: .noPagination)
35
+
})
36
+
```
37
+
38
+
### 🆕 Custom List view
39
+
40
+
Starting from version `6.0.0` you can use a custom list view instead of the `SwiftUI``List` used under the hood. As an example you can now easily use the **LazyVStack** introduced in **iOS 14** if needed.
41
+
42
+
Upgrade from version `5.0.0`**without breaking anything**. Simply add the **listView parameter** after the upgrade:
43
+
44
+
```swift
45
+
AdvancedList(yourData, listView: { rows in
46
+
if#available(iOS14, macOS11, *) {
47
+
ScrollView {
48
+
LazyVStack(alignment: .leading, content: rows)
49
+
.padding()
50
+
}
51
+
} else {
52
+
List(content: rows)
53
+
}
54
+
}, content: { item in
55
+
Text("Item")
56
+
}, listState: $listState, emptyStateView: {
57
+
Text("No data")
58
+
}, errorStateView: { error in
59
+
Text(error.localizedDescription)
60
+
.lineLimit(nil)
61
+
}, loadingStateView: {
62
+
Text("Loading ...")
63
+
})
36
64
```
37
65
38
66
### 📄 Pagination
@@ -91,7 +119,7 @@ AdvancedList(yourData, content: { item in
91
119
.lineLimit(nil)
92
120
}, loadingStateView: {
93
121
Text("Loading ...")
94
-
}, pagination: .noPagination)
122
+
})
95
123
.onMove { (indexSet, index) in
96
124
// move me
97
125
}
@@ -130,7 +158,7 @@ AdvancedList(yourData, content: { item in
130
158
}
131
159
}, loadingStateView: {
132
160
Text("Loading ...")
133
-
}, pagination: .noPagination)
161
+
})
134
162
```
135
163
136
164
For more examples take a look at [AdvancedList-SwiftUI](https://github.com/crelies/AdvancedList-SwiftUI).
0 commit comments