There's a crash happening when using navigationDestination(for: destination:) multiple times
TripsScreen(store: AppState.shared.tripsStore, path: $path)
.navigationDestination(for: Store1.self, destination: { store in
View1(store: store, path: $path)
})
.navigationDestination(for: Store2.self, destination: { store in
View2(store: store, navPath: $path)
})
.navigationDestination(for: Store3.self, destination: { store in
View3(store: store)
})
It crashes on this function from skip-fuse-ui
nonisolated public func navigationDestination<D, C>(for data: D.Type, @ViewBuilder destination: @escaping (D) -> C) -> some View where D : Hashable, C : View {
return ModifierView(target: self) {
let bridgedDestination: (Any) -> any SkipUI.View = {
let data = ($0 as! SwiftHashable).base as! D
return destination(data).Java_viewOrEmpty
}
return $0.Java_viewOrEmpty.navigationDestination(destinationKey: String(describing: data), bridgedDestination: bridgedDestination)
}
}
and I believe this is caused by the force casting.
I forked the repo and tried adding a fallback EmptyView just to be sure and it doesn't crash but as expected it presents an empty view, but I believe the shape of the destination function could probably be (Any) -> (any View)? so it could return nil and when calling reduce in the destinations we just discard the nil ones.
Please correct me if I'm wrong
There's a crash happening when using navigationDestination(for: destination:) multiple times
It crashes on this function from
skip-fuse-uiand I believe this is caused by the force casting.
I forked the repo and tried adding a fallback EmptyView just to be sure and it doesn't crash but as expected it presents an empty view, but I believe the shape of the destination function could probably be
(Any) -> (any View)?so it could return nil and when calling reduce in the destinations we just discard the nil ones.Please correct me if I'm wrong