<?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 Yoga Chen on Medium]]></title>
        <description><![CDATA[Stories by Yoga Chen on Medium]]></description>
        <link>https://medium.com/@jc051533?source=rss-da2b2dd502c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Am_bKbUM9x3E6SZtxAX1Mw@2x.jpeg</url>
            <title>Stories by Yoga Chen on Medium</title>
            <link>https://medium.com/@jc051533?source=rss-da2b2dd502c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:22:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jc051533/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[#42 倒數計時 — Date Picker 和 Date 的練習]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/42-%E5%80%92%E6%95%B8%E8%A8%88%E6%99%82-date-picker-%E5%92%8C-date-%E7%9A%84%E7%B7%B4%E7%BF%92-931800f933e9?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/931800f933e9</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 08:51:25 GMT</pubDate>
            <atom:updated>2023-07-29T10:23:13.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>#42 倒數計時 — Date Picker 和 Date 的練習</h3><p>練習目的: 學習使用 Date Picker，Date 和將 Date 變成字串，搭配 timer 持續更新現在時間和倒數的時間。</p><p>之前沒有特別做到Date Picker的相關主題，就補上這份練習～</p><p>先來看一下成品：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*vZyi61-qIzVu9GjWNzYJRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*giylddk_JSPqyoR3lVdK4Q.gif" /></figure><blockquote><strong>功能項目：</strong></blockquote><ul><li>跳出視窗設定事件名稱及以DatePicker設定倒數日</li><li>以timeInterval得出與現在的時間差</li><li>利用Timer設定倒數計時</li></ul><blockquote><strong>先拉好storyboard跟IBOutlet、定義變數</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJYcYhaGsmnNtmqPn2dljA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*DuEzGxPFWGqE9B7u6kVH0Q.png" /><figcaption>畫面調整</figcaption></figure><blockquote><strong>IBAction selectDatePicker</strong></blockquote><p><strong>#顯示每秒時間差，倒數功能</strong></p><p>回到viewDidLoad前取得時間＆宣告格式</p><pre> let now = Date() //取得現在時間<br> let dateFormatter = DateFormatter()<br> var timer: Timer? //宣告timer</pre><p><strong>#Timer()</strong></p><p>在IBAction selectDatePicker設定倒數功能</p><p>withTimeInterval: 1 //時間間隔1秒</p><pre>timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { [self] Timer in<br><br>})</pre><p>以timeIntervalSinceNow獲得所選取的時間與現在時間的差距，獲得數值為每秒，要針對每個時間單位作換算</p><pre> let interval = Int(self.countDownDatePicker.date.timeIntervalSinceNow)<br>                       let year = interval / (60 * 60 * 24 * 30 * 12)<br>                       let mth = interval / (60 * 60 * 24 * 30)<br>                       let day = interval / (60 * 60 * 24) % 30<br>                       let hrs = interval / (60 * 60) % 24<br>                       let min = interval / 60 % 60<br>                       let sec = interval % 60</pre><p><strong>#利用NumberFormatter()設定數字顯示</strong></p><pre> let numberFormatter = NumberFormatter() //利用NumberFormatter()設定數字顯示<br> numberFormatter.formatWidth = 2 //十位數顯示<br> numberFormatter.paddingCharacter = &quot;0&quot;</pre><p><strong>#日期格式化</strong></p><pre>dateFormatter.dateFormat = &quot;yyyy/MM/dd&quot; //存取的格式<br>let dateString = dateFormatter.string(from: selectDatePicker.date)//將選擇的日期和時間轉換成文字格式（String）</pre><p>完整程式碼：</p><pre>@IBAction func selectDatePicker(_ sender: Any) {<br>        <br>        //透過 timer 設定每幾秒執行 function<br>        timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { [self] Timer in<br>            let interval = Int(self.countDownDatePicker.date.timeIntervalSinceNow)<br>                       let year = interval / (60 * 60 * 24 * 30 * 12)<br>                       let mth = interval / (60 * 60 * 24 * 30)<br>                       let day = interval / (60 * 60 * 24) % 30<br>                       let hrs = interval / (60 * 60) % 24<br>                       let min = interval / 60 % 60<br>                       let sec = interval % 60<br>            <br>            countDownLabel.text = String(interval/86400)<br>            <br>            let numberFormatter = NumberFormatter() //利用NumberFormatter()設定數字顯示<br>            numberFormatter.formatWidth = 2 //十位數顯示<br>            numberFormatter.paddingCharacter = &quot;0&quot;<br>            <br>            yearLabel.text = numberFormatter.string(from: NSNumber(value: year))<br>            monthLabel.text = numberFormatter.string(from: NSNumber(value: mth))<br>            dayLabel.text = numberFormatter.string(from: NSNumber(value: day))<br>            hourLabel.text = numberFormatter.string(from: NSNumber(value: hrs))<br>            minuteLabel.text = numberFormatter.string(from: NSNumber(value: min))<br>            secondLabel.text = numberFormatter.string(from: NSNumber(value: sec))<br>        })<br>        <br>        <br>        countDownDatePicker.minimumDate = now //設計為倒數日，故最小日期為now<br>            <br>        dateFormatter.dateFormat = &quot;yyyy/MM/dd&quot; //存取的格式<br>        let dateString = dateFormatter.string(from: selectDatePicker.date)//將選擇的日期和時間轉換成文字格式（String）<br>        totalDaysLabel.text = dateString<br>        <br>    }</pre><blockquote><strong>上傳GitHub：</strong></blockquote><p><a href="https://github.com/yoga1006/CountDownApp">GitHub - yoga1006/CountDownApp</a></p><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/40-%E4%B8%96%E7%95%8C%E6%9C%AB%E6%97%A5%E5%80%92%E6%95%B8%E8%A8%88%E6%99%82-date-picker-%E5%92%8C-date-%E7%9A%84%E7%B7%B4%E7%BF%92-ab4d385772f">#40 倒數計時 — Date Picker 和 Date 的練習</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=931800f933e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/42-%E5%80%92%E6%95%B8%E8%A8%88%E6%99%82-date-picker-%E5%92%8C-date-%E7%9A%84%E7%B7%B4%E7%BF%92-931800f933e9">#42 倒數計時 — Date Picker 和 Date 的練習</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#41 function 裡印出計算結果的題目 — 請 AI 出題]]></title>
            <link>https://medium.com/@jc051533/41-function-%E8%A3%A1%E5%8D%B0%E5%87%BA%E8%A8%88%E7%AE%97%E7%B5%90%E6%9E%9C%E7%9A%84%E9%A1%8C%E7%9B%AE-%E8%AB%8B-ai-%E5%87%BA%E9%A1%8C-5bb1a7b8bcb0?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bb1a7b8bcb0</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 09:51:53 GMT</pubDate>
            <atom:updated>2023-07-22T09:51:53.155Z</atom:updated>
            <content:encoded><![CDATA[<h3>#41 function 裡印出計算結果的題目 — 請 AI 出題</h3><p>練習目的：再多加強function &amp; 類別練習，發揮創意請 AI 出題(ChatGPT)，出一些在 function 裡印出計算結果的題目，然後再練習解題。</p><p><a href="https://chat.openai.com/">https://chat.openai.com/</a></p><blockquote><strong>題目一</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q0REOZHGH639Jnr9yaEgHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMiOCiJajA1mC76diTIgkg.png" /></figure><blockquote><strong>題目二</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sYQhDFuIc7jEIPuR_OhTJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBlasZym9j-k9ydSuCEujA.png" /></figure><p>#一起練習到取出小數點後幾位的寫法</p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/swift-%E9%80%8F%E9%81%8E-string-%E8%AE%93%E6%95%B8%E5%80%BC%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%91%88%E7%8F%BE-%E6%95%B4%E6%95%B8%E8%A3%9C%E9%9B%B6-%E5%B0%8F%E6%95%B8%E5%9B%9B%E6%8D%A8%E4%BA%94%E5%85%A5%E8%87%B3%E7%AC%AC%E5%B9%BE%E4%BD%8D%E6%95%B8-eefb15b998b6">【Swift】透過 String 讓數值格式化呈現(整數補零、小數四捨五入至第幾位數)</a></p><blockquote><strong>題目三</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EauvuWVwcg4j9IoTMLzwPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Vo_ULsLoikB9txx2YD_Gg.png" /></figure><p>#一起練習了使用 function 自動帶出今年年份，使用到了 Date 及 Calendar 這兩種 type</p><p><a href="https://stackoverflow.com/questions/48670169/set-a-variable-with-current-year-in-swift">Set a variable with current year in Swift</a></p><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/function-%E8%A3%A1%E5%8D%B0%E5%87%BA%E8%A8%88%E7%AE%97%E7%B5%90%E6%9E%9C%E7%9A%84%E9%A1%8C%E7%9B%AE-%E8%AB%8B-ai-%E5%87%BA%E9%A1%8C-e24cb489fad5">function 裡印出計算結果的題目 — 請 AI 出題</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bb1a7b8bcb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#40 約翰紅茶飲料App-實作Delect功能(3)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/40-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%AF%A6%E4%BD%9Cdelect%E5%8A%9F%E8%83%BD-3-fb980dae1a62?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb980dae1a62</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Sat, 18 Feb 2023 05:44:00 GMT</pubDate>
            <atom:updated>2023-07-22T08:12:03.167Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：刪除資料並更新至Airtable、實作Delect功能</p><p>先展示一下成果：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*BqpSpIg2bDUF_SH1NBGyPQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*w1flviplMYvqrgQOvhJLcQ.gif" /></figure><blockquote><strong><em>技術項目：</em></strong></blockquote><p><strong>REST API(RESTful API)</strong></p><p><strong>使用 URLSession 串接 REST API，實作get、post、delete功能</strong></p><blockquote><strong><em>App功能：</em></strong></blockquote><p>・下載Airtable飲料資料<br>・客製化訂購飲料<br>・購物車確認＆刪除<br>・上傳Airtable訂購資料</p><blockquote><strong><em>查看API文件</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*Vtz9vIJWA3kNGxJZyUfZkQ.png" /><figcaption>id欄位自動生成</figcaption></figure><p>刪除訂單會照id做刪除，原先airtable沒有新增id欄位，它會自動生成id</p><blockquote><strong><em>Xcode 先新增 file(OrderData)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*qKF8U1ex3wYDhQvfke8UWg.png" /></figure><blockquote><strong><em>OrderViewController</em></strong></blockquote><ol><li>由於TableView內已經有相關的程式碼，先取消註解</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ti1UvzlNHNJXxTDtfGf-2g.png" /></figure><p>2. 加入刪除的程式碼</p><p><strong>REST API(RESTful API)-Delete功能</strong></p><p>新增資料 httpMethod = “DELETE”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04485c98ceb274fb2ee84b8794329560/href">https://medium.com/media/04485c98ceb274fb2ee84b8794329560/href</a></iframe><p>第一篇：實作Get 功能</p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/38-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%88%A9%E7%94%A8airtable%E5%BB%BA%E7%AB%8B%E8%B3%87%E6%96%99-%E5%AF%A6%E4%BD%9Cget-%E5%8A%9F%E8%83%BD-1-7bc54c53b050">#38 約翰紅茶飲料App-利用Airtable建立資料、實作Get 功能(1)</a></p><p>第二篇：實作Post 功能</p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/39-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E4%B8%8A%E5%82%B3%E8%B3%87%E6%96%99%E8%87%B3airtable-%E5%AF%A6%E4%BD%9Cpost%E5%8A%9F%E8%83%BD-2-9ed76300ad27">#39 約翰紅茶飲料App-上傳資料至Airtable、實作Post功能(2)</a></p><blockquote><strong>上傳GitHub：</strong></blockquote><p><a href="https://github.com/yoga1006/DrinkApp">GitHub - yoga1006/DrinkApp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb980dae1a62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/40-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%AF%A6%E4%BD%9Cdelect%E5%8A%9F%E8%83%BD-3-fb980dae1a62">#40 約翰紅茶飲料App-實作Delect功能(3)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#39 約翰紅茶飲料App-上傳資料至Airtable、實作Post功能(2)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/39-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E4%B8%8A%E5%82%B3%E8%B3%87%E6%96%99%E8%87%B3airtable-%E5%AF%A6%E4%BD%9Cpost%E5%8A%9F%E8%83%BD-2-9ed76300ad27?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ed76300ad27</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Thu, 09 Feb 2023 02:50:38 GMT</pubDate>
            <atom:updated>2023-07-22T07:25:41.757Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：上傳資料至Airtable、實作Post功能</p><p>先展示一下成果：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muJ14eDCZ0Kzx1O1Idc8Fg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*MPB26sQOv2WDFIM3G0X7Fw.gif" /></figure><blockquote><strong><em>技術項目：</em></strong></blockquote><p><strong>REST API(RESTful API)</strong></p><p><strong>使用 URLSession 串接 REST API，實作get、post、delete功能</strong></p><blockquote><strong><em>App功能：</em></strong></blockquote><p>・下載Airtable飲料資料<br>・客製化訂購飲料<br>・購物車確認＆刪除<br>・上傳Airtable訂購資料</p><blockquote><strong><em>1. 建立飲料資料庫(建立上傳飲料資料的分頁)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fv4o3-9UPAHkJmxubwxhZg.png" /></figure><blockquote><strong><em>2.查看API文件</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*qOOBG_Co_WB6pjbY31k5hg.png" /></figure><p>接下來要取得 API key</p><blockquote><strong><em>依據 Airtable 的 Json 格式，在 Xcode 先新增 file(OrderData)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*0UBV_snnSQKgBOQx17a-kg.png" /></figure><blockquote><strong><em>OrderViewController</em></strong></blockquote><p><strong>REST API(RESTful API)-POST功能</strong></p><p>新增資料 httpMethod = “POST”<br>value 為 “application/json”<br>headerField 為 “Content-Type”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b22QRC4jM-nm5PTW_Pd7UA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*4mE_y391LkuCKguGKCSNXQ.gif" /></figure><blockquote><strong><em>ShoppingcartTableViewCell</em></strong></blockquote><p>建立 TableViewCell.swift 並拉出相對應的 outlet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HAdhSno2nDbyigh7xHIvg.png" /></figure><blockquote><strong><em>ShoppingcartTableViewController(飲料總訂單）</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qyAH3KA2x-rft_r_cZk_Rw.png" /><figcaption>資料對應的sections&amp;rows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhwY1puYGydxsEAavqOwxQ.png" /><figcaption>並把抓取的資料設定給 Cell</figcaption></figure><p><strong>REST API(RESTful API)-GET功能</strong></p><p>再把上傳到airtable的訂單資料抓取回表格中，又再應用GET功能</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8qLJ1EMTaZXcYNV1DT_Zg.png" /></figure><p>第一篇：實作Get 功能</p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/38-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%88%A9%E7%94%A8airtable%E5%BB%BA%E7%AB%8B%E8%B3%87%E6%96%99-%E5%AF%A6%E4%BD%9Cget-%E5%8A%9F%E8%83%BD-1-7bc54c53b050">#38 約翰紅茶飲料App-利用Airtable建立資料、實作Get 功能(1)</a></p><p>預計接下來會有</p><p>第三篇：刪除資料Delete功能</p><p><strong>參考文章：</strong></p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/%E8%A8%82%E9%A3%B2%E6%96%99-app-50%E5%B5%90-73f1577b4e02">訂飲料 App— 50嵐</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ed76300ad27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/39-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E4%B8%8A%E5%82%B3%E8%B3%87%E6%96%99%E8%87%B3airtable-%E5%AF%A6%E4%BD%9Cpost%E5%8A%9F%E8%83%BD-2-9ed76300ad27">#39 約翰紅茶飲料App-上傳資料至Airtable、實作Post功能(2)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#38 約翰紅茶飲料App-利用Airtable建立資料、實作Get 功能(1)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/38-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%88%A9%E7%94%A8airtable%E5%BB%BA%E7%AB%8B%E8%B3%87%E6%96%99-%E5%AF%A6%E4%BD%9Cget-%E5%8A%9F%E8%83%BD-1-7bc54c53b050?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bc54c53b050</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Sun, 18 Dec 2022 11:43:07 GMT</pubDate>
            <atom:updated>2022-12-18T15:48:29.130Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：利用 Airtable 串接後台API，實作Get 功能</p><p>第一篇：建立Airtable、下載資料Get功能、資料傳遞IBSegueAction</p><p>展示一下成果：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C_5KdG5WTP_7xk5bhYoFyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*q34n5fRvX3USERdhhEk-sA.gif" /></figure><blockquote><strong><em>技術項目：</em></strong></blockquote><p><strong>REST API(RESTful API)</strong></p><p><strong>使用 URLSession 串接 REST API，實作get、post、delete功能</strong></p><blockquote><strong><em>App功能：</em></strong></blockquote><p>・下載Airtable飲料資料<br>・客製化訂購飲料<br>・購物車確認<br>・上傳Airtable訂購資料</p><blockquote><strong><em>1. 建立飲料資料庫(註冊及使用Airtable)</em></strong></blockquote><p>在 Airtable 註冊一個帳號 <a href="https://airtable.com/">https://airtable.com/</a><br>依據<a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8-airtable-%E8%A3%BD%E4%BD%9C-ios-app-%E9%80%A3%E7%B5%90%E7%9A%84%E5%BE%8C%E5%8F%B0%E8%B3%87%E6%96%99-e22378536acb">這個網站</a>的步驟，一步一步建制我們要上傳的項目，並在 AirTable上建立約翰紅茶飲料資料，欄位分別為：飲料名字、飲料分類、飲料敘述、中杯大杯價錢、是否提供熱飲珍珠、糖度、冰量</p><p>約翰紅茶飲品分成「紅茶經典」、「紅茶那堤」、「紅茶特調」三種，在Airtable直接分成三個表單，讓App可以依品相做頁面的切換</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHycCf_LMRf_BCZJ2LCoSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eyVDYnXrnNjvPVMLm2Z7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idEnlxtlUt9Q294u8tyJlg.png" /></figure><blockquote><strong><em>2.查看API文件</em></strong></blockquote><p>閱讀AirTable的API使用規範，看取得資料需使用的Url<br>左邊切換到 AUTHENTICATION 的分類，找到右邊連結的網址</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*7Rfl4LF003z2DliSJvgN0Q.png" /></figure><p>接下來要取得 API key</p><p>1. 先連接到 <a href="https://airtable.com/account">https://airtable.com/account</a><br>2. 點選 Generate API key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vd8hpqxOn_7hnV5X0kBI1Q.png" /><figcaption>點選紫色區塊就會出現API key</figcaption></figure><blockquote><strong><em>3.設計storyboard畫面</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q81jxw7nn9WQkvD3pMSdZA.png" /><figcaption>在 storyboard 用 1 個 UIView 帶入 3 個 TableViewController，最後再把點選的畫面資料傳給下一個頁面</figcaption></figure><blockquote><strong><em>4.撰寫程式</em></strong></blockquote><p><strong>(1)依據 Airtable 的 Json 格式，在 Xcode 先新增 file(DrinkData)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*nyQOLgpzUBosfAixrW8pzg.png" /></figure><p><strong>(2)頁面切換的程式碼：</strong></p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8%E5%A4%9A%E5%80%8B-container-view-%E5%88%87%E6%8F%9B%E9%A0%81%E9%9D%A2-6d00fe848572">利用多個 container view 切換頁面</a></p><p><strong>(3)MenuViewController 中的 UIView，以 Page1TableViewController 為說明：</strong></p><blockquote><strong><em>Page1TableViewController</em></strong></blockquote><p>REST API(RESTful API)-GET功能</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lk_WAZgaoualqX7xz-Mkxw.png" /><figcaption>抓取menu1資料</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8nHYVJTfcOD4s1VcGtTnnA.png" /><figcaption>資料對應的sections&amp;rows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKZzDThNFSeaTb5lRQZbBA.png" /><figcaption>並把抓取的資料設定給 Cell</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XM6tfZUjN_B1c0W0K031Yw.png" /><figcaption>傳遞資料至下一頁(OrderViewController)</figcaption></figure><blockquote><strong><em>Page1TableViewCell</em></strong></blockquote><p>建立 TableViewCell.swift 並拉出相對應的 outlet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYtg976R5cUOg_dMzyatXQ.png" /></figure><blockquote><strong><em>OrderViewController</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_AT7cwfN0wJzB3GS_CH6cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmThnW-D9DGWlgaKQQjOTw.png" /><figcaption>定義 init，由參數設定 property</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*L-12iMAzrLvnn14DtSU82Q.png" /><figcaption>viewDidLoad畫面設定(是否有熱飲跟珍珠選項)</figcaption></figure><p>飲品客製化選擇設定</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*IQIPecxvhkZPTWgXpVaD8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*LsSz8Iql2VehilrZ-hROrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHtpFIxVEE7ccANkdyv1LA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWxPiEzmlz42GWvwHjL75g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*Xu1Vghze_xjg6Nm82s4deA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fszsqJav3oGtB-lJZWchUw.png" /></figure><p>UIAlertController，確認訂購者姓名是否有輸入</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SFpaFVKtxh-Tkt7FCLLwxw.png" /></figure><p>預計接下來會有</p><p>第二篇：上載資料Post功能</p><p>第三篇：刪除資料Delete功能</p><blockquote><strong><em>參考文章：</em></strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/%E4%BD%A0%E5%87%BA%E5%8A%9B%E5%AF%AB-app-%E6%88%91%E5%87%BA%E9%8C%A2%E8%AB%8B%E9%A3%B2%E6%96%99-6a9ac14a2a22">#20 訂飲料 App，上傳資料到後台</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bc54c53b050" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/38-%E7%B4%84%E7%BF%B0%E7%B4%85%E8%8C%B6%E9%A3%B2%E6%96%99app-%E5%88%A9%E7%94%A8airtable%E5%BB%BA%E7%AB%8B%E8%B3%87%E6%96%99-%E5%AF%A6%E4%BD%9Cget-%E5%8A%9F%E8%83%BD-1-7bc54c53b050">#38 約翰紅茶飲料App-利用Airtable建立資料、實作Get 功能(1)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#37 隨機圖片 API]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/37-%E9%9A%A8%E6%A9%9F%E5%9C%96%E7%89%87-api-99487332e566?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/99487332e566</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 09:01:30 GMT</pubDate>
            <atom:updated>2022-09-30T11:39:46.013Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：搭配隨機圖片 API，練習利用 URLSession 抓圖。</p><p>先來看一下成品：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oni-RwYJ_XHu6t0metZExQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*8nyHSHvN8ThhJpDhCAIyNQ.gif" /></figure><blockquote><strong>技術項目：</strong></blockquote><ul><li>URL Session 抓圖(隨機圖片API)</li><li>UIAlertController</li></ul><p>內容</p><ul><li>在畫面上顯示多張圖片</li><li>點選 button 重新抓取隨機圖片</li></ul><blockquote><strong>建立Cocoa Touch Class(PicViewController)</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*1fmqntX-2V5hfYkeocvOdw.png" /></figure><blockquote><strong>URL Session 抓圖(隨機圖片API)</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a93560a381ad0817c2baa545911adb2a/href">https://medium.com/media/a93560a381ad0817c2baa545911adb2a/href</a></iframe><blockquote><strong>UIAlertController(新增標題)</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04485c98ceb274fb2ee84b8794329560/href">https://medium.com/media/04485c98ceb274fb2ee84b8794329560/href</a></iframe><blockquote><strong>上傳GitHub：</strong></blockquote><p><a href="https://github.com/yoga1006/randompicAPI">GitHub - yoga1006/randompicAPI</a></p><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/128-%E9%9A%A8%E6%A9%9F%E5%9C%96%E7%89%87-api-692ce98d6b1e">#128 隨機圖片 API</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99487332e566" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/37-%E9%9A%A8%E6%A9%9F%E5%9C%96%E7%89%87-api-99487332e566">#37 隨機圖片 API</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#36 使用 JSONDecoder 把 JSON 轉換成自訂型別的資料]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/36-%E4%BD%BF%E7%94%A8-jsondecoder-%E6%8A%8A-json-%E8%BD%89%E6%8F%9B%E6%88%90%E8%87%AA%E8%A8%82%E5%9E%8B%E5%88%A5%E7%9A%84%E8%B3%87%E6%96%99-95356e02230d?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/95356e02230d</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Thu, 08 Sep 2022 14:15:06 GMT</pubDate>
            <atom:updated>2022-09-09T04:09:51.937Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：練習 <strong>JSON decode(iTunes、Dcard)</strong></p><blockquote><strong>利用 JSON Editor Online 排版JSON 資料，可以更清楚看出分層：</strong></blockquote><p><a href="https://jsoneditoronline.org/#left=local.xavozo&amp;right=local.wogoni">JSON Editor Online: JSON editor, JSON formatter, query JSON</a></p><blockquote><strong>iTunes 搜尋 swift 當例子，API 的網址為：</strong></blockquote><p><a href="https://itunes.apple.com/search?term=swift&amp;media=music">https://itunes.apple.com/search?term=swift&amp;media=music</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdjtFhr_OUGQxZICw8GNhg.png" /></figure><p>先分層JSON，JSON 對應的自訂型別，當 JSON 愈多層，愈多 { } 時，需要定義愈多的 struct</p><blockquote><strong>第一層資料：</strong></blockquote><p>有兩個key，分別是resultCount、result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*FsfPBNHqCtgvHhn9YlehLw.png" /></figure><p><strong>struct </strong>自訂第一層資料格式，命名為 SearchResponse，兩個參數型別格式、命名必須跟JSON回傳的一模一樣，results有50筆資料，用array儲存，命名為[StoreItem]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*DWWXP77DrIXnMqmFtpe2NQ.png" /></figure><blockquote><strong>第二層資料：</strong></blockquote><p>results中的資料，沒有再包{}，可知此JSON就兩層</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVIJE7hVIhJAzqcCEVDURQ.png" /></figure><p><strong>struct </strong>自訂第二層資料格式，命名為StoreItem，定義要抓的資料的key、型別格式，有些資料會是optional，有可能為nil，需加上?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*4qYRuQg-8FDO3-JawKiRbw.png" /></figure><blockquote><strong>解析 JSON 資料的方法（利用 JSONDecoder）</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhDOxJIi8yg7Dx_aC8UC8Q.png" /></figure><blockquote><strong>執行結果</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Lqh5rFF6TyncyLKK0jo0A.png" /><figcaption>searchResponse.results[2].trackName</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yee7FPYKjhj8Dg3ZV-3R5Q.png" /><figcaption>searchResponse.results[3].trackName</figcaption></figure><blockquote><strong>程式說明：</strong></blockquote><ol><li>不會卡住 UI 的下載方法，利用 URLSession，dataTask回傳抓資料的任務</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1aQvLHYDgh6NSHDPfNamg.png" /></figure><p>dataTask(with:completionHandler:) 的 completionHandler</p><p>completionHandler: (Data?,URLResponse?, Error?) -&gt; Void) -&gt;<br>URLSessionDataTask</p><p>• data: 抓到的資料<br>• response: 後台回傳抓資料的相關結果<br> •error: 錯誤資訊</p><pre><strong>let</strong> urlString = &quot;https://itunes.apple.com/search?term=swift&amp;media=music&amp;country=tw&quot;</pre><pre><strong>if</strong> <strong>let</strong> url = URL(string: urlString){</pre><pre>URLSession.shared.dataTask(with: url) { data, response, error <strong>in</strong></pre><pre>...<br>...<br>...</pre><pre>}</pre><p>2. JSONDecoder解碼的物件，把JSON的資料轉換成自訂型別</p><pre><strong>let</strong> decoder = JSONDecoder()</pre><p>3. JSONDecoder 解析時間的 DateDecodingStrategy</p><pre>decoder.dateDecodingStrategy = .iso8601</pre><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/jsondecoder-%E8%A7%A3%E6%9E%90%E6%99%82%E9%96%93%E7%9A%84-datedecodingstrategy-a4095481f193">JSONDecoder 解析時間的 DateDecodingStrategy</a></p><p>4. do catch：有可能會丟錯誤出來的程式可以用do catch寫</p><p>do{}：寫要試的內容</p><p>catch{}：有錯誤要跑到catch</p><pre><strong>do</strong>{</pre><pre><strong>let</strong> searchResponse = <strong>try</strong> decoder.decode(SerchResponse.<strong>self</strong>, from: data)<br>//呼叫decoder的function decode()<br>//要將資料變成什麼型別，由第一個參數決定，所以傳入要轉的型SerchResponse.self，型別本身要是資料需要加.self</pre><pre>print(searchResponse.results[2].trackName)</pre><pre>}<strong>catch</strong>{</pre><pre>print(error)</pre><pre>}</pre><p>5. resume啟動</p><pre>.resume()</pre><p>完整程式碼：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91f38baa9818650e9d1b8e2dd6fa35fd/href">https://medium.com/media/91f38baa9818650e9d1b8e2dd6fa35fd/href</a></iframe><blockquote><strong>Dcard當例子，API 的網址為：</strong></blockquote><p><a href="https://dcard.tw/_api/posts">https://dcard.tw/_api/posts</a></p><p>目前無法直接連到 API 抓資料，若想測試可從 Safari 連到 API 網址，抓取 JSON 後將 JSON 貼到程式裡</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jO60Ngv2n1XTRwBipi0rUA.png" /></figure><p>多行字串JSON 解析，利用三個雙引號的多行字串包含 JSON 資料，然後呼叫 function data(using:) 得到 Data 型別的 JSON 資料，此時得到的資料就像我們利用 URLSessionTask 從網路下載的資料</p><p>****JSON字串變data，而不是從url****</p><pre>let data = &quot;&quot;&quot;</pre><pre>...<br>...<br>...<br></pre><pre>&quot;&quot;&quot;..data(using: .utf8)!</pre><blockquote><strong>第一層資料：</strong></blockquote><p>命名為PostResponse，定義要抓的資料的key、型別格式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*bD08kAeZ3JCNSDqCNrlP2Q.png" /></figure><blockquote><strong>第二層資料：</strong></blockquote><p>MediaMeta為array，命名為Media</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*b6YyRpmLJkohAy8dqBqFUg.png" /></figure><blockquote><strong>解析 JSON 資料的方法（利用 JSONDecoder）</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwtGc0XYp7p0Qmq3DMpJcA.png" /></figure><p>#由於JSON第一層為Array，所以在 decode 時傳入的型別加上 [ ] ，例如上方的[PostResponse]</p><blockquote><strong>執行結果</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVxIwtzlSuIglRp-hCpJnA.png" /><figcaption>postResponse[8].title</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZpgBdAbBCJ3uZygA1TKXw.png" /><figcaption>postResponse[10].title</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95356e02230d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/36-%E4%BD%BF%E7%94%A8-jsondecoder-%E6%8A%8A-json-%E8%BD%89%E6%8F%9B%E6%88%90%E8%87%AA%E8%A8%82%E5%9E%8B%E5%88%A5%E7%9A%84%E8%B3%87%E6%96%99-95356e02230d">#36 使用 JSONDecoder 把 JSON 轉換成自訂型別的資料</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#35 Protocol&Delegate-照片編輯App(2)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/35-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-2-e7ead21e6c0f?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7ead21e6c0f</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 02:44:17 GMT</pubDate>
            <atom:updated>2022-09-06T05:34:58.287Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：模仿 iOS 的照片 App 編輯照片</p><p>分兩篇撰寫</p><p>第二篇：App編輯照片的功能(鏡像翻面、左右翻轉、改變照片比例：1:1、4:3&amp;16:9&amp;大小縮放、更改圖片背景顏色、儲存圖片)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qA2dNDogEwQzcSH4riMr0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*ORsEmIieV_B_13wFLItFQA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*Yg_Dr_UaWPcaLzQqhqd2hw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*TdsIO_UryEIi6TD-Lr2PPQ.gif" /></figure><p>第一篇：選取相簿照片<strong>Protocol&amp;Delegate-UIImagePickerController</strong>、轉跳頁面／傳遞資料</p><p><a href="https://medium.com/@jc051533/34-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-1-64cbab1f79a8">#34 Protocol&amp;Delegate-照片編輯App(1)</a></p><blockquote><strong><em>EditViewController</em></strong></blockquote><p><strong>#App功能</strong></p><ol><li><strong>拉所需的IBOutlet、設定所需的變數</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgyxOT8NXeTns5LOP7TPbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*oSPeQQgasGatKwR8JrIy4w.png" /><figcaption>containerView跟picImageView的關係</figcaption></figure><p><strong>2. viewDidLoad</strong></p><p>先隱藏沒有被點選的項目，設定顯示的圖片比例皆為預設的1：1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*M61_7ifkYMOQlA0oGTYEQA.png" /></figure><p>#iOS SDK 的 frame &amp; bounds</p><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/ios-sdk-%E7%9A%84-frame-bounds-c54a4bfd9603">iOS SDK 的 frame &amp; bounds</a></p><p><strong>3. 選擇改變方向</strong></p><pre><strong>@IBAction</strong> <strong>func</strong> rotate(_ sender: UIButton) {</pre><pre>turnleftButton.isHidden = <strong>false</strong></pre><pre>turnrightButton.isHidden = <strong>false</strong></pre><pre>mirrorButton.isHidden = <strong>false</strong></pre><pre>}</pre><p><strong>4. 方向向左轉</strong></p><pre>//改變照片方向向左轉</pre><pre><strong>@IBAction</strong> <strong>func</strong> leftRotate(_ sender: UIButton) {</pre><pre>turnleftTimes += 1</pre><pre><strong>let</strong> oneDegree = CGFloat.pi / 180</pre><pre>picImageView.transform = CGAffineTransform(rotationAngle: (oneDegree * -90)*CGFloat(turnleftTimes))</pre><pre>}</pre><p><strong>5. 方向向右轉</strong></p><pre>//改變照片方向向右轉</pre><pre><strong>@IBAction</strong> <strong>func</strong> rightRotate(_ sender: UIButton) {</pre><pre>turnrightTimes += 1</pre><pre><strong>let</strong> oneDegree = CGFloat.pi / 180</pre><pre>picImageView.transform = CGAffineTransform(rotationAngle: (oneDegree * 90)*CGFloat(turnrightTimes))</pre><pre>}</pre><p><strong>6. 鏡像轉</strong></p><pre>//改變照片方向鏡像轉</pre><pre><strong>@IBAction</strong> <strong>func</strong> mirrorRotate(_ sender: UIButton) {</pre><pre>mirrorTimes *= -1</pre><pre>picImageView.transform = CGAffineTransform(scaleX: CGFloat(mirrorTimes), y: 1)</pre><pre>}</pre><p><strong>6. 選擇改變照片比例跟大小、改變照片比例、改變照片大小</strong></p><p>(1)選擇改變照片比例跟大小</p><pre>//改變照片比例跟大小</pre><pre><strong>@IBAction</strong> <strong>func</strong> changeScale(_ sender: UIButton) {</pre><pre>sizeSegmentedControl.isHidden = <strong>false</strong></pre><pre>zoominSlider.isHidden = <strong>false</strong></pre><pre>}</pre><p>(2)改變照片比例</p><pre>//改變照片比例</pre><pre><strong>@IBAction</strong> <strong>func</strong> changeScaleDetail(_ sender: <strong>Any</strong>) {</pre><pre><strong>let</strong> length: Int = 350</pre><pre><strong>var</strong> width: Int</pre><pre><strong>var</strong> height: Int</pre><pre>//設定原始顯示圖片比例為1:1</pre><pre><strong>switch</strong> sizeSegmentedControl.selectedSegmentIndex {</pre><pre><strong>case</strong> 0: //1:1</pre><pre>width = length</pre><pre>height = length</pre><pre><strong>case</strong> 1: //4:3</pre><pre>width = length</pre><pre>height = Int(Double(length) / 4 * 3)</pre><pre><strong>case</strong> 2: //16:9</pre><pre>width = length</pre><pre>height = Int(Double(length) / 16 * 9)</pre><pre><strong>default</strong>: //1:1</pre><pre>width = length</pre><pre>height = length</pre><pre>}</pre><pre>picImageView.bounds.size = CGSize(width: width, height: height)</pre><pre>}</pre><p>(3)改變照片大小</p><pre>//改變照片大小</pre><pre><strong>@IBAction</strong> <strong>func</strong> zoominout(_ sender: <strong>Any</strong>) {</pre><pre>picImageView.transform = CGAffineTransform(scaleX: CGFloat(zoominSlider.value), y: CGFloat(zoominSlider.value))</pre><pre>}</pre><p><strong>7. 改變背景顏色Protocol&amp;Delegate-UIColorPickerViewController</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*JmxZ2sB9J9FRGAj2Y7d63w.gif" /></figure><p>#UIColorPickerViewController</p><pre>//改變背景顏色</pre><pre><strong>@IBAction</strong> <strong>func</strong> changeColor(_ sender: <strong>Any</strong>) {</pre><pre><strong>let</strong> controller = UIColorPickerViewController()</pre><pre>controller.delegate = <strong>self</strong></pre><pre>present(controller, animated: <strong>true</strong>, completion: <strong>nil</strong>)</pre><pre>}</pre><pre><strong>func</strong> colorPickerViewController(_ viewController: UIColorPickerViewController, didSelect color: UIColor, continuously: Bool) {</pre><pre>containerView.backgroundColor = color</pre><pre>dismiss(animated: <strong>true</strong>, completion: <strong>nil</strong>)</pre><pre>}</pre><p><strong>8. 儲存照片 UIGraphicsImageRenderer</strong></p><pre>//儲存照片</pre><pre><strong>@IBAction</strong> <strong>func</strong> saveEditedPhoto(_ sender: <strong>Any</strong>) {</pre><pre>//利用UIGraphicsImageRenderer將view變成UIImage</pre><pre><strong>let</strong> renderer = UIGraphicsImageRenderer(size: containerView.bounds.size)</pre><pre>//呼叫image(actions:)產生圖片</pre><pre><strong>let</strong> editimage = renderer.image(actions: { context <strong>in</strong></pre><pre>containerView.drawHierarchy(in: containerView.bounds, afterScreenUpdates: <strong>true</strong>)</pre><pre>})</pre><pre>//利用UIActivityViewController分享圖片</pre><pre><strong>let</strong> activityViewController = UIActivityViewController(activityItems: [editimage], applicationActivities: <strong>nil</strong>)</pre><pre>present(activityViewController, animated: <strong>true</strong>, completion: <strong>nil</strong>)</pre><pre>}</pre><p><strong>#Info 頁面加權限請求的文字</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p5vt4YcBZRdAl4C-GgEs8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xP4HBlnfSccaru_JDFusiA.png" /></figure><p>完整程式碼：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8cd2d7868fd7e86e48af1b8c5c26e41/href">https://medium.com/media/d8cd2d7868fd7e86e48af1b8c5c26e41/href</a></iframe><blockquote><strong>上傳GitHub：</strong></blockquote><p><a href="https://github.com/yoga1006/ImageEdit">GitHub - yoga1006/ImageEdit</a></p><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/95-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AF-app-335ef37cc707">#95 照片編輯 App</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7ead21e6c0f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/35-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-2-e7ead21e6c0f">#35 Protocol&amp;Delegate-照片編輯App(2)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#34 Protocol&Delegate-照片編輯App(1)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/34-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-1-64cbab1f79a8?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/64cbab1f79a8</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 02:43:49 GMT</pubDate>
            <atom:updated>2022-09-06T05:35:09.587Z</atom:updated>
            <content:encoded><![CDATA[<p>練習目的：模仿 iOS 的照片 App 編輯照片</p><p>分兩篇撰寫</p><p>第一篇：選取相簿照片<strong>Protocol&amp;Delegate-UIImagePickerController</strong>、轉跳頁面／傳遞資料</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XflYScMJTS6cLusHjmHjiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*0MHY8zMjnSSZDtvjEOSpyQ.gif" /></figure><p>第二篇：App編輯照片的功能(鏡像翻面、左右翻轉、改變照片比例：1:1、4:3&amp;16:9&amp;大小縮放、更改圖片背景顏色、儲存圖片)</p><p><a href="https://medium.com/@jc051533/35-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-2-e7ead21e6c0f">#35 Protocol&amp;Delegate-照片編輯App(2)</a></p><blockquote><strong>App功能：</strong></blockquote><p>・選取相簿照片<br>・鏡像翻面<br>・左右翻轉<br>・改變照片比例：1:1、4:3、16:9 &amp; 大小縮放<br>・更改圖片背景顏色<br>・儲存圖片</p><blockquote><strong>技術項目：</strong></blockquote><p><strong>Protocol&amp;Delegate</strong></p><p><strong>・UIImagePickerController</strong></p><p><strong>・UIColorPickerViewController</strong></p><p><strong>儲存 view 為 UIImage 圖片</strong>・UIGraphicsImageRenderer</p><p><strong>轉跳頁面／傳遞資料</strong>・IBSegueAction &amp; performSegue</p><p>・storyboard<br>・Swift 基本語法<br>・自訂 view controller 類別<br>・viewDidLoad<br>・IBOutlet &amp; IBAction<br>・UIAlertController</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c7UQ3u8FjB901DqPdp0oDQ.png" /></figure><blockquote><strong><em>1. StartViewController</em></strong></blockquote><p><strong>#Protocol&amp;Delegate-UIImagePickerController選照片</strong></p><p>使用者選照片後，UIImagePickerController 找 delegate (代理人)幫忙，呼叫它的某個 function</p><pre><strong>func</strong> pickImage(){</pre><pre><strong>let</strong> controller = UIImagePickerController()</pre><pre>//指定delegate為view controller(self)</pre><pre>controller.delegate = <strong>self</strong></pre><pre>controller.sourceType = .photoLibrary</pre><pre>present(controller, animated: <strong>true</strong>)</pre><pre>}</pre><p><strong>#遵從protocol UIImagePickerControllerDelegate&amp;UINavigationControllerDelegate</strong></p><p>想成為 UIImagePickerController 的 delegate，必須同時遵從protocol UIImagePickerControllerDelegate &amp;UINavigationControllerDelegate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-p7oS8x99OOGPLOMjWQFQ.png" /></figure><p><strong>#將使用者選到的照片顯示在image view上</strong></p><pre><strong>func</strong> imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : <strong>Any</strong>]) {</pre><pre><strong>let</strong> image = info[.originalImage] <strong>as</strong>? UIImage //as?轉型成UIImage型別</pre><pre>imageView.image = image</pre><pre>dismiss(animated: <strong>true</strong>, completion: <strong>nil</strong>)</pre><pre>}</pre><h3>步驟整理：</h3><ol><li>使用者選照片後，UIImagePickerController 會呼叫 delegate 的imagePickerController(_:didFinishPickingMediaWithInfo:)</li><li>定義 protocol UIImagePickerControllerDelegate的imagePickerController(_:didFinishPickingMediaWithInfo:)</li><li>info 裡有照片</li><li>將使用者選的照片顯示到image view 上</li></ol><p><strong>#設定顯示警告訊息和選單的 UIAlertController</strong></p><pre><strong>@IBAction</strong> <strong>func</strong> addPhoto(_ sender: <strong>Any</strong>) {</pre><pre>//設定視窗顯示的內容及樣式</pre><pre><strong>let</strong> choosecontroller = UIAlertController()</pre><pre>//設定視窗顯示的內容及樣式</pre><pre><strong>let</strong> albumAction = UIAlertAction(title: &quot;Album&quot;, style: .default) { [<strong>self</strong>] albumAction <strong>in</strong></pre><pre><strong>self</strong>.pickImage()</pre><pre>}</pre><pre>choosecontroller.addAction(albumAction)</pre><pre><strong>let</strong> cancelAction = UIAlertAction(title: &quot;Cancel&quot;, style: .cancel, handler: <strong>nil</strong>)</pre><pre>choosecontroller.addAction(cancelAction)</pre><pre>present(choosecontroller, animated: <strong>true</strong>)</pre><pre>}</pre><p><strong>#資料傳遞至下一頁</strong></p><pre>//資料傳遞至下一頁</pre><pre><strong>@IBSegueAction</strong> <strong>func</strong> editPic(_ coder: NSCoder) -&gt; EditViewController? {</pre><pre><strong>let</strong> controller = EditViewController(coder: coder)</pre><pre>controller?.enterPic = imageView</pre><pre><strong>return</strong> controller</pre><pre>}</pre><blockquote><strong><em>2. EditViewController</em></strong></blockquote><p><strong>#接收資料</strong></p><pre><strong>var</strong> enterPic:UIImageView!<br><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>picImageView.image = enterPic.image</pre><pre>}</pre><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/77-%E6%90%AD%E9%85%8D-uiimagepickercontroller-%E9%81%B8%E7%85%A7%E7%89%87-ed2b2423b7a9">#77 搭配 UIImagePickerController 選相簿照片或拍照</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64cbab1f79a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/34-protocol-delegate-%E7%85%A7%E7%89%87%E7%B7%A8%E8%BC%AFapp-1-64cbab1f79a8">#34 Protocol&amp;Delegate-照片編輯App(1)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#33 情歌對唱的聊天室畫面 — cell 的 auto layout]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/33-%E6%83%85%E6%AD%8C%E5%B0%8D%E5%94%B1%E7%9A%84%E8%81%8A%E5%A4%A9%E5%AE%A4%E7%95%AB%E9%9D%A2-cell-%E7%9A%84-auto-layout-910b5c79509b?source=rss-da2b2dd502c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/910b5c79509b</guid>
            <dc:creator><![CDATA[Yoga Chen]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 15:02:54 GMT</pubDate>
            <atom:updated>2022-08-31T15:44:38.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>#33 情歌對唱的聊天室畫面 — cell 的 auto layout</h3><p>練習目的：學習定義 UITableViewDataSource 的相關 function ＆ cell 的 auto layout</p><p>先來看一下成品：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmXdtnFTFXNvu5V19he0JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*vVu2PeU80L76f3w37Dyfbg.gif" /></figure><blockquote><strong><em>技術項目：</em></strong></blockquote><p>・TableViewController &amp; model 型別<br>・Auto Layout(Stack Views)<br>・TableViewCell<br>・data source<br>・Protocol&amp;delegate<br>・MVC架構將檔案分類</p><p>內容<br>・使用多個Custom Cell<br>・模仿聊天泡泡設計<br>・ Custom Cell的Auto Layout設定<br>・建立Lyric Struct存放歌詞內容</p><blockquote><strong>1. 建立所需個分頁Cocoa Touch Class(TableViewController)＆Swift File(Lyric Struct)</strong></blockquote><p><strong>#TableViewController</strong></p><p>不固定數量的表格要用Dynamic Prototypes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*IR9oaZ4d1ynWEDIay9f9Ng.png" /></figure><p><strong>#TableViewCell</strong></p><p>設成自訂類別，新增繼承 UITableViewCell 的類別，分別新增BoyTableViewCell、GirlTableViewCell，將 storyboard裡cell的class也要記得設定成自訂類別，也要將Table View Cell中的ID改名字，後續程式會用到，可用類別名當ID名</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*BFxxWgAbEaqm9-mTx_ejWA.png" /><figcaption>2種TableViewCell</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lSzUUU85XlBZDnCCQwMTew.png" /><figcaption>BoyTableViewCell</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*1Xae3-wovT5dYSbMj2xT7w.png" /><figcaption>ID名：BoyTableViewCell</figcaption></figure><p>#cell的高度調整，讓 cell固定高度</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*2TKL8pYiftPVjYf_xnGFQw.png" /></figure><p>#建立Lyric Struct存放歌手＆歌詞內容</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*ZDwPKvB8-YYghEyKWc-fvw.png" /></figure><blockquote><strong>2. 設定Auto Layout</strong></blockquote><p>#Scrolling Enabled取消勾選</p><p>使用imageView和textView來呈現聊天室畫面，首先要先把textView的Scrolling Enabled取消勾選</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*I0yeUZRZf42k86xUUx7Jcw.png" /><figcaption>取消勾選Scrolling Enabled</figcaption></figure><p>#設定頭像圖片Constraints</p><p>width、height、Aspect Ratio維持比例</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*PQvfdiKsN_154KZ50f725A.png" /><figcaption>imageView的constraint設定</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p62rorT2E0W_vzN8nfmMrA.png" /><figcaption>imageView的constraint設定</figcaption></figure><p>#設定Stack View-頭像與歌詞textview</p><p>使用Horizontal Stack來堆疊頭貼的imageView及顯示訊息的textView，並將stack的Alignment設定為Top，如此一來無論訊息多長，大頭貼都會對齊textView的上方邊線。</p><p>spacing：頭貼的imageView及顯示訊息的textView的距離</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*-Qa4lwhOuQIvV5yhKV_g0Q.png" /></figure><p>***要讓textView長度可以剛剛好包含訊息，因此將trailing設定為 ≥10</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*xt4qpCalNGdtRLyDHW8bNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*-BzfsWPGDiPKuOw4u4O8VA.png" /><figcaption>trailing=10，就算訊息很短textView也會被拉到邊界距離10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*0Z_3980HC1QMjbopxTKuPg.png" /><figcaption>trailing ≥ 10，textView長度剛好可以顯示訊息內容</figcaption></figure><p>***反之，女生的部分，則是leading要設定為≥10</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*bS1qx1LddvR1a4MsiOMjBQ.png" /></figure><blockquote><strong>3. 建立Lyric Struct存放歌手、歌詞內容</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*oVGgHRAHloX2h9Nm__SpAA.png" /></figure><blockquote><strong>4. ChatTableViewController</strong></blockquote><p><strong>#設定對唱歌手跟歌詞內容</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlfONodydHQTtK_YF7r5Sg.png" /></figure><p><strong>#定義 funciton預設將產生一個 section、cell 的數量等於歌詞內容的數量</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2XiA0x0T7U6VKD8j4mcMg.png" /></figure><p><strong>#設定 cell 的內容，得到要顯示的 cell</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4df007c33b4cc61782acca1a20cd37c8/href">https://medium.com/media/4df007c33b4cc61782acca1a20cd37c8/href</a></iframe><blockquote><strong>5. BoyTableViewCell、GirlTableViewCell</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13a9dd920f185ba489ac2d1578711c66/href">https://medium.com/media/13a9dd920f185ba489ac2d1578711c66/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b9139615cfd683fb8fa43a8924571bc/href">https://medium.com/media/7b9139615cfd683fb8fa43a8924571bc/href</a></iframe><blockquote><strong>6. MVC架構分類</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*AvWhv7-sNRK2nG_DX8vPbQ.png" /></figure><blockquote><strong>上傳GitHub：</strong></blockquote><p><a href="https://github.com/yoga1006/ChatBubbleApp">GitHub - yoga1006/ChatBubbleApp</a></p><blockquote><strong>參考文章：</strong></blockquote><p><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/63-%E6%83%85%E6%AD%8C%E5%B0%8D%E5%94%B1%E7%9A%84%E8%81%8A%E5%A4%A9%E5%AE%A4%E7%95%AB%E9%9D%A2-cell-%E7%9A%84-auto-layout-53697c2ad80c">#63 情歌對唱的聊天室畫面 —  cell 的 auto layout</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=910b5c79509b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/33-%E6%83%85%E6%AD%8C%E5%B0%8D%E5%94%B1%E7%9A%84%E8%81%8A%E5%A4%A9%E5%AE%A4%E7%95%AB%E9%9D%A2-cell-%E7%9A%84-auto-layout-910b5c79509b">#33 情歌對唱的聊天室畫面 — cell 的 auto layout</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>