File tree 1 file changed +4
-22
lines changed
Sources/ComposableArchitecture/SharedState
1 file changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -115,29 +115,11 @@ extension SharedReader: CustomDumpRepresentable {
115
115
116
116
extension SharedReader
117
117
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.
119
120
///
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.
141
123
public var elements : some RandomAccessCollection < SharedReader < Value . Element > > {
142
124
zip ( self . wrappedValue. indices, self . wrappedValue) . lazy. map { index, element in
143
125
self [ index, default: DefaultSubscript ( element) ]
You can’t perform that action at this time.
0 commit comments