<?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 Karan Jaiswal on Medium]]></title>
        <description><![CDATA[Stories by Karan Jaiswal on Medium]]></description>
        <link>https://medium.com/@karannew1404?source=rss-66bc0f1748ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*msXeWcj2uheoCGuw24IUFg.jpeg</url>
            <title>Stories by Karan Jaiswal on Medium</title>
            <link>https://medium.com/@karannew1404?source=rss-66bc0f1748ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 21:18:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karannew1404/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[Dependency Inversion & Loose Coupling]]></title>
            <link>https://medium.com/@karannew1404/dependency-inversion-loose-coupling-873635430043?source=rss-66bc0f1748ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/873635430043</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[dependency-inversion]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Karan Jaiswal]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 18:39:26 GMT</pubDate>
            <atom:updated>2026-02-19T18:39:26.330Z</atom:updated>
            <content:encoded><![CDATA[<p>It is the <strong>“D” </strong>in <strong>SOLID</strong> principles , most of the times when we go through this principle we struggle to understand this initially,</p><p>Here I will relate this to you with an real life example which will make you crystal clear about dependency inversion concept as well as use of protocols/interfaces.</p><p>You will also understand Concept of <strong>Loose Coupling ,Dependency Injection and Modularity as well.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*nvnakALAxsSAUBQHq1NDoA.png" /><figcaption>SAMPLE Bulb Holder</figcaption></figure><p><strong>Example</strong> . <br>Assume you got new room and there you have to set a few bulb holders to put bulbs for light.<br>Now , let’s say you have made bulb Holders of your own that only fits <strong>LED’s<br>after </strong>some time passed you see that now you want to fit <strong>smartBulb</strong> or <br><strong>fluroscent</strong> or some designer bulb but it’s not getting in.<br>Because you didn’t thought of scalibilty while designing the holder it only accepts <strong>LED’s</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7bGCNtZrp_qHW_8WwJuEA.png" /></figure><p>Now, You got some idea let’s make all the adapter design same as back part of the bulb -&gt; <strong>base</strong> or <strong>cap</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*Yx3--qsnnS4SvXWBtTqz6A.png" /></figure><p>and <strong>great</strong> ! now your <strong>Holder</strong> can accept alll kind’s of <strong>bulbs</strong> since it has same shape confirming holder.</p><p>You made the holder flexible and now the holder doesn’t depend on LED’s only it can accept any bulb inside it.</p><p>That’s it this is dependency Inversion <br><strong>Bulb Holder</strong> is Higher Module<br><strong>Bulb</strong> is Lower Level Module</p><p>since <strong>Holder</strong> can now accept any type of <strong>bulb</strong> is no more tightly coupled with one type of item.</p><p>What we learn that once we fit the holder in our walls we mostly change bulbs not holders so <strong>bulb are low level </strong>and holders are high level module.</p><h3>Now, let’s understand this with swift code example —</h3><pre>protocol BulbBase {  // this is the same base or cap of holder and bulb.<br>  func bulbOn()<br>}<br><br>class LEDBulb: BulbBase { // led bulb have same base.<br>    func bulbOn() {<br>        print(&quot;LED Bulb is glowing&quot;)<br>    }<br>}<br><br>class SmartBulb: BulbBase { // smart bulb has same base<br>    func bulbOn() {<br>        print(&quot;Smart Bulb is glowing via WiFi&quot;)<br>    }<br>}<br><br>class Fluroscent: BulbBase { // smart bulb has same base<br>    func bulbOn() {<br>        print(&quot;Fluroscent bulb is glowing&quot;)<br>    }<br>}</pre><pre>// your house<br><br>class YourHouse {<br><br>    private let holder: BulbBase // loose coupled.<br>    <br>    init(holder: BulbBase) { // depedency injection<br>        self.holder = bulb<br>    }<br>    <br>    func turnOnSwitch() {<br>        bulb.bulbOn()<br>    }<br>}</pre><pre><br>let holder = BulbHolder(bulb: LEDBulb()) // put led and it is glowing<br>holder.turnOnSwitch()<br><br>let holder = BulbHolder(bulb: SmartBulb()) // changed to wifi-bulb it is glowing<br>holder.turnOnSwitch()<br><br>let holder = BulbHolder(bulb: Fluroscent()) // changed to old fluroscent still glowing<br>holder.turnOnSwitch()<br><br>// this is what all we needed <br>// loosely coupled and inverted.</pre><p>Thank you so much for reading this , it’s my first time am writing this and I hope the concept may clear after reading this if not I ‘ll come up with more concepts soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=873635430043" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solved xcode -select active developer directory error.]]></title>
            <link>https://medium.com/@karannew1404/solved-xcode-select-active-developer-directory-error-4cf029134c96?source=rss-66bc0f1748ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cf029134c96</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[error]]></category>
            <dc:creator><![CDATA[Karan Jaiswal]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 07:33:22 GMT</pubDate>
            <atom:updated>2023-06-12T07:33:22.653Z</atom:updated>
            <content:encoded><![CDATA[<p>The error message you encountered suggests that the command you’re trying to execute, specifically ‘xcodebuild,’ requires Xcode, but your active developer directory is set to a Command Line Tools instance.</p><p>Xcode is the integrated development environment (IDE) provided by Apple for developing software for macOS, iOS, and other Apple platforms. Xcode includes various tools and utilities, including ‘xcodebuild,’ which is a command-line tool for building and managing Xcode projects.</p><p>The active developer directory is the location where Xcode or the Command Line Tools are installed. In your case, it seems that the active developer directory is set to ‘/Library/Developer/CommandLineTools,’ which indicates that you have the Command Line Tools installed but not Xcode itself.</p><p>To resolve this issue, you have a few options:</p><ol><li>Install Xcode: If you intend to use Xcode and its associated tools, you can download and install Xcode from the Mac App Store or Apple’s developer website. Once installed, Xcode will set the active developer directory to the appropriate location, and you should be able to use ‘xcodebuild’ without encountering this error.</li></ol><p>Switch active developer directory: If you prefer to use the Command Line Tools instead of Xcode, you can change the active developer directory to the appropriate Command Line Tools instance. You can do this by executing the following command in your terminal:- <br>sudo xcode-select --switch/Library/Developer/CommandLineTools</p><p>This command updates the active developer directory to the specified location and should allow you to use ‘xcodebuild’ successfully.</p><p>2. Uninstall Command Line Tools: If you don’t need the Command Line Tools and want to use Xcode exclusively, you can uninstall the Command Line Tools by executing the following command in your terminal:</p><pre> rm -rf /Library/Developer/CommandLineTools</pre><p>3. Keep in mind that this will remove the Command Line Tools from your system, and you’ll need to install Xcode if you require the tools provided by Xcode.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cf029134c96" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>