Skip to content

Commit d90939f

Browse files
committed
wip
1 parent 6d6c49d commit d90939f

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

Sources/ComposableArchitecture/SharedState/SharedReader.swift

+4-22
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,11 @@ extension SharedReader: CustomDumpRepresentable {
115115

116116
extension SharedReader
117117
where Value: RandomAccessCollection & MutableCollection, Value.Index: Hashable & Sendable {
118-
/// Derives a collection of shared elements from a shared collection of elements.
118+
/// Derives a collection of read-only shared elements from a read-only shared collection of
119+
/// elements.
119120
///
120-
/// This can be useful when used in conjunction with `ForEach` in order to derive a shared
121-
/// reference for each element of a collection:
122-
///
123-
/// ```swift
124-
/// struct State {
125-
/// @Shared(.fileStorage(.todos)) var todos: IdentifiedArrayOf<Todo> = []
126-
/// // ...
127-
/// }
128-
///
129-
/// // ...
130-
///
131-
/// ForEach(store.$todos.elements) { $todo in
132-
/// NavigationLink(
133-
/// // $todo: Shared<Todo>
134-
/// // todo: Todo
135-
/// state: Path.State.todo(TodoFeature.State(todo: $todo))
136-
/// ) {
137-
/// Text(todo.title)
138-
/// }
139-
/// }
140-
/// ```
121+
/// See the documentation for [`@Shared`](<doc:Shared>)'s ``Shared/elements`` for more
122+
/// information.
141123
public var elements: some RandomAccessCollection<SharedReader<Value.Element>> {
142124
zip(self.wrappedValue.indices, self.wrappedValue).lazy.map { index, element in
143125
self[index, default: DefaultSubscript(element)]

0 commit comments

Comments
 (0)