bpoplauschi / bpoplauschi.github.io

https://bpoplauschi.github.io
1 stars 1 forks source link

Advanced static vs dynamic libraries and frameworks on iOS (and macOS) #23

Open bpoplauschi opened 3 years ago

vijaytholpadi commented 1 year ago

Nice article @bpoplauschi !

I have been having similar thoughts as I go through modularising the application at my current workplace.

One thing from your article on When to use dynamic linking -> Multiple static modules depending on the same module does not feel fully convincing to me, as dividing the app into modules seems to be a developer side decision and the duplicate symbol symbols issue that happens is because of the way we have setup the app into modules with transitive dependencies.

However making the module dynamic to solve this warning seems to also have end-user impact in terms of increasing the launch times. I would still agree that incase we shared the code between the application and app-extension target, then a dynamic library would still make sense.

Thoughts?

bpoplauschi commented 1 year ago

Thank you for your feedback @vijaytholpadi !

One thing from your article on When to use dynamic linking -> Multiple static modules depending on the same module does not feel fully convincing to me, as dividing the app into modules seems to be a developer side decision and the duplicate symbol symbols issue that happens is because of the way we have setup the app into modules with transitive dependencies.

I agree this is a developer-side decision. But having the duplicate symbols issue may lead to other issues than just warnings (like crashes in some cases). I mentioned that dynamic linking is a valid option to multiple transitive dependencies to the same module.

However making the module dynamic to solve this warning seems to also have end-user impact in terms of increasing the launch times.

Using dynamic frameworks does have an impact on app launch, but this was improved a lot by Apple over time. So having a handful of dynamic frameworks doesn't have a big effect. Nevertheless, I recommend you always measure (with Instruments) and understand which setup works best for your apps.