Let’s say there is an Xcode project with 50 Swift modules.
A module is a VIPER module composed by 7 files:
- ViewController
- Presenter
- Interactor
- NetworkManager
- Router
- Entities
There are more than 50*7 = 350
files to compile and I really want to split them up into a 50 frameworks, one for each module in order to improve the decoupling and the re-compilation speed.
Keep in mind that I don’t want to create a single module for all the Entities
, Routers
, etc. but instead, a single module contains all the files needed to instantiate and use that "view" (7 files normally).
Is there any down side having such a big number of framework inside an app?
It can grow to 70,80,90 or even 100 frameworks.
Cheers
2
Answers
Yes. Using a large number of dynamic frameworks can increase your app’s launch time.
Also, from personal experience, working on a project with a large number of classes or modules that all do nearly but not quite the same thing is just horrible. You tend to get lots of code that was copied and pasted at some point in the past, and figuring out whether differences are necessary or just the result of small divergences over time is very painful. Do everything you can to keep all the common behavior in base classes. I have no idea what your NetworkManager objects do, for example, but I find it hard to believe that you need 50 different implementations of that idea.