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?
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 ie CA → C ore A nimation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.