Modularize Domain-Specific Module (Part 1)

Domain-Specific Module

Figure 1

Getting Started

Figure 2
Gif 1
  1. Open terminal ad land into the DomainPods folder
  2. Run pod lib create Home it will download the template to create a library
  3. When creating a library it asks a few questions platform, language, demo application, testing framework
Input asks : 
What platform do you want to use?? [ iOS / macOS ]
> iOSWhat language do you want to use?? [ Swift / ObjC ]> SwiftWould you like to include a demo application with your library? [ Yes / No ]> YesWhich testing frameworks will you use? [ Quick / None ]> NoneWould you like to do view based testing? [ Yes / No ]> NoRunning pod install on your new library.
Gif 2
Figure 3
  1. Pod folder and files are important to delete since we will add all pod to our main app and this Home module we will add as embedded
  2. git folder since our main app will do this module versioning thing, this is very important and if you didn’t delete this our main app git will ignore this module changes
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
  1. add pod ‘Home’, :path => ‘DomainPods/Home’ to our main App podfile
  2. Run pod install
  3. Open the Main app and run the application
  4. :path => ‘DomainPods/Home’ will create a Development Pods folder and installed pod on it
  5. Its references to Home (0.1.0), Remember we added line s.version = ‘0.1.0’ in .podspec file
Figure 10
Figure 11
Figure 12
  1. first, we embedded a demo app target using the script in podfile and tell it’s a dependency and project reference
  2. pod install
  3. As shown in Figure 13 Demo app is embedded in the main workspace
Figure 13
Figure 14
Figure 15
Figure 16
Figure 17

Use Home Module

Figure 18
Figure 19
Figure 20
Figure 21
Figure 22
Figure 23
Figure 24

Running Home Module Unit Test

Figure 25
Figure 26
Figure 26.1
Figure 27
Figure 28
Figure 29
Figure 30
Figure 31

Put Main Repo on Git

Figure 32
Figure 33
Figure 34
Figure 35
Figure 36
Figure 37
Figure 38

Real Benefit

  1. our main app git is capturing our pod changes, this is the purpose of the domain module that it is embedded in our application and the main application handling its changes
  2. Another benefit is that the reviewer can easily identify the Home domain module is effected.
  3. we can automate this script that If let’s say Person A is the owner of Home module until it approved their file changes PR can’t merge
Figure 39

Dependency between Modules

Figure 40
Figure 41
Figure 42
Figure 43
Figure 44
Figure 45
Figure 46
Figure 47
Figure 48
Figure 49
Figure 50
Figure 51
Figure 52
Figure 53
Figure 54


Useful Links



A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store