Simplifying Swift Framework Development
@_exported
will make animport
-ed module visible to the entire module into which its been imported. This means you don’t have toimport Dependency
in every file you need it. You just@_exported
that dependency once, and you’re good to go in any file in that module.[…]
Second, I define a
public
constant that is the name of the framework, and whose value is theBundle
for that framework. I use the class-based look up (ie, find the bundle that declares this class), because it’s one of the few convenientBundle
initializers that doesn’t return aBundle?
, and thus I don’t have to deal with unwrapping. And then I use a special marker class for making that lookup resilient in the face of other functionality changes.