<?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 Tolga Kağan Aysu on Medium]]></title>
        <description><![CDATA[Stories by Tolga Kağan Aysu on Medium]]></description>
        <link>https://medium.com/@tolgakaanaysu?source=rss-7ba0a231161d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Vm_q_xneejAa2OfrYijx6g.jpeg</url>
            <title>Stories by Tolga Kağan Aysu on Medium</title>
            <link>https://medium.com/@tolgakaanaysu?source=rss-7ba0a231161d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:38:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tolgakaanaysu/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[Swift’te associatedType: Protocol’lerin Esnek Type Yapısı]]></title>
            <link>https://medium.com/digigeek/swiftte-associatedtype-protocol-lerin-esnek-type-yap%C4%B1s%C4%B1-c41152a62824?source=rss-7ba0a231161d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c41152a62824</guid>
            <category><![CDATA[protocol-associated-type]]></category>
            <category><![CDATA[associatedtype]]></category>
            <dc:creator><![CDATA[Tolga Kağan Aysu]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 12:58:17 GMT</pubDate>
            <atom:updated>2026-01-05T12:22:21.324Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sXzZmdGJHWX1TDORiZouiA.png" /></figure><h3>AssociatedType nedir?</h3><p>Associatedtype, protocol içinde kullanılan type bilgisini, protocol’ü uygulayan tipe bırakan bir mekanizmadır ve <strong>Protocol-Oriented Programming</strong> yaklaşımının temel parçalarından biridir.</p><h3>AssociatedType ne zaman kullanılır?</h3><p>Swift’te protocol’ler yalnızca fonksiyon imzaları tanımlamak için değil, <strong>davranış sözleşmeleri</strong> oluşturmak için kullanılır. Ancak bazı durumlarda bu davranışların hangi type ile çalışacağını protocol seviyesinde bilmek mümkün değildir. Bu noktada associatedtype devreye girer.</p><p>associatedtype, protocol içinde bir placeholder type tanımlar. Bu type’ın ne olacağı, protocol’e conform eden struct veya class tarafından belirlenir. Böylece protocol, somut tipe bağlı kalmadan güçlü bir type ilişkisi kurabilir.</p><p>Bu yaklaşım sayesinde:</p><ul><li>Compile-time type safety korunur</li><li>Runtime casting ihtiyacı ortadan kalkar</li><li>Protocol, gerçek bir abstraction haline gelir</li></ul><pre>protocol Repository {<br>    associatedtype Entity<br>    func save(_ entity: Entity)<br>    func fetch() -&gt; [Entity]<br>}<br><br>struct User {<br>    let id: Int<br>    let name: String<br>}<br><br>struct Product {<br>    let id: String<br>    let price: Double<br>}<br><br>final class UserRepository: Repository {<br>    func save(_ entity: User) {<br>        ...<br>    }<br><br>    func fetch() -&gt; [User] {<br>        ...<br>    }<br>}<br><br>final class ProductRepository: Repository {<br>    func save(_ entity: Product) {<br>        ...<br>    }<br><br>    func fetch() -&gt; [Product] {<br>        ...<br>    }<br>}</pre><p>Bu örnekte:</p><ul><li>Repository protocol’ü herhangi bir somut type’a bağlı değildir</li><li>UserRepository ve ProductRepository, aynı protocol’ü farklı type’larla uygular</li><li>Protocol değişmeden kalırken, davranış farklı domain’lerde tekrar kullanılır</li></ul><h3>Sonuç</h3><p>associatedtype, Swift’te protocol’leri yalnızca bir interface olmaktan çıkarıp güçlü ve type-safe bir abstraction haline getirir. Aynı davranışın farklı type’larla güvenli şekilde uygulanması gereken senaryolarda, doğru ve sürdürülebilir çözüm sunar.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c41152a62824" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digigeek/swiftte-associatedtype-protocol-lerin-esnek-type-yap%C4%B1s%C4%B1-c41152a62824">Swift’te associatedType: Protocol’lerin Esnek Type Yapısı</a> was originally published in <a href="https://medium.com/digigeek">DigiGeek</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optional try (try?) nedir?]]></title>
            <link>https://medium.com/@tolgakaanaysu/optional-try-try-nedir-a23c6c2aee8?source=rss-7ba0a231161d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a23c6c2aee8</guid>
            <dc:creator><![CDATA[Tolga Kağan Aysu]]></dc:creator>
            <pubDate>Thu, 15 Sep 2022 14:51:08 GMT</pubDate>
            <atom:updated>2022-11-05T01:02:14.789Z</atom:updated>
            <content:encoded><![CDATA[<h3>Optional try (try?) nedir</h3><p>Swift dilinde hata(throw) fırlatan fonksiyonları do try catch bloğunda yazabiliyoruz. Peki bu tür fonksiyonları do try catch kullanmadan optional olarak çağırsak nasıl olur? Bu yazımda optional try (try?) kavramından bahsedeceğim</p><p>Optional try kullanmanın bazı avantajları ve dezavantajları vardır. Eğer sizin için hata önemliyse optional try bu konuda dezavajlıdır. Fakat önemli olan sonucun başarılı olup olmadığı ise optional try kullanmak kolaylık sağlayacaktır</p><p>Örnek vermek gerekirse</p><pre><strong>do</strong> {</pre><pre><strong>    let</strong> sonuc = <strong>try</strong> riskliFonksiyon()</pre><pre>    print(sonuc)</pre><pre>} <strong>catch</strong> {</pre><pre>   // Hata</pre><pre>}</pre><p>Hataların önemli olduğu durumlarda catch bloğu içerisinde yakalayabiliriz</p><pre><strong>if</strong> <strong>let</strong> sonuc = <strong>try</strong>? riskliFonksiyon() {</pre><pre>   print(sonuc)</pre><pre>}</pre><p>Hataların önemli olmadığı durumlarda optional try kullanmak size pratiklik kazandıracaktır. İlerleyen zamanlarda hata önemli olursa do catch yapısına da kolaylıkla geçebilirsiniz</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a23c6c2aee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>