0

I'm trying to get a better understanding of what the Import statement does. According to this post:

As far as performance and binary size goes, any unused symbols are already optimized out of the final binary by the Swift compiler. If there’s no reference to it at compile time then it’s removed, meaning that importing a framework but not using particular parts of it shouldn’t have any negative implications.

The way I read this, is only those portions of the framework that you utilize are imported into your project

Yet in the same post above the fellow says:

We see that there are more precise imports that can be used if one is concerned about compile time. Such as import UIKit.UITableViewController

This seems to contradict the first statement. Full post Here

Thanks!

Martin Muldoon
  • 3,388
  • 4
  • 24
  • 55
  • The first quote concerns the final binary and its size and performance and the second one concerns compile time so you are comparing apples and oranges. Also note that the answer you are quoting is quoting multiple sources itself so it's a mishmash of information. – Joakim Danielson Feb 19 '20 at 13:01
  • 1
    The second statement doesn't contradict the first one. First one says the unused symbols are stripped during compilation. The second one says that if you are concerned about compile time you can import specific symbols instead of entire framework, which saves shortens the compilation time because it's not necessary to strip unused symbols - because you're not importing them. – mag_zbc Feb 19 '20 at 13:07

0 Answers0