<?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 Reena Thakkar on Medium]]></title>
        <description><![CDATA[Stories by Reena Thakkar on Medium]]></description>
        <link>https://medium.com/@rina771995?source=rss-4881db243dd5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FTdMuGN-aWmKm13TeqQolA.jpeg</url>
            <title>Stories by Reena Thakkar on Medium</title>
            <link>https://medium.com/@rina771995?source=rss-4881db243dd5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:17:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rina771995/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[Solid Principles iOS]]></title>
            <link>https://medium.com/@rina771995/solid-principal-ios-98bc52d926ad?source=rss-4881db243dd5------2</link>
            <guid isPermaLink="false">https://medium.com/p/98bc52d926ad</guid>
            <dc:creator><![CDATA[Reena Thakkar]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 08:06:01 GMT</pubDate>
            <atom:updated>2025-08-23T08:06:29.102Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are SOLID Principles?</h3><p>SOLID is an <strong>acronym</strong> for <strong>five object-oriented programming principles</strong> introduced by <strong>Robert C. Martin (Uncle Bob)</strong>.<br> They make your Swift code <strong>flexible</strong>, <strong>testable</strong>, and <strong>easy to maintain</strong>.</p><p><strong>S → Single Responsibility</strong><br> <strong>O → Open/Closed</strong><br> <strong>L → Liskov Substitution</strong><br> <strong>I → Interface Segregation</strong><br> <strong>D → Dependency Inversion</strong></p><h3>1. Single Responsibility Principle (SRP)</h3><blockquote><em>A class should have </em><strong><em>only one reason to change</em></strong><em> → do </em><strong><em>one job only</em></strong><em>.</em></blockquote><h3><strong>Example</strong></h3><p><strong>class UserAPI {</strong><br> func fetchUser() { /* API Call */ }<br>}</p><p><strong>class UserDatabase {</strong><br> func saveUser() { /* CoreData Save */ }<br>}</p><p><strong>class EmailService {</strong><br> func sendEmail() { /* Send Email */ }<br>}</p><h3>2. Open/Closed Principle (OCP)</h3><blockquote><strong><em>Classes should be open for extension but closed for modification</em></strong><em>.<br>You should </em><strong><em>add new functionality without changing existing code</em></strong><em>.</em></blockquote><h3><strong><em>Example</em></strong></h3><p><strong>protocol PaymentMethod {</strong><br> func pay()<br>}</p><p><strong>class CreditCard: PaymentMethod </strong>{<br> func pay() { print(“Paid using Credit Card”) }<br>}</p><p><strong>class PayPal: PaymentMethod</strong> {<br> func pay() { print(“Paid using PayPal”) }<br>}</p><p><strong>class Payment</strong> {<br> private let method: PaymentMethod<br> init(method: PaymentMethod) {<br> self.method = method<br> }<br> <strong>func processPayment()</strong> {<br> method.pay()<br> }<br>}</p><p>let payment = Payment(method: PayPal())<br>payment.processPayment()</p><h3>3. Liskov Substitution Principle (LSP)</h3><blockquote><strong><em>Subclasses should be replaceable with their base classes</em></strong><em> </em><strong><em>without breaking code</em></strong><em>.</em></blockquote><h3><strong>Example</strong></h3><p><strong>protocol Bird</strong> {<br> func move()<br>}</p><p><strong>class Sparrow: Bird</strong> {<br> func move() { print(“Flying…”) }<br>}</p><p><strong>class Penguin: Bird </strong>{<br> func move() { print(“Swimming…”) }<br>}</p><h3>4. Interface Segregation Principle (ISP)</h3><blockquote><strong><em>Don’t force a class to implement methods it doesn’t need</em></strong><em>.<br>Use </em><strong><em>small, specific protocols</em></strong><em> instead of one </em><strong><em>large protocol</em></strong><em>.</em></blockquote><h3>Example</h3><blockquote><strong>protocol Coder {</strong><br> func code()<br>}</blockquote><blockquote><strong>protocol Tester {</strong><br> func test()<br>}</blockquote><blockquote><strong>class Developer: Coder {</strong><br> func code() { print(“Writing code”) }<br>}</blockquote><blockquote><strong>class QA: Tester {</strong><br> func test() { print(“Testing code”) }<br>}</blockquote><h3>5. Dependency Inversion Principle (DIP)</h3><blockquote><strong><em>High-level modules</em></strong><em> should not depend on </em><strong><em>low-level modules</em></strong><em>.<br>Both should depend on </em><strong><em>abstractions (protocols)</em></strong><em>.</em></blockquote><h3>Example</h3><blockquote><strong>protocol Database {</strong><br> func save()<br>}</blockquote><blockquote><strong>class MySQLDatabase: Database {</strong><br> func save() { print(“Saved in MySQL DB”) }<br>}</blockquote><blockquote><strong>class MongoDB: Database {</strong><br> func save() { print(“Saved in MongoDB”) }<br>}</blockquote><blockquote><strong>class UserManager {</strong><br> let database: Database<br> init(database: Database) {<br> self.database = database<br> }<br><strong> func saveUser() {</strong><br> database.save()<br> }<br>}</blockquote><blockquote><strong>let manager = UserManager(database: MongoDB())<br>manager.saveUser()</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98bc52d926ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>