<?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 Serg Tsarikovskiy on Medium]]></title>
        <description><![CDATA[Stories by Serg Tsarikovskiy on Medium]]></description>
        <link>https://medium.com/@sergtsarikovskiy?source=rss-75dd4f1ae4f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RSq0CRVK8Jdd88kz.jpg</url>
            <title>Stories by Serg Tsarikovskiy on Medium</title>
            <link>https://medium.com/@sergtsarikovskiy?source=rss-75dd4f1ae4f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:27:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sergtsarikovskiy/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[Make let not var using Class-Only Protocols in Swift]]></title>
            <link>https://medium.com/@sergtsarikovskiy/swifttip-class-only-protocols-79de2f33a6b2?source=rss-75dd4f1ae4f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/79de2f33a6b2</guid>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[swift-tips]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Serg Tsarikovskiy]]></dc:creator>
            <pubDate>Wed, 08 Nov 2017 21:53:41 GMT</pubDate>
            <atom:updated>2017-11-12T21:16:08.082Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s imagine that we have the following scenario:</p><pre>protocol ManagerProtocol { }</pre><pre>class Manager: ManagerProtocol { }</pre><pre>protocol ShopProtocol {<br>    var manager: ManagerProtocol? { get set }<br>}</pre><pre>class Shop: ShopProtocol {<br>    var manager: ManagerProtocol?<br>}</pre><p>And then we create an instance of our shop that conforms to ShopProtocol like this:</p><pre>let shop: ShopProtocol<br>shop = Shop()</pre><p>And if we hire cool manager for our shop we will create an instance and assign it to shop’s manager:</p><pre>shop.manager = Manager()</pre><p>And compiler will present to us some annoying error:</p><pre><strong>error: cannot perform mutating operation: &#39;shop&#39; is a &#39;let&#39; constant</strong></pre><p>We can fix it by changing our shop instance from <strong>let</strong> to <strong>var</strong>, but we don’t wanna to do it, because shop is not changeable building, we don’t change shop we just changing the one property. To save our lives <strong>Class-Only Protocols </strong>here to comes. We just simply adding <strong>class</strong> keyword and all working as expected:</p><pre>protocol ShopProtocol: class {<br>    var manager: ManagerProtocol? { get set }<br>}</pre><p>What do you think?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79de2f33a6b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>