Reputation: 62062
Consider I have the following:
FrameworkA
, which defines class Foo
FrameworkB
, which also defines class Foo
FrameworkA
which imports FrameworkB
How can I get Xcode to generate either a warning or error on any line that makes references to Foo
without using the namespace qualifier?
For example:
let a = FrameworkA.Foo() // fine, no warning or error
let b = FrameworkB.Foo() // fine, no warning or error
let c = Foo() // at a minimum, a warning
I understand completely that if we are in FrameworkA
, then the third example is equivalent to FrameworkA.Foo()
, but I would like for Xcode to generate a warning or error.
Consider the scenario when class Foo
has existed in FrameworkB
for a long time, and the line of code in question has always intended to point at the class Foo
defined in FrameworkB
, but at some later point in the future, someone added class Foo
into FrameworkA
for some reason. This would change the behavior of the line in the file.
I would like Xcode to generate compile time warnings or errors any time something defined in multiple frameworks imported into a file is used without the namespace being explicitly declared.
Is there a way?
Upvotes: 14
Views: 291
Reputation: 24942
I don't think at this point Xcode supports this unfortunately - some less fruitful solutions:
The second option should be viable for most projects; instead of Foo and Foo, you will have LIBAFoo
, LIBBFoo
, but in practice, with more meaningful prefixes i.e. CA → Core Animation.
Upvotes: 2