@@ -165,11 +165,31 @@ An extended `NSCollectionViewDiffableDataSource that provides:
165
165
166
166
## TableViewDiffableDataSource
167
167
168
- Simliar to CollectionViewDiffableDataSource.
168
+ Simliar to ` CollectionViewDiffableDataSource ` .
169
169
170
170
## OutlineViewDiffableDataSource
171
+
172
+ A diffable data source for ` NSOutlineView ` simliar to ` CollectionViewDiffableDataSource ` .
173
+
174
+ Example usage:
171
175
172
- Simliar to CollectionViewDiffableDataSource.
176
+ ``` swift
177
+ let dataSource = OutlineViewDiffableDataSource< String > (outlineView : outlineView, cellRegistration : cellRegistration)
178
+
179
+ var snapshot = OutlineViewDiffableDataSourceSnapshot< String > ()
180
+ let rootItems [" Root 1" , " Root 2" , " Root 3" , " Root 4" , " Root 5" ]
181
+ snapshot.append (rootItems)
182
+
183
+ rootItems.forEach { rootItem in
184
+ let childItems = (1 ... 5 ).map { " \( rootItem ) .\( $0 ) " }
185
+ snapshot.append (childItems, to : rootItem)
186
+ childItems.forEach { childItem in
187
+ let grandchildItems = (1 ... 5 ).map { " \( childItem ) .\( $0 ) " }
188
+ snapshot.append (grandchildItems, to : childItem)
189
+ }
190
+ }
191
+ dataSource.apply (snapshot, .withoutAnimation )
192
+ ```
173
193
174
194
## Quicklook for NSTableView & NSCollectionView
175
195
@@ -213,7 +233,7 @@ collectionViewItem.quicklookPreview = URL(fileURLWithPath: "someFile.png")
213
233
214
234
## Installation
215
235
216
- Add ` AdvancedCollectionTableView ` to your app's ` Package.swift ` file, or selecting ` File -> Add Package Dependencies ` in Xcode:
236
+ Add ` AdvancedCollectionTableView ` to your app's ` Package.swift ` file, or selecting `File -> Add Package Dependencies in Xcode:
217
237
218
238
``` swift
219
239
.package (url : " https://github.com/flocked/AdvancedCollectionTableView" )
0 commit comments