skip to Main Content

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


    • https://github.com/mapbox/mapbox-gl-native/issues/10137 brings up a potential downside. It appears that too many frameworks might be able to cause too many symbol files in Apple AppStore apps upon Apple’s vetting process.
    • As https://medium.com/joshtastic-blog/frameworks-and-libraries-in-swift-2359e4274faa explains, you have a choice on some of the VIPER zones (perhaps presenter, interactor, entities, router if it deals only in app-domain concepts/constructs) of making them static libraries instead of dynamically-linked dylib frameworks, because they would be code-only without Apple-OS-recognized assets (xibs, fonts, images, and so forth). The usage of static libraries where permitted (by lack of assets) could drastically reduce the number of symbol files accompanying dylibs.
    Login or Signup to reply.
  1. Is there any down side having such a big number of framework inside an app?

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search