@@ -9,7 +9,9 @@ import OrderedCollections
99///
1010/// See the dedicated article on <doc:Navigation> for more information on the library's navigation
1111/// tools, and in particular see <doc:StackBasedNavigation> for information on modeling navigation
12- /// using ``StackState`` for navigation stacks.
12+ /// using ``StackState`` for navigation stacks. Also see
13+ /// <doc:StackBasedNavigation#StackState-vs-NavigationPath> to understand how ``StackState``
14+ /// compares to SwiftUI's `NavigationPath` type.
1315public struct StackState < Element> {
1416 var _dictionary : OrderedDictionary < StackElementID , Element >
1517 fileprivate var _mounted : Set < StackElementID > = [ ]
@@ -78,19 +80,13 @@ public struct StackState<Element> {
7880
7981extension StackState : RandomAccessCollection , RangeReplaceableCollection {
8082 public var startIndex : Int { self . _dictionary. keys. startIndex }
81-
8283 public var endIndex : Int { self . _dictionary. keys. endIndex }
83-
8484 public func index( after i: Int ) -> Int { self . _dictionary. keys. index ( after: i) }
85-
8685 public func index( before i: Int ) -> Int { self . _dictionary. keys. index ( before: i) }
87-
8886 public subscript( position: Int ) -> Element { self . _dictionary. values [ position] }
89-
9087 public init ( ) {
9188 self . _dictionary = [ : ]
9289 }
93-
9490 public mutating func replaceSubrange< C: Collection > ( _ subrange: Range < Int > , with newElements: C )
9591 where C. Element == Element {
9692 for id in self . ids [ subrange] {
@@ -210,7 +206,7 @@ extension ReducerProtocol {
210206 /// ergonomic and enforce correctness:
211207 ///
212208 /// * It forces a specific order of operations for the child and parent features:
213- /// * When a ``StackAction/element(id:action:)`` action is sent it runs runs the
209+ /// * When a ``StackAction/element(id:action:)`` action is sent it runs the
214210 /// child first, and then the parent. If the order was reversed, then it would be possible
215211 /// for the parent feature to `nil` out the child state, in which case the child feature
216212 /// would not be able to react to that action. That can cause subtle bugs.
0 commit comments