Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
We ran into a very similar issue yesterday.
also Xcode 14.3
tests that require host app
duplicate symbol warning when running app target tests only
SwiftPM modules pulled in by multiple targets and app tests run in a host application
at the end we are having issues with casting a concrete type to the protocol type (yours is the other way around, but same concept)
In the debugger we can cast to a different type that also implements the protocol that is failing to be cast to correctly
If I run the same code that fails to be cast correctly in a SwiftPM Module test target, it works just fine.
Here are the relevant types
protocol FMLoadable {}
protocol LayerProtocol: FMLoadable {}
protocol FeatureLayerProtocol: LayerProtocol {}
class FeatureLayerMock: FeatureLayerProtocol {}
In the code below, baseLayers is [LayerProtocol] and flattenedOperationalLayers is [LayerProtocol] but contains FeatureLayerMock instances
let items: [Loadable] = (baseLayers + map.flattenedOperationalLayers).filter { !($0 is UnsupportedLayerProtocol) }
This code emits the following when run in the app-level test target, with host application
Could not cast value of type '<moduleA>.FeatureLayerMock' (0x14fd582a0) to '<moduleB>.FMLoadable' (0x141b334c0).
This same code runs fine in a SwiftPM test target test