Modularizing a growing app

Architecture & patterns Senior Swift 5.9+ iOS 17+ Reviewed By Alok Singh

Order the steps

Put the modularization steps in order.

  • Extract core leaf modules such as design system and networking
  • Add interface modules for features that need each other
  • Move features into their own packages with demo apps
  • Enforce dependency rules in CI and re-measure
  • Measure build times and map the dependency graph
Hint 1 of 1

Start with data, then the safest pieces.

Choose an answer, then open Show answer below to check it.

Show answer

Answer: E A B C D

  1. Measure build times and map the dependency graph You need a baseline to know what to fix.
  2. Extract core leaf modules such as design system and networking Leaves have no internal dependencies, so they're safest to move first.
  3. Add interface modules for features that need each other They break feature-to-feature coupling.
  4. Move features into their own packages with demo apps Teams build and run features in isolation.
  5. Enforce dependency rules in CI and re-measure Rules stop the graph from tangling again.

30-second answer

Measure first, then split the app into Swift packages or frameworks along feature and layer boundaries: core modules (design system, networking, persistence) at the bottom, feature modules above them, and the app target as a thin composition root. Break feature-to-feature dependencies with small interface modules, give each feature a demo app, and enforce the dependency rules in CI.

Practise saying it · 60 s. No recording, just a timer

Explain how you modularize an app.

Say your answer out loud, then check which of these points you covered:

  • Measure first
  • Core, feature, app layers
  • Interface modules
  • Enforce in CI

Deep dive

Incremental builds speed up because changes rebuild fewer modules.

Interface modules let features talk without depending on implementations.

Watch for one giant 'Common' module that everything depends on.

Static vs dynamic linking affects launch time.

Common mistakes

  • Splitting by technical layer only.
  • Circular dependencies hidden behind a shared module.

Senior take & follow-ups

Seniors connect modularization to build times, team ownership and dependency direction.

Follow-up questions

Think of your answer first, then open the hint.

  1. How do features navigate to each other?

    Show hint

    Through interface modules or routes resolved at the app level.

  2. How do you keep rules enforced?

    Show hint

    Dependency checks in CI.

Suggest a fix if something here is wrong or out of date.