iOS - How to remove implicit imports?

113 Views Asked by At

In my team, we develop several frameworks and in one of the apps integrating said frameworks, they want to enforce the imports of FooBar framework to a specific folder and throw a compile time warning if someone tries to import FooBar outside that folder.

I created a swiftlint rule to detect imports of FooBar outside the folder and it turns out that it also detects some implicit imports that should not be there and throws a warning from my lint rule. Even if the file doesn't explictly import FooBar, it seems to have access to it.

Note: FooBar is an static framework that has both ObjC and swift support and the app project also uses both ObjC and swift to access the framework's functionality.

How can I get rid of implicit imports in an iOS project?

Here's the rule I created

oneplayer_import:
    exclude: "somepath"
    regex: "^#?import .*FooBar.*$"
    message: "FooBar frameworks should not be imported outside somepath"
    severity: warning
0

There are 0 best solutions below