How does the Objective-C compiler behave when a Swift bridging header is imported?

Viewed 324

I frequently work on projects that utilize both Swift and Objective-C code. I heavily depend on Swift extensions, and it isn't unusual to see multiple *Extension.swift files with hundreds of lines of code within these projects.

The problem arrises when I just need to use one or two Swift classes in Objective-C. If import ProjectName-Swift.h exposes all Swift files to Objective-C, how is the compiler linking these classes? More importantly, are my Swift extensions being linked to all Objective-C files that import the bridging header?

If I just want a single Swift Dog class within Objective-C, does this come with the penalty of including/exposing all Swift classes/struct/functions/extensions to my DogWalker.m class? Will it end up compiling down to a larger object?

0 Answers
Related