Skip to content

Commit c09810e

Browse files
committed
Fix typos in 'ChainCollection' example.
1 parent 09d6d02 commit c09810e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

vision-documents/variadic-generics.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Consider the following `ChainCollection` data structure, which has a type parame
191191

192192
```swift
193193
struct ChainCollection<Element, C...> where C: Collection, C.Element == Element {
194-
var collections: (C...)
194+
var collection: C...
195195
}
196196
```
197197

@@ -212,10 +212,7 @@ Now, a `ChainCollection` subscript can be implemented by first indexing into the
212212
```swift
213213
extension ChainCollection {
214214
subscript(position: ChainCollectionIndex) -> Element {
215-
// Expand the stored tuple into a local variable pack
216-
let collection = collections...
217-
218-
func element<C: Collection<Element>>(in c: Collection, at index: any Comparable) -> Element {
215+
func element<C: Collection<Element>>(in c: C, at index: any Comparable) -> Element {
219216
guard let index = index as? C.Index else { fatalError() }
220217
return c[index]
221218
}

0 commit comments

Comments
 (0)