Does anyone know of a way to use code from an optional subspec in the core subspec of a pod?
Example:
- optional subspec contains the protocol:
SometimesAvailableProtocol
- in the core I want to define a variable of that type if it exists, something like:
#if canImport(SometimesAvailableProtocol)
var sometimesAvailableVar: SometimesAvailableProtocol
#endif
However, unfortunately canImport
only works with modules and we have noticed that if you use something like canImport(MyPod.SometimesAvailableProtocol)
it works or fails randomly.