<?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 Numpol Poldongnok on Medium]]></title>
        <description><![CDATA[Stories by Numpol Poldongnok on Medium]]></description>
        <link>https://medium.com/@numpolpoldongnok?source=rss-9fff23303fbd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YraSpSnLo6QE1BTG.jpg</url>
            <title>Stories by Numpol Poldongnok on Medium</title>
            <link>https://medium.com/@numpolpoldongnok?source=rss-9fff23303fbd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 18:44:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@numpolpoldongnok/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[[iOS] Get Started with Clean Swift แบบไวไวควิกลี่ลี่]]></title>
            <link>https://medium.com/@numpolpoldongnok/ios-get-started-with-clean-swift-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B9%84%E0%B8%A7%E0%B9%84%E0%B8%A7%E0%B8%84%E0%B8%A7%E0%B8%B4%E0%B8%81%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A5%E0%B8%B5%E0%B9%88-8a33915e4364?source=rss-9fff23303fbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a33915e4364</guid>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Numpol Poldongnok]]></dc:creator>
            <pubDate>Mon, 16 Sep 2019 02:32:14 GMT</pubDate>
            <atom:updated>2019-09-16T02:32:14.794Z</atom:updated>
            <content:encoded><![CDATA[<p>เนื่องด้วยโปรเจค iOS ที่ทำอยู่มีขนาดใหญ่ขึ้นเรื่อยๆ มีรีควายเม้นเพิ่มตลอดเวลาทำให้ MVC architecture มีขนาดของ ViewController ใหญ่ยาวมากๆ และลอจิกส่วนใหญ่ก็อยู่ในนั้น การแก้บั๊กหรือรีแฟกเตอริ่งโค้ดก็ทำได้ลำบาก หายากกว่าจะเจอ ทีมจึงได้มองหาโซลูชั่นใหม่ๆ ซึ่งก็เริ่มที VIPER architecture และ ก็มาลงเอยที่ CLEAN Swift architecture</p><h3>Whats is Clean</h3><p>ก่อนไปต่อ เกริ่นหน่อยว่า clean มีคอนเซปยังไง และให้ประโยชน์อะไรเรา</p><ol><li>ช่วยลดความยุ่งของ dependency เป็นไกด์ไลนว่าเราควรจะแบ่งโค้ดอะไรไว้ตรงไหนแทนที่จะไว้ใน ViewController อย่างเดียว ก็กระจายไป ViewController+Interactor+Presenter</li><li>พอเราต้องการจะแก้อะไร ก็รู้แล้วว่าเริ่มไปดูที่ไฟลไหน เช่น call service ไม่ได้ก็ดูใน Interactor ก่อน</li><li>CLEAN คอนเซฟต้องเขียนแยกเป็นหลายๆโมดูล ทำให้การซํ้าซ้อนกันของ dependency เกิดขึ้นน้อย ไม่เหมือนการเขียนทุกอย่างไว้ในไฟลเดียว</li><li>Unit tests ทำได้ง่าย เพราะ แยกออกจากเฟรมเวิอคอยู่แล้ว</li></ol><p><strong>VIPER กับ CLEAN ต่างกันยังไง??</strong></p><p>VIPER ประกอบด้วย View, Interactor, Presenter, Entity, Router ทำงานกันแบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eY_qqKrqvEeDQFiPZ0tjPQ.png" /><figcaption><strong>VIPER</strong></figcaption></figure><p>CLEAN Swift ก็ประกอบด้วย View, Interactor, Presenter, Entity, Router ทำงานกันแบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*sWuR2eg7RTifNOsecQyFbA.png" /><figcaption><strong>CLEAN Swift</strong></figcaption></figure><p>จาก 2 รูปบน องค์ประกอบหลักของ Clean เหมือน Viper เกือบเป๊ะ ต่างกันแค่</p><ol><li>ใน CLEAN ViewController จะไม่นับเป็น View อีกต่อไป จะแยก View ออกมาต่างหากเลย</li><li>ViewController ถือเป็นตัวหลักแทนที่ Presenter และเชื่อมต่อกับทุกองค์ประกอบ</li><li>ไม่มีการเชื่อมต่อ 2 ทางระหว่าง ViewController, Interactor, Presenter แบบ VIPER แล้ว flow การไหลของจะหมุนไปทางเดียวแบบวงกลมเท่านั่น</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*cRbIr16Xke_yJRwD_MeREA.png" /><figcaption><strong>VIP</strong></figcaption></figure><p>หรือจะมองง่ายๆ ว่า CLEAN ก็คือ VIP</p><p>แทนที่จะให้ Presenter จัดการเรื่อง การตอบสนองของ UI และเตรียม Model เหมือน VIPER</p><p>แต่ VIP จะให้ ViewController รับ Input จาก UI แล้วส่งคำขอ ไปที่ Interactor , ใน Interactor จะมี ลอจิกทุกๆอย่าง เพื่อใช้คิดคำนวน แล้วก็ส่ง result ไปที่ Presenter , ใน Presenter จะเป็นการแปลง result จาก Interactor ให้เป็น model ที่เอากลับไป แสดงผลใน ViewController</p><p>เราจึงใช้ CLEAN Swif (VIP) ด้วยประการฉะนี้ ว่าแล้วก็ไปโหลด template รอเลยครับ เดี๋ยวเราจะมี GGEZ Coading กัล ในตอนถัดไปนะครับ</p><p><strong>วิธี Download &amp; Install</strong><br><a href="https://medium.com/swift2go/installing-the-clean-swift-template-in-xcode-6b4367006827">https://medium.com/swift2go/installing-the-clean-swift-template-in-xcode-6b4367006827</a></p><p><strong>บทความเต็มๆ Clean Swift / Viper เผื่อไปอ่านเพิ่ม</strong><br><a href="https://medium.com/@saad.eloulladi/clean-architecture-for-ios-viper-vip-c19de40b71e2">https://medium.com/@saad.eloulladi/clean-architecture-for-ios-viper-vip-c19de40b71e2</a></p><p><strong>เว๊บหลักความรู้เน้นๆ<br></strong><a href="https://clean-swift.com/">https://clean-swift.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a33915e4364" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>