1

Was wondering: if I'm using only CLLocationManager is there any significant win/pro for:

import CoreLocation.CLLocationManager

over:

import CoreLocation

?

raistlin
  • 4,298
  • 5
  • 32
  • 46

2 Answers2

0

With this blog post as I understand it make no difference in performance, the Swift compiler avoid the unused symbols during compile time. It will only change what you can use in your file and avoid using unwanted objects from CoreLocation.

adrgrondin
  • 648
  • 7
  • 17
0

As stated by this thoughtbot blog, there will be no performance gains other than it does help remove excessive symbols you may not need in the particular file you’re working in.

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.

Only scenario you might need to specify the import Module.SubModule when you have two modules define a particular type with the same name.

Note: Haven't found any documentation regarding this on apple developer site. Apple documentation regarding this would be helpful to understand more.

Suhit Patil
  • 11,748
  • 3
  • 50
  • 60