title: Does the swift compiler/linker automatically remove unused methods/classes/extensions, etc.?
body: <p>We have a lot of code which is usable in any iOS application we write. Things such as:</p>
  
  <ul>
  <li>Custom/Common Controls</li>
  <li>Extensions on common objects like UIView, UIImage and UIViewController</li>
  <li>Global utility functions</li>
  <li>Global constants</li>
  <li>Related sets of files that make up common 'features' like a picker screen that can be used with anything that can be enumerated.</li>
  </ul>
  
  <p>For reasons unrelated to this question, we cannot use static or dynamic libraries. These must be included in the project as actual source files.</p>
  
  <p>There are several hundred of these 'core' files so what I've been doing is adding all the files to the project (referencing a shared location on disk), but only adding them to specific targets as they are used/needed.</p>
  
  <p>The problem is this becomes quite tedious to do, especially when there are sets of related files which all reference others. Tracking them down one by one is a real pain!</p>
  
  <p>What I'm wondering is if I can simply include everything in the target, then count on the compiler to remove all the unused code.</p>
  
  <p>For instance, I have several extension methods on UIView.  If I don't use them in a particular target, will the compiler exclude that code from the compiled binary, or will it be compiled in, unreachable, bloating the code size for no reason?</p>