@@ -202,14 +202,22 @@ public struct _NavigationDestinationViewModifier<
202
202
content
203
203
. environment ( \. navigationDestinationType, State . self)
204
204
. navigationDestination ( for: StackState < State > . Component. self) { component in
205
- navigationDestination ( component: component)
205
+ destination ( store . scope ( component: component, fileID : fileID , filePath : filePath , line : line , column : column ) )
206
206
. environment ( \. navigationDestinationType, State . self)
207
207
}
208
208
}
209
+ }
209
210
210
- @MainActor
211
- private func navigationDestination( component: StackState < State > . Component ) -> Destination {
212
- let id = store. id (
211
+ @_spi ( Internals)
212
+ public extension Store {
213
+ func scope< ChildState, ChildAction> (
214
+ component: StackState < ChildState > . Component ,
215
+ fileID: StaticString = #fileID,
216
+ filePath: StaticString = #filePath,
217
+ line: UInt = #line,
218
+ column: UInt = #column
219
+ ) -> Store < ChildState , ChildAction > where State == StackState < ChildState > , Action == StackAction < ChildState , ChildAction > {
220
+ let id = self . id (
213
221
state:
214
222
\. [
215
223
id: component. id,
@@ -222,8 +230,8 @@ public struct _NavigationDestinationViewModifier<
222
230
)
223
231
@MainActor
224
232
func open(
225
- _ core: some Core < StackState < State > , StackAction < State , Action > >
226
- ) -> any Core < State , Action > {
233
+ _ core: some Core < StackState < ChildState > , StackAction < ChildState , ChildAction > >
234
+ ) -> any Core < ChildState , ChildAction > {
227
235
IfLetCore (
228
236
base: core,
229
237
cachedState: component. element,
@@ -238,7 +246,7 @@ public struct _NavigationDestinationViewModifier<
238
246
actionKeyPath: \. [ id: component. id]
239
247
)
240
248
}
241
- return destination ( store . scope ( id: id, childCore: open ( store . core) ) )
249
+ return self . scope ( id: id, childCore: open ( self . core) )
242
250
}
243
251
}
244
252
0 commit comments