When we import two packages that each have a member with the same name, we can disambiguate by prepending the package name:
// CoolShapes package:
public struct Circle {
public var radius: Double
}
// CoolMath package:
public struct Circle {
public var diameter: Double
}
// App target:
import CoolShapes
import CoolMath
// Error: 'Circle' is ambiguous for type lookup in this context
var circle1: Circle?
// Both fine:
var circle2: CoolMath.Circle?
var circle3: CoolShapes.Circle?
Is it possible to do the same with property wrappers? I can't find a format e.g. @<package>.<type>
that doesn't result in a compiler error.
This came about when migrating a project from Resolver to Factory, since they both provide the @Injected
wrapper. Using e.g. @Factory.Injected
gives an error 'Injected' is not a member type of generic struct 'Factory.Factory'
.
Cheers!