When wildcards are triggered, they currently do not replace the element in the routing path element they 'caught'. Let's add replace(content: Content, for id: ScreenID) to mitigate this and replace the content for the current screen ID whenever a Wildcard Wrapper View appears.
struct WildcardView<Content: View, Wildcard: Screen> {
@Environment(\.navigator) var navigator
@Environment(\.currentScreenID) var id
let wildcard: Wildcard
let content: Content
var body: some View {
content
.uiKitOnAppear {
// check if content == wildcard and only replace if not.
navigator.replace(content: wildcard, for id: id)
}
}
}
When wildcards are triggered, they currently do not replace the element in the routing path element they 'caught'. Let's add replace(content: Content, for id: ScreenID) to mitigate this and replace the content for the current screen ID whenever a Wildcard Wrapper View appears.