<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sashen Singh on Medium]]></title>
        <description><![CDATA[Stories by Sashen Singh on Medium]]></description>
        <link>https://medium.com/@sashensingh?source=rss-a2720b5912f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q7V__LcZqI-v_56SUCAcjA.jpeg</url>
            <title>Stories by Sashen Singh on Medium</title>
            <link>https://medium.com/@sashensingh?source=rss-a2720b5912f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 14:44:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sashensingh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Modularisation in iOS using Swift Package Manager and some approaches we may take (vertical vs…]]></title>
            <link>https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3?source=rss-a2720b5912f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e445ad72af3</guid>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sashen Singh]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 12:46:45 GMT</pubDate>
            <atom:updated>2022-10-24T10:15:41.238Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Modularisation in iOS using Swift Package Manager and some approaches we may take (vertical vs horizontal) 😃</strong></h3><p>What is modularisation and how can it help you in your iOS codebase? The following set of articles will aim to help answer that question. This is a 4 part series which will cover:</p><ul><li>What is modularisation, why would we want to modularise, and how can one achieve this by tailoring it to a company structure?</li><li><a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">Modularising with Swift Package Manager. How can we create a separate module using SPM.</a></li><li><a href="https://medium.com/@sashensingh/how-to-integrate-your-package-module-created-with-swift-package-manager-into-your-workflow-f69a1c582cfd">Integrating our newly created module into our workflow.</a></li><li><a href="https://medium.com/@sashensingh/how-to-create-an-example-app-for-your-swift-package-manager-package-module-ab840a77c3b4">Creating an Example App for our module to help speed up development.</a></li></ul><p>As a reference we will be using this <a href="https://github.com/SashenSinghDev/ModularisationExample">GitHub Repository</a> throughout the series.</p><p>So without further ado, let&#39;s get into part 1 of this series 🙌</p><h4>Problems we currently face dealing with large legacy code bases. 😣</h4><p>Imagine the scenario, you’ve just started a new job, got your brand new laptop and just pulled the codebase. You are then told to take your time, go through the code base, and familiarise yourself with it.</p><p>It&#39;s not long until you realise you’re dealing with a codebase where all code is sitting under one target 🙈. You then start thinking to yourself where should I begin, there&#39;s not much structure here. Maybe the <em>AppDelegate or SceneDelegate, </em>you try and follow the code but it’s not long until things start to get complicated.</p><p>You then think maybe I can build and run the app to get a sense of the user flow and screens to better understand the architecture of the app. To your dismay, this ends up taking a good couple of minutes before you eventually get the app on your simulator.</p><p>You then start thinking this is going to take up a good chunk of your time to build features especially if you want to practise TDD, see changes and iterate quickly whilst coding.</p><p>Unfortunately, this type of scenario happens too often as most company code bases have been around for a long period, where issues such as tech debt become hard to address due to business requirements and pressure.</p><p>The code base then becomes bloated making it hard to follow, build time skyrockets and adding features to certain parts of the code becomes very time-consuming ultimately leading to the developer experience becoming rather unpleasant.</p><h4>What is modularisation and how can it help? 🤔</h4><p>Modularisation is the process of splitting up the codebase into separate modules. This allows for clearer separation of code, whereby modules can run independently of one another and can also be reused which effectively speeds up development time. Some of the benefits include:</p><ul><li><strong>Improve on build times. </strong>Because you’ve separated your code into smaller chunks each module has less code to compile and therefore can be built faster. This enables teams to practise TDD and iterate quickly whilst coding.</li><li><strong>Easier to onboard new joiners. </strong>When joining a company one of your goals may be to ramp up in a particular domain. A modularised application will allow you to do this with ease as you can easily identify the module you need to focus on to ramp up for a particular domain. It&#39;s a lot less daunting than trying to understand the whole app at first especially if it&#39;s a large app.</li><li><strong>Reusability. </strong>Modules can be built in a way such that they may be reused across certain features in the application. This then leads to a speed up development.</li><li><strong>Improved architecture to the codebase and becomes easier to scale and maintain.</strong> If a new feature needs to be built, it’s then easier to identify which module to work on. As your company grows you can easily scale your codebase by adding/removing modules as per requirements.</li></ul><h4>Some approaches we can take for modularisation (vertical vs horizontal). 😬</h4><p>One of the benefits of modularisation is that you can tailor your application to your fit your company structure. This gives a sense of ownership to certain parts of the code whereby a team can take on and maintain more easily. We’ll be discussing two approaches as an idea of how one might approach the modularisation of an application, namely vertically and horizontally modularised.</p><p>If your company has one small mobile team responsible for your application you may want to consider a horizontal modularisation approach. The idea here is to split your app up horizontally, as an example, you could have</p><ul><li><strong>UI Module. </strong>This will be responsible for holding all your UI code such as <em>Views</em>, <em>ViewControllers</em> etc.</li><li><strong>Presentation Module. </strong>This will be responsible for business logic that meets business requirements.</li><li><strong>Feature Module. </strong>This acts as an interface module to the actual implementation. Models are stored in this layer which will be used in the implementation and presentation module. This module acts as the bridge between your presentation and the feature implementation module. This will allow you to easily swap out different implementations without affecting your business logic.</li><li><strong>Feature Implementation Module. </strong>This module holds any implementations of the feature module such as a <em>RemoteFeedLoaderImplementation</em> which may have a dependency on <em>Firebase</em> or <em>URLSession</em> etc.</li></ul><p>Assuming we’re following an MVVM pattern your application could look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FErvnJSr2uFte8AY8XWPcg.png" /><figcaption>Horizontal modularisation example</figcaption></figure><p>If within your company you’re split up into verticals. Each vertical is responsible for achieving its own set of key objectives and with a mobile team belonging to each vertical then you may want to consider a vertical modularisation that could look as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3URI1N_tWJIncbKrBHHVw.png" /><figcaption>Vertical modularisation example</figcaption></figure><p>It&#39;s important to note that for both approaches your modularisation structure may change depending on your requirements and how you want to evolve your application to cater to your organisation&#39;s fit. For example, you may want to take the vertical slices and modularise those further into smaller submodules.</p><p>Once your application is modularised, you may look into building an example app per module. The example app will have the UI integrated so you may run it to see your changes without having to compile and run the main app, which ultimately will quicken up development (This will be covered in part 4 of the series).</p><p>Thank you for taking the time to read this article. Feel free to follow me on <a href="https://twitter.com/SashenSinghDev">Twitter</a>.</p><h4>Follow up article</h4><p>In the next <a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">part</a> of the series, we’ll be looking at taking a sample app and adding a module to it using Swift Package Manager.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e445ad72af3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add a module for modularisation using Swift Package Manager]]></title>
            <link>https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed?source=rss-a2720b5912f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5344414202ed</guid>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sashen Singh]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 12:45:34 GMT</pubDate>
            <atom:updated>2022-10-23T13:29:43.966Z</atom:updated>
            <content:encoded><![CDATA[<p>The following article is part 2 of a 4-part series on modularisation in iOS with Swift Package Manager and some approaches we may take. If you missed out on <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a>, feel free to check it out. As a reference for examples, we will be using this <a href="https://github.com/SashenSinghDev/ModularisationExample">GitHub Repository</a>.</p><p>We shall take the <em>ModularisationStarter</em> project and vertically modularise it as per the approach we discussed in <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a> of the series. The current structure of the starter project looks as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxQOolqMfRC8g7xRjhvYjg.png" /><figcaption><em>ModularisationStarter Project Structure and the sample app built on a simulator</em></figcaption></figure><h4>Adding a package</h4><p>We shall be taking <em>Feature1</em> and moving it out into its module called <em>Feature1Module. </em>The module will be created using Swift Package Manager. To add a package, within Xcode select <em>File &gt; New &gt; Package</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7aK0PzCqbWYs4uuA0gVpkw.png" /><figcaption>Adding a new package in Xcode</figcaption></figure><p>Add an appropriate name to your package in our example we’ll call it <em>Feature1Module</em> and make sure to add it to a <em>Packages</em> folder or create one if it doesn’t exist. Once you’ve created your <em>Packages</em> folder make sure to modify the <em>Add to: </em>and select your current project. As a group select the <em>Packages</em> group you’ve recently created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDaXha33F6q20QSELG8Xsw.png" /><figcaption>Naming and creating our package</figcaption></figure><p>Once created, add your supported platforms with targets to the <em>package.swift</em> file of your module. Here we’ll add iOS supporting iOS15 as an example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5WzoLuj5QsKyURErkI6o8Q.png" /><figcaption>package swift for our newly created module</figcaption></figure><p>Your project structure should now look like this with the newly added package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABH3D52rou7qnxw-GCyIyw.png" /><figcaption>Our project with the newly created package</figcaption></figure><p>We are then free to move the code from our Main App to the module as per the diagram in <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmgy_Vp4zlsLxO60VWhOwA.png" /><figcaption>Moving our code into the new package</figcaption></figure><p>In our main app, we need to then make sure to <em>import Feature1Module </em>wherever we may need it, in our case this would be in the <em>AppDependencyContainer</em>.</p><p>To show clearer separation within our package, we can create further modules within the <em>Feature1Module. </em>To do this restructure your package as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPWGhJFdDtQLCN71p7Ey-w.png" /></figure><p>Next, we’ll modify our <em>package.swift</em> file to represent the different targets and the relationships between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVkFL88dgHU-tqH_1E6O-A.png" /></figure><p>As per our <em>package.swift </em>above we have exposed two targets(<em>FeatureModule1UI</em> and <em>FeatureImplementations</em>) which can then be used externally outside our package, as in the case of our main app.</p><h4>Add modules as dependencies</h4><p>In our example for horizontal modularisation, where we defined each module as a separate package we may need to add links between packages. For example, referring to the <em>Horizontal modularisation example </em>diagram in <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a> we will need a link for our <em>Presentation Module</em> to our <em>Feature Module</em> to use it. To do this add the relevant dependencies to the package.swift file as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGndjp2M5hS8_zo9Wdc09Q.png" /></figure><p>Once this is done we are free to import our Feature module wherever we may need it.</p><p>Thank you for taking the time to read this article. Feel free to follow me on <a href="https://twitter.com/SashenSinghDev">Twitter</a>.</p><h3>Follow up article</h3><p>In the next <a href="https://medium.com/@sashensingh/how-to-integrate-your-package-module-created-with-swift-package-manager-into-your-workflow-f69a1c582cfd">part</a> of the series, we’ll learn how to integrate the package into our workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5344414202ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate your package module created with Swift Package Manager into your workflow]]></title>
            <link>https://medium.com/@sashensingh/how-to-integrate-your-package-module-created-with-swift-package-manager-into-your-workflow-f69a1c582cfd?source=rss-a2720b5912f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f69a1c582cfd</guid>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sashen Singh]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 12:42:55 GMT</pubDate>
            <atom:updated>2022-10-23T13:29:03.217Z</atom:updated>
            <content:encoded><![CDATA[<p>The following article is part 3 of a 4-part series on modularisation in iOS with Swift Package Manager and some approaches we may take. If you missed out on <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a> or <a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">part 2</a>, feel free to check them out. As a reference for examples, we will be using this <a href="https://github.com/SashenSinghDev/ModularisationExample">GitHub Repository</a></p><p>Once we’ve added our new package from <a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">part 2</a> it’s time to integrate it into our workflow. The aim here is to ensure we can build the package separately as this will allow us to develop/iterate quickly and also enable us to perform testing easier.</p><h4>Build our package in isolation</h4><p>To build the package in isolation we are free to choose it from our schemes. This will allow us to only compile code related to the package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pJeuFP9SNjpql8GelN_9g.png" /></figure><h4>Linking our package to our build phase of the main app</h4><p>Next, To ensure all our packages compile without error when running the main app, we will need to link the binary of the package in our build phases. Head over to <em>Build Phases</em> and select the plus button to <em>Link Binary With Libraries.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9IZ-ziwHh5Gj7GVkD3-Vzg.png" /><figcaption>Build phases of our main target</figcaption></figure><p>Ensure we select the correct package to link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NAFaCnnVSHm3y-LsCEkkEg.png" /><figcaption>Adding our module as a link</figcaption></figure><p>We can then run the main app and any errors in your package will be flagged at the build phase.</p><p>Thank you for taking the time to read this article. Feel free to follow me on <a href="https://twitter.com/SashenSinghDev">Twitter</a>.</p><h3>Follow up article</h3><p>In the next <a href="https://medium.com/@sashensingh/how-to-create-an-example-app-for-your-swift-package-manager-package-module-ab840a77c3b4">part</a> of the series, we’ll look at how we can speed up development by creating an Example App for our module.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f69a1c582cfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an Example App for your Swift Package Manager package module.]]></title>
            <link>https://medium.com/@sashensingh/how-to-create-an-example-app-for-your-swift-package-manager-package-module-ab840a77c3b4?source=rss-a2720b5912f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab840a77c3b4</guid>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sashen Singh]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 12:39:51 GMT</pubDate>
            <atom:updated>2022-10-23T12:50:15.480Z</atom:updated>
            <content:encoded><![CDATA[<p>The following article is part 4 of a 4-part series on modularisation in iOS with Swift Package Manager and some approaches we may take. If you missed out on <a href="https://medium.com/@sashensingh/modularisation-in-ios-using-swift-package-manager-and-some-approaches-we-may-take-vertical-vs-9e445ad72af3">part 1</a>, <a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">part 2</a> or <a href="https://medium.com/@sashensingh/how-to-integrate-your-package-module-created-with-swift-package-manager-into-your-workflow-f69a1c582cfd">part 3</a>, feel free to check it out. As a reference for examples, we will be using this <a href="https://github.com/SashenSinghDev/ModularisationExample">GitHub Repository</a></p><h4>Creating an Example App for our module</h4><p>Once we have a package module setup using Swift Package Manager as we did in <a href="https://medium.com/@sashensingh/how-to-add-a-module-for-modularisation-using-swift-package-manager-5344414202ed">part 2</a> We may want to consider adding an Example App.</p><p>The purpose of this app would be to be able to run UI for our module in isolation without running our main app. The app will build and compile a lot faster and we are free to configure the app we want to show our UI, leading to speed up in development. To create an Example App select the plus button in your project to add a new target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bbojk_Wt3b0jIy5Jvgmssg.png" /></figure><p>In our example, we will be creating an iOS application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u41WX87oHb-miqgHTPYReg.png" /></figure><p>Name your Example App accordingly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DL5tDJLnPhbQcpgSl0suWg.png" /></figure><p>You should now see your newly created example app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtyD9h9Zzh7vCNnAb_DEoQ.png" /></figure><h4>Linking our package to the Example App build phases</h4><p>To use our package in our example app we would need to link the binary to our build phases as we did in <a href="https://medium.com/@sashensingh/how-to-integrate-your-package-module-created-with-swift-package-manager-into-your-workflow-f69a1c582cfd">part 3</a>. To do this head over to the build phases of the new example app and add your package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zaK4_AS_yyOM_whbtcTEw.png" /></figure><h4>Using our module in the Example App</h4><p>Once this is done, we can use the package in the example app. For this example head over to the SceneDelegate and add the following code to create our UI used in the <em>Feature1Module</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rX8GVxzXOFVD_n2oUZs34Q.png" /></figure><p>When we run the app we can then see just the UI of our <em>Feature1Module </em>and we can begin to work on this module in isolation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-hhQ4RE3vzCciKXhBomzA.png" /></figure><p>This concludes our series <em>Modularisation in iOS using Swift Package Manager and some approaches we may take. </em>Thank you for taking the time to give it a read. Feel free to follow me on <a href="https://twitter.com/SashenSinghDev">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab840a77c3b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>