<?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 WeiFang Chou on Medium]]></title>
        <description><![CDATA[Stories by WeiFang Chou on Medium]]></description>
        <link>https://medium.com/@chouweifang?source=rss-3cafb0f6b5db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_QvuMjdVurhP5AF6rQbCuQ@2x.jpeg</url>
            <title>Stories by WeiFang Chou on Medium</title>
            <link>https://medium.com/@chouweifang?source=rss-3cafb0f6b5db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 15:14:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chouweifang/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[拒絕被系統制約！在 SwiftUI 讓 Bottom Sheet 滑進 TabBar「後面」的層次魔法 ✨]]></title>
            <link>https://chouweifang.medium.com/%E6%8B%92%E7%B5%95%E8%A2%AB%E7%B3%BB%E7%B5%B1%E5%88%B6%E7%B4%84-%E5%9C%A8-swiftui-%E8%AE%93-bottom-sheet-%E6%BB%91%E9%80%B2-tabbar-%E5%BE%8C%E9%9D%A2-%E7%9A%84%E5%B1%A4%E6%AC%A1%E9%AD%94%E6%B3%95-b212d404170b?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/b212d404170b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[sheet]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Thu, 23 Apr 2026 03:15:10 GMT</pubDate>
            <atom:updated>2026-04-23T03:23:48.098Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*vl2towgeM2rHB31ImaLCfA.png" /><figcaption>Idea App From: <strong>Flighty</strong> App</figcaption></figure><p><strong>拒絕被系統制約！在 SwiftUI 讓 Bottom Sheet 滑進 TabBar「後面」的層次魔法 ✨</strong> <br><strong>Break the Rules! The Magic of Sliding a Bottom Sheet BEHIND the TabBar in SwiftUI ✨</strong></p><p>最近在研究地圖應用的 UI 交互，發現要在 SwiftUI 實作「永遠不會被關掉的 Bottom Sheet」其實超級簡單！<br>Recently, I’ve been diving into UI interactions for map apps and found out that building a “Bottom Sheet that never closes” in SwiftUI is actually super simple!</p><p>三個關鍵的 Modifier 就能搞定這優雅的 UX： <br>Three key modifiers are all it takes to pull off this elegant UX:</p><p>1️⃣ .sheet(isPresented: .constant(true))</p><p>讓面板常駐。<br>Keeps the panel always visible.</p><p>2️⃣ .presentationDetents([.height(200), .medium, .large])</p><p>設定滑動的吸附高度（完美模擬地圖 App 的三段式）。 <br>Defines the snap points (flawlessly recreating the classic 3-stage map app behavior).</p><p>3️⃣ .interactiveDismissDisabled() <br>這是靈魂所在！鎖死下拉關閉手勢，讓面板永遠釘在地圖上。 <br>The absolute game-changer! It disables the swipe-down-to-close gesture, making sure your sheet stays firmly pinned to the map.</p><p>如果有在做地圖、導覽或需要常駐控制面板的 App，這套組合拳絕對推薦試試！👇<br> Highly recommend this modifier combo if you’re working on maps, navigation, or any app that requires a persistent control panel! 👇</p><pre><br>import SwiftUI<br>import MapKit<br><br>struct ContentView: View {   <br>    var body: some View {<br>        ZStack {<br>            Map()<br>                .sheet(isPresented: .constant(true)) {<br>                    BottomSheetView()<br>                        .interactiveDismissDisabled()<br>                        .presentationDetents([.height(200), .medium, .large])<br>                }<br>        }<br>    }<br>}<br><br>struct BottomSheetView: View {<br>    var body: some View {<br>        TabView {<br>            <br>            Tab(&quot;Phone&quot;, systemImage: &quot;phone.fill&quot;) {<br>                Text(&quot;Phone&quot;)<br>            }<br>            <br>            Tab(&quot;Message&quot;, systemImage: &quot;message.fill&quot;) {<br>                Text(&quot;Message&quot;)<br>            }<br>            <br>            Tab(&quot;Person&quot;, systemImage: &quot;person.fill&quot;) {<br>                Text(&quot;Test&quot;)<br>            }<br>            <br>            Tab(&quot;Search&quot;, systemImage: &quot;magnifyingglass&quot;, role: .search) {<br>                Text(&quot;Search&quot;)<br>            }<br>        }<br>    }<br>}<br><br>#Preview {<br>    ContentView()<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*oA3Dm2Kw66Da2LKej5n6OQ.png" /><figcaption>Result ScreenShot</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b212d404170b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[別再被 SwiftUI 騙了：為什麼 .preferredColorScheme 不會全域生效？]]></title>
            <link>https://chouweifang.medium.com/swiftui-appearance-%E5%9D%91-ca8f06102e2a?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca8f06102e2a</guid>
            <category><![CDATA[themes]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[appearances]]></category>
            <category><![CDATA[color-scheme]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Fri, 07 Nov 2025 10:47:28 GMT</pubDate>
            <atom:updated>2025-11-07T11:01:07.189Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>別再被 SwiftUI 騙了：為什麼 .preferredColorScheme 不會全域生效？</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R93cTKjIbsXkpwIQN8mcMA.png" /><figcaption>SwiftUI colorScheme</figcaption></figure><p>在SwiftUI 有兩種方式 可以調整App 主題：</p><ol><li>preferredColorScheme</li><li>overrideUserInterfaceStyle</li></ol><p>第一種是SwiftUI的Method<br>Link: <a href="https://developer.apple.com/documentation/swiftui/view/preferredcolorscheme(_:)">Apple Document</a></p><p>這種方式可以透過</p><pre>@Environment(\.colorScheme) private var colorScheme</pre><pre>struct ContentView: View {<br>    @State private var colorScheme: ColorScheme? = nil<br><br>    var body: some View {<br>        VStack {<br>            Text(&quot;Hello SwiftUI&quot;)<br>                .padding()<br>            Button(&quot;切換外觀&quot;) {<br>                colorScheme = (colorScheme == .dark) ? .light : .dark<br>            }<br>        }<br>        .preferredColorScheme(colorScheme)<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HNjHn9l6aqZbveKKibo4Ag.png" /></figure><p>如果你發現怎麼使用.preferredColorScheme() 前景的Sheet 都不會變，直接使用overrideUserInterfaceStyle 😂</p><p>第二種是使用UIKit的Method</p><p>Link: <a href="https://developer.apple.com/documentation/uikit/uiview/overrideuserinterfacestyle">Apple Document</a></p><pre>import UIKit<br>import SwiftUI<br><br>final class AppearanceManager {<br>    static let shared = AppearanceManager()<br><br>    var currentAppearance: AppearanceMode = .system {<br>        didSet { applyColorScheme() }<br>    }<br><br>    private var keyWindow: UIWindow? {<br>        guard let scene = UIApplication.shared.connectedScenes.first,<br>              let windowSceneDelegate = scene.delegate as? UIWindowSceneDelegate,<br>              let window = windowSceneDelegate.window else {<br>            return nil<br>        }<br>        return window<br>    }<br><br>    private func applyColorScheme() {<br>        guard let window = keyWindow else { return }<br>        let style = UIUserInterfaceStyle(rawValue: currentAppearance.id) ?? .unspecified<br>        window.overrideUserInterfaceStyle = style<br>    }<br>}<br><br>enum AppearanceMode: Int, CaseIterable, Identifiable {<br>    case system = 0<br>    case light = 1<br>    case dark = 2<br><br>    var id: Int { rawValue }<br><br>    var title: String {<br>        switch self {<br>        case .system: return &quot;系統&quot;<br>        case .light: return &quot;淺色&quot;<br>        case .dark: return &quot;深色&quot;<br>        }<br>    }<br><br>    var colorScheme: ColorScheme? {<br>        switch self {<br>        case .system: return nil<br>        case .light: return .light<br>        case .dark: return .dark<br>        }<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca8f06102e2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[可不可以訂飲料APP ｜ Part 2 APP設計、成品]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E5%8F%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E8%A8%82%E9%A3%B2%E6%96%99app-part-2-app%E8%A8%AD%E8%A8%88-%E6%88%90%E5%93%81-12adb3732c1b?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/12adb3732c1b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[uikit]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Wed, 23 Nov 2022 16:50:44 GMT</pubDate>
            <atom:updated>2022-12-12T14:33:04.028Z</atom:updated>
            <content:encoded><![CDATA[<p>前期提要：</p><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><p>這次APP主要透過自己架設的Server Side 的 Swift 框架—Vapor，並搭Postgresql資料庫作為資料存放。</p><p>後端框架參考：</p><p><a href="https://www.appcoda.com.tw/vapor-4-introduction/">Vapor 4 初探：實作一個待辦事項 App 了解這個 Swift 框架</a></p><p>未來新增功能：</p><p>新增訂單運送狀態以及Widget</p><p>API 取得飲料菜單：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOSo3E6TCRrUI_EYDtG8dQ.png" /></figure><p>API建立訂單：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wIWymmvuLVX1mOL4t9x5g.png" /></figure><p>API更新訂單：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kF7Ft15XAyd9Y0cmmIdSQ.png" /></figure><p>API取得訂單：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPkmeI5_0zrsfGOhFd2A9g.png" /></figure><p>API刪除訂單：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZom0MueIKKNrJ1buREGPA.png" /></figure><p>菜單頁面：<br>透過sections分類飲料類別、rows分類飲料，並透過圖示表示是否限定熱飲、限定冰品、含有咖啡因、推薦項目、新品。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlZbzVISGfDMrTjr4lj4pQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8_GfWGBlwmXmI_lGYeY5w.png" /></figure><p>訂飲料頁面：<br>透過UIPickerView分類地區，並顯示於下方TableView。</p><p><strong><em>未來會新增透過使用者位置自動選取地區。</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z3ipuA0z_6sEtYvHhOHm2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADzDk6ezeYtXIurb3dzF_g.png" /></figure><p>商店位置頁面：<br>透過UICollectionView分類地區，點擊Cell會偵測是否可以開啟Google Maps和Apple Maps。</p><p><strong><em>未來會讓使用者能自行選擇要開啟的地圖、以及使用使用者位置抓取最近店家。</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wBz7eYlpXNSDeCrnnnBWVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMU4SsYd-4Osa7zi5wOywg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eoZ6ZJYdpNEKXZ29t4rfFg.png" /></figure><p>歷史訂單頁面：<br>紀錄著使用者訂購過的訂單，若無資料則顯示No Data Found圖示。</p><p><strong><em>未來會增加讓使用者能將複製訂單功能。</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PnJOZQ8qNng14swMyGLnvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JLOFV4XmvVBtT9Wdk1L43g.png" /></figure><p>成果：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*DWWipCX2D960ktXrnH4hYg.gif" /></figure><p>Github:</p><p><a href="https://github.com/WeiFangChou/DrinkApp">GitHub - WeiFangChou/DrinkApp: Drink Order App</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12adb3732c1b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E5%8F%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E8%A8%82%E9%A3%B2%E6%96%99app-part-2-app%E8%A8%AD%E8%A8%88-%E6%88%90%E5%93%81-12adb3732c1b">可不可以訂飲料APP ｜ Part 2 APP設計、成品</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[可不可以訂飲料APP ｜ Part 1 資料處理、後端設計]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E5%8F%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E8%A8%82%E9%A3%B2%E6%96%99app-part-1-%E8%B3%87%E6%96%99%E8%99%95%E7%90%86-%E5%BE%8C%E7%AB%AF%E8%A8%AD%E8%A8%88-f56cc3b689a6?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/f56cc3b689a6</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[drinks]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 17:59:09 GMT</pubDate>
            <atom:updated>2022-11-23T14:20:48.340Z</atom:updated>
            <content:encoded><![CDATA[<p>前期提要：</p><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><p>這次使用Vapor 框架作為API Server實現Restful ，Vapor搭配PostgreSQL資料庫作為後端，也可以把學到的Swift程式語言一起應用。</p><p>參考：</p><p><a href="https://www.appcoda.com.tw/vapor-4-introduction/">Vapor 4 初探：實作一個待辦事項 App 了解這個 Swift 框架</a></p><p>飲料菜單在資料庫，儲存飲品名稱、價格、是否能做冷熱飲以及是否為推薦或新品，像是部分飲品限定冷飲、部分飲品限定大杯或者是否有含咖啡因。並將飲品菜單資料庫以及訂購紀錄資料庫透過Router指向URL</p><p>飲品菜單Router：</p><p>GET /get/milkshamenu</p><p>取得訂單資料</p><p>訂購紀錄Router：</p><p>GET： /order/orderUUID</p><p>取得單筆訂購資料</p><p>POST：/order</p><p>新建一筆新訂單</p><p>PUT：/order/orderUUID</p><p>修改一筆訂單資料</p><p>DELETE：/order/orderUUID</p><p>刪除訂單</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*FcP29OQNbXiJseH5gH5tRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-58cv1V2u2dKsuNhqgHFw.png" /></figure><p>將資料庫欄位宣告為Model</p><p>飲品菜單Model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4Z99PCyxZJwgcn2D_n3MA.png" /></figure><p>訂購紀錄Model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HeWRDRQR5uO_ey3RjMkaA.png" /></figure><p>訂單紀錄Restful 之Router</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3QZFSaKcch8NZ5kgH9_eg.png" /></figure><p>將URL輸入至瀏覽器，即可看到Json格式檔案</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u35G8cyFIxizGWyOuXq0Dw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyFe-p6T_VqbTQ0A_bi6Wg.png" /></figure><p>訂單紀錄在資料庫，詳細紀錄－配送編號、飲品、店名以及店址，未來還會再新增尚未新增項目。</p><p>成果：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vx46uUVZimR8mNUBJCXTQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f56cc3b689a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E5%8F%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E8%A8%82%E9%A3%B2%E6%96%99app-part-1-%E8%B3%87%E6%96%99%E8%99%95%E7%90%86-%E5%BE%8C%E7%AB%AF%E8%A8%AD%E8%A8%88-f56cc3b689a6">可不可以訂飲料APP ｜ Part 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[Swift UIKit iOS App 入門測驗]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/swift-uikit-ios-app-%E5%85%A5%E9%96%80%E6%B8%AC%E9%A9%97-1-c237749e462b?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/c237749e462b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Sun, 04 Sep 2022 16:13:58 GMT</pubDate>
            <atom:updated>2022-09-23T00:13:25.031Z</atom:updated>
            <content:encoded><![CDATA[<p>#期中測驗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJJnd27DUcCxXSYBkuwBDA.png" /></figure><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/swift-uikit-ios-app-%E5%85%A5%E9%96%80%E6%B8%AC%E9%A9%97-1-5164b7318d40">Swift UIKit iOS App 入門測驗 1</a></p><p><em>不查資料地從無到有製作選擇題 App，包含以下功能。</em></p><ul><li><em>製作選擇題 App，每題有四個選項。</em></li><li><em>答對一題加 10 分 。</em></li><li><em>畫面上顯示目前題目是第幾題。</em></li><li><em>自訂選擇題的資料型別。</em></li><li><em>題庫有 n 題，隨機出其中的 10 題，每次玩的時候題目順序都不一樣。( n &gt; 10 )</em></li><li><em>包含多個頁面，至少有問題頁面和分數頁面。</em></li><li><em>利用 IBSegueAction &amp; performSegue 將結果從問題頁傳到分數頁。</em></li><li><em>使用 UIAlertController 顯示 alert。</em></li></ul><h3>技術考核項目</h3><ul><li>storyboard。</li><li>Swift 基本語法。</li><li>自訂 view controller 類別 &amp; model 型別。</li><li>viewDidLoad。</li><li>IBOutlet &amp; IBAction。</li><li>IBSegueAction &amp; performSegue。</li><li>UIAlertController。</li><li>可考慮使用的特別語法: enum，computed property，property observer</li></ul><p>Storyboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WD-36VlNBCuAwNKRTgU8Bw.png" /></figure><p>串接API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qs-tdFUPVPq0KhSpIo26ww.png" /></figure><p>Json解析</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*-x5-hH802wREelPCvgqDxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEu7DQUB-B0GPO_WCXZkhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akUgLUf4YCrkg9BS5vVVKg.gif" /></figure><p>Github:</p><p><a href="https://github.com/WeiFangChou/MidExamApp">GitHub - WeiFangChou/MidExamApp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c237749e462b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/swift-uikit-ios-app-%E5%85%A5%E9%96%80%E6%B8%AC%E9%A9%97-1-c237749e462b">Swift UIKit iOS App 入門測驗</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[利用 Date Picker 計算生命靈數]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E5%88%A9%E7%94%A8-date-picker-%E8%A8%88%E7%AE%97%E7%94%9F%E5%91%BD%E9%9D%88%E6%95%B8-7cac53edbaaa?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cac53edbaaa</guid>
            <category><![CDATA[birthday]]></category>
            <category><![CDATA[lifenumber]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Tue, 02 Aug 2022 12:32:05 GMT</pubDate>
            <atom:updated>2022-08-03T12:16:14.226Z</atom:updated>
            <content:encoded><![CDATA[<p>HW8–16</p><p>前期提要：</p><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/23-%E5%88%A9%E7%94%A8-date-picker-%E8%A8%88%E7%AE%97%E7%94%9F%E5%91%BD%E9%9D%88%E6%95%B8-d466f9b9025d">#23 利用 Date Picker 計算生命靈數</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G0OEx639IVuAvw9V" /><figcaption>Photo by <a href="https://unsplash.com/@simonmaage?utm_source=medium&amp;utm_medium=referral">Simon Maage</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Z9P476A2m-zOp4hNlP8Rw.png" /><figcaption>Storyboard 設計</figcaption></figure><p>首先，先建立兩個自訂的ViewController（BirthdayViewController、ResultViewController）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*8U0s1glvSxxKRHF_ZWEW2Q.png" /></figure><p>拉DatePicker日期選擇器、顯示GIF的ImageView</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*NJvdWeLY1meyffMAzl0Qmw.png" /></figure><p>接著在viewDidLoad，建立會動的 UIImage搭配Assets圖片顯示</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXKnz-Lr5DjdQKmcMxISDw.png" /></figure><p>UIImage會自動幫我們建立好陣列，讓圖片能照著數字輪播</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*DxQLJH6yQJCbC7fU30gxZw.png" /></figure><p>接著按住按鈕並拉到ResultViewController，此時只會有SegueAction選項</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o79N6XpSSaG9-yx77DhCPA.png" /></figure><p>透過SegueAction的方式將datePicker.date傳到ResultViewController</p><pre>let controller = ResultViewController(coder: coder)</pre><pre>controller?.birthday = datePicker.date</pre><pre>return controller</pre><p>宣告星座以及生命數字</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gAuD5_JTI-L-L8DZ3vWD0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeUrzAGepANLBNM3_J0ubQ.png" /></figure><p>更新UI（修改Label以及圖片）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJiDTuyjtce_6k5knF4KRw.png" /></figure><p>帶入月、日，回傳StarSign星座結構</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ryJt-I573JSzTG0w6d4-w.png" /></figure><p>將年月日轉成字串，並相加</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ad2k8bu1QNmR48_tUiLBxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kjCtK9nPovdxAFWEUGUSpQ.gif" /></figure><p>Github：</p><p><a href="https://github.com/WeiFangChou/Homework8-12">GitHub - WeiFangChou/Homework8-12</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cac53edbaaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E5%88%A9%E7%94%A8-date-picker-%E8%A8%88%E7%AE%97%E7%94%9F%E5%91%BD%E9%9D%88%E6%95%B8-7cac53edbaaa">利用 Date Picker 計算生命靈數</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[利用 AVSpeechSynthesizer 講話]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E5%88%A9%E7%94%A8-avspeechsynthesizer-%E8%AC%9B%E8%A9%B1-adbe5391e86d?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/adbe5391e86d</guid>
            <category><![CDATA[avfoundation]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[apps]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Sun, 24 Jul 2022 17:38:58 GMT</pubDate>
            <atom:updated>2022-07-25T08:19:29.672Z</atom:updated>
            <content:encoded><![CDATA[<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%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E8%AE%93%E9%96%8B%E4%B8%8D%E4%BA%86%E5%8F%A3%E7%9A%84-app-%E9%96%8B%E5%8F%A3%E8%AA%AA%E8%A9%B1-48c674f8f69e">讓開不了口的 App 開口說話 !</a></p><h4>利用 AVSpeechSynthesizer 講話</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZY7Hze5cwJP5CjxyG1zubQ.png" /></figure><p>首先要import 才能使用AVSpeechSynthesizer這個函示庫</p><pre>import AVFoundation</pre><p>再來把元件連結Storyboard</p><pre>@IBOutlet weak var speakTextfield: UITextField!</pre><pre>@IBOutlet weak var speakSpeed: UISlider!</pre><pre>@IBOutlet weak var speakRate: UISlider!</pre><pre>@IBOutlet weak var speakHistoryTableView: UITableView!</pre><pre>@IBOutlet weak var speakPlayButton: UIButton!</pre><p>因為有加入歷史資料功能，所以有UITableView。</p><p>宣告變數（兩個內建語音合聲器與發聲器以及預設歷史資料）</p><pre>var speakUtterance = AVSpeechUtterance()</pre><pre>var speakSynthesizer = AVSpeechSynthesizer()</pre><pre>var speakHistory : [SpeakHistory] = [SpeakHistory(speakText: &quot;I Love Swift&quot;, speakRate: 1.0, speakSpeed: 1.0)]</pre><p>我們在viewDidLoad畫面跑完的時候修改預設值，並委託TableView的delegate以及dataSource和AVSpeechSynthesizer的delegate給ViewController</p><pre>speakRate.minimumValue = 0.5</pre><pre>speakRate.maximumValue = 2.0</pre><pre>speakRate.value = 1.0</pre><pre>// [0.5 - 2] Default = 1</pre><pre>speakSpeed.minimumValue = 0.0</pre><pre>speakSpeed.maximumValue = 1.0</pre><pre>speakSpeed.value = 1.0</pre><pre>// [0-1] Default = 1</pre><pre>self.speakHistoryTableView.delegate = self</pre><pre>self.speakHistoryTableView.dataSource = self</pre><pre>self.speakSynthesizer.delegate = self</pre><p>建立語音的類別</p><pre>class SpeakHistory{</pre><pre>var speakText: String</pre><pre>var speakRate: Float</pre><pre>var speakSpeed: Float</pre><pre>init(speakText: String, speakRate: Float, speakSpeed: Float) {</pre><pre>self.speakText = speakText</pre><pre>self.speakRate = speakRate</pre><pre>self.speakSpeed = speakSpeed</pre><pre>}</pre><pre>}</pre><blockquote>Xcode 14的新功能不用打init直接幫我們建立好，真的很棒！！</blockquote><p>播放程式碼：</p><pre>if(speakSynthesizer.isPaused){</pre><pre>speakSynthesizer.continueSpeaking()</pre><pre>}else if(speakSynthesizer.isSpeaking){</pre><pre>speakSynthesizer.pauseSpeaking(at: AVSpeechBoundary.immediate)</pre><pre>}else{</pre><pre>if let speakText = speakTextfield.text, !speakText.isEmpty{</pre><pre>speakUtterance = AVSpeechUtterance(string: speakText)</pre><pre>speakUtterance.pitchMultiplier = speakRate.value</pre><pre>speakUtterance.rate = speakRate.value</pre><pre>speakUtterance.voice = AVSpeechSynthesisVoice(language: &quot;zh-TW&quot;)</pre><pre>speakSynthesizer.speak(speakUtterance)</pre><pre>speakHistory.insert(SpeakHistory(speakText: speakText, speakRate: speakRate.value, speakSpeed: speakSpeed.value),at: 0)</pre><pre>speakHistoryTableView.reloadData()</pre><pre>}</pre><pre>}</pre><p>這裡有判斷speakSynthesizer是否為暫停、播放中，沒有的話就播放新內容，並且抓Slider的Value（包含語速及語調），當speakSynthesizer播放就新增一筆資料在TableView的頂端使用</p><p>陣列.insert(你的資料,at: 陣列的第幾個位置)</p><pre>speakHistory.insert(SpeakHistory(speakText: speakText, speakRate: speakRate.value, speakSpeed: speakSpeed.value),at: 0)</pre><p>TableView 回傳有幾個Cell，我們回傳陣列的數量</p><pre>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {</pre><pre>return  speakHistory.count</pre><pre>}</pre><p>TableView的資料處理，把speakHistory[第幾筆資料]帶進去cell</p><pre>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {</pre><pre>guard let cell = speakHistoryTableView.dequeueReusableCell(withIdentifier: &quot;speakHistoryCell&quot;, for: indexPath) as? SpeakTableViewCell else {</pre><pre>return UITableViewCell()</pre><pre>}</pre><pre>cell.speakText.text = speakHistory[indexPath.row].speakText</pre><pre>cell.speakRate.text = &quot;\(speakHistory[indexPath.row].speakRate)&quot;</pre><pre>cell.speakSpeed.text = &quot;\(speakHistory[indexPath.row].speakSpeed)&quot;</pre><pre>print(&quot;init cell&quot;)</pre><pre>return cell</pre><pre>}</pre><p>如果點擊Cell，資料會帶入Slider以及Textfield</p><pre>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {</pre><pre>let speak = speakHistory[indexPath.row]</pre><pre>speakTextfield.text = speak.speakText</pre><pre>speakRate.value = speak.speakRate</pre><pre>speakSpeed.value = speak.speakSpeed</pre><pre>}</pre><p>如果向左滑，並點擊刪除</p><pre>func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {</pre><pre>if(editingStyle == .delete){</pre><pre>speakHistory.remove(at: indexPath.row)</pre><pre>speakHistoryTableView.reloadData()</pre><pre>}</pre><pre>}</pre><p>輸入AVSpeechSynthesizerDelegate並點選Jump to Definition</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*b_FbqHsEar7CEWgHpojgdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-hfXiVV9xAxxTwyn33L_Lw.png" /></figure><p>或者在 官網文件找到 AVSpeechSynthesizerDelegate</p><p><a href="https://developer.apple.com/documentation/avfaudio/avspeechsynthesizerdelegate">Apple Developer Documentation</a></p><p>在這裡我們可以看到AVSpeechSynthesizer 開放的Protocol，我們就可以委託ViewController 幫我們監聽 speechSynthesizer的delegate</p><pre>self.speakSynthesizer.delegate = self</pre><p>透過委託的方式幫我們更改播放按鈕的Title</p><p>delegate程式碼</p><pre>func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didFinish utterance: AVSpeechUtterance) {</pre><pre>self.speakPlayButton.setTitle(&quot;播放&quot;, for: .normal)</pre><pre>}</pre><pre>func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didStart utterance: AVSpeechUtterance) {</pre><pre>self.speakPlayButton.setTitle(&quot;暫停&quot;, for: .normal)</pre><pre>}</pre><pre>func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didPause utterance: AVSpeechUtterance) {</pre><pre>self.speakPlayButton.setTitle(&quot;繼續播放&quot;, for: .normal)</pre><pre>}</pre><pre>func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didContinue utterance: AVSpeechUtterance) {</pre><pre>self.speakPlayButton.setTitle(&quot;暫停&quot;, for: .normal)</pre><pre>}</pre><p>Github:</p><p><a href="https://github.com/WeiFangChou/Homework6-8">GitHub - WeiFangChou/Homework6-8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adbe5391e86d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E5%88%A9%E7%94%A8-avspeechsynthesizer-%E8%AC%9B%E8%A9%B1-adbe5391e86d">利用 AVSpeechSynthesizer 講話</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[用Storyboard模仿天氣 App 畫面]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E7%94%A8storyboard%E6%A8%A1%E4%BB%BF%E5%A4%A9%E6%B0%A3-app-%E7%95%AB%E9%9D%A2-747520ccf9a2?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/747520ccf9a2</guid>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Sun, 24 Jul 2022 13:47:37 GMT</pubDate>
            <atom:updated>2022-07-25T08:24:06.685Z</atom:updated>
            <content:encoded><![CDATA[<p>HW2–2</p><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/instagram-app-%E6%A8%A1%E4%BB%BF-%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-ios-app-%E4%BD%9C%E6%A5%AD-f1b2d10019f0">模仿一頁精美的 App 畫面 (可將其它作業要求的各種 UI 加到此作業，比方陰影效果，點選文字顯示網頁等)</a></p><p>作業目的: 學習使用 storyboard 設計 App 畫面。</p><p>此作業使用：</p><p>UITableViewController排序多個重複地點以及天氣<br>UIViewTable的Header View<br>UIStackView排序多個重複View<br>UIProgressView溫度的範圍<br>UIVisualEffectView詳細資料的背景<br>UIScrollView滑動多個View<br>UILabel 顯示溫度、地區以及其他天氣資訊<br>UINavigationController</p><p>此作業使用Storyboard做出畫面，所以有些畫面沒有做到很詳細，因為有些必須用程式碼才能做出的畫面，所以此模仿App只能做出類似的畫面。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zo_UH4LrbSE-9ZU6CqOJYw.gif" /></figure><p>Github:</p><p><a href="https://github.com/WeiFangChou/Homework2-2">GitHub - WeiFangChou/Homework2-2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=747520ccf9a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E7%94%A8storyboard%E6%A8%A1%E4%BB%BF%E5%A4%A9%E6%B0%A3-app-%E7%95%AB%E9%9D%A2-747520ccf9a2">用Storyboard模仿天氣 App 畫面</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[模擬Apple Store Airpods刻字功能]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E6%A8%A1%E6%93%ACapple-store-airpods%E5%88%BB%E5%AD%97%E5%8A%9F%E8%83%BD-4bbd3bcd916e?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bbd3bcd916e</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[airpods]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 23:00:05 GMT</pubDate>
            <atom:updated>2022-07-22T11:54:06.630Z</atom:updated>
            <content:encoded><![CDATA[<p>HW6–7</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zMfTWUuAfYnO2xLQ" /><figcaption>Photo by <a href="https://unsplash.com/@dagny_2020?utm_source=medium&amp;utm_medium=referral">Dagny Reese</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>前期提要：</h4><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/%E4%BD%9C%E6%A5%AD-28-apple-store%E7%9A%84airpods-pro-%E5%88%BB%E5%AD%97-4d2aa1a1b680">作業#28 Apple Store的AirPods Pro 刻字</a></p><h4>功能：</h4><ol><li>輸入至TextField即時顯示文字在圖上</li><li>超過字數，跳通知提示</li><li>若超過字數將移除最後一個文字</li></ol><h4>程式碼：</h4><pre>if let text = sender.text{</pre><pre>if(text.count &gt; 10){</pre><pre>let alertController = UIAlertController(title: &quot;警告&quot;, message: &quot;你的文字超過10個字了！&quot;, preferredStyle:.alert)</pre><pre>let cancelAction = UIAlertAction(title: &quot;OK&quot;, style: .cancel)</pre><pre>alertController.addAction(cancelAction)</pre><pre>self.present(alertController, animated: true)</pre><pre>sender.text?.removeLast()</pre><pre>}else{</pre><pre>label.text = &quot;\(text)&quot;<br>}</pre><pre>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BsZPwRYnmr2ehmAvwWKLuw.gif" /></figure><p>Github：</p><p><a href="https://github.com/WeiFangChou/Homework6-7">GitHub - WeiFangChou/Homework6-7</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bbd3bcd916e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E6%A8%A1%E6%93%ACapple-store-airpods%E5%88%BB%E5%AD%97%E5%8A%9F%E8%83%BD-4bbd3bcd916e">模擬Apple Store Airpods刻字功能</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[調色App — 利用UIColor調整背景顏色]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E8%AA%BF%E8%89%B2app-%E5%88%A9%E7%94%A8uicolor%E8%AA%BF%E6%95%B4%E8%83%8C%E6%99%AF%E9%A1%8F%E8%89%B2-8a77eb6adcae?source=rss-3cafb0f6b5db------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a77eb6adcae</guid>
            <category><![CDATA[pokémon]]></category>
            <category><![CDATA[uicolor]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[uiimage]]></category>
            <category><![CDATA[apps]]></category>
            <dc:creator><![CDATA[WeiFang Chou]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 22:59:31 GMT</pubDate>
            <atom:updated>2022-07-22T11:51:13.879Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>調色App — 利用UIColor調整背景顏色</strong></h3><p>HW6–6</p><p>前情提要：</p><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/%E8%AA%BF%E8%89%B2%E5%A4%A7%E5%B8%AB-swift-ios-app-%E4%BD%9C%E6%A5%AD-a8ab4d968034">#13 調色大師</a></p><p>透過App可以操作Slider調整背景的Ｒ、Ｇ、Ｂ三種顏色，並搭配陣列讓圖片可以有效率地排列組合，</p><p>使用哪些UIKit：</p><blockquote>UISlider、UIColor、UISwipeGestureRecognizer、UIPageControl、UISegmentedControl、UIStepper</blockquote><p>功能：</p><ol><li>利用Slider調整UIImage背景顏色</li><li>利用Slider調整UIColor的RGB值</li><li>利用UIGesturerecognizer手勢滑動圖片</li><li>利用滑動圖片改變UIPageControl</li><li>利用UIButton重置Slider預設值</li><li>利用UIStepper調整照片以及其他元件Value</li><li>利用UISegmentedControl調整照片以及其他元件Value</li></ol><p>Slider程式碼</p><pre>image.backgroundColor = UIColor(</pre><pre>red: CGFloat(redSlider.value / 255),</pre><pre>green: CGFloat(greenSlider.value / 255),</pre><pre>blue: CGFloat(blueSlider.value / 255),</pre><pre>alpha: CGFloat(alphaSlider.value / 255)</pre><pre>)</pre><p>UIButton程式碼</p><pre>redSlider.value = 0</pre><pre>greenSlider.value = 0</pre><pre>blueSlider.value = 0</pre><pre>alphaSlider.value = 255</pre><pre>image.backgroundColor = UIColor(</pre><pre>red: CGFloat(redSlider.value / 255),</pre><pre>green: CGFloat(greenSlider.value / 255),</pre><pre>blue: CGFloat(blueSlider.value / 255),</pre><pre>alpha: CGFloat(alphaSlider.value / 255)</pre><pre>)</pre><p>UISwipeGestureRecognizer程式碼</p><pre>if(sender.direction == .left){</pre><pre>index += 1</pre><pre>}else if (sender.direction == .right){</pre><pre>index -= 1</pre><pre>}</pre><pre>if(index == images.count){</pre><pre>index = 0</pre><pre>}else if(index &lt; 0){</pre><pre>index = images.count - 1</pre><pre>}</pre><pre>image.image = UIImage(named: images[index])</pre><pre>pageControl.currentPage = index</pre><pre>segment.selectedSegmentIndex = index</pre><pre>stepper.value = Double(index)</pre><p>UIPageControl 程式碼</p><pre>index = sender.currentPage</pre><pre>image.image = UIImage(named: images[index])</pre><pre>stepper.value = Double(index)</pre><pre>segment.selectedSegmentIndex = index</pre><p>UISegmentControl程式碼</p><pre>index = sender.selectedSegmentIndex</pre><pre>image.image = UIImage(named: images[index])</pre><pre>pageControl.currentPage = index</pre><pre>stepper.value = Double(index)</pre><p>UIStepper程式碼</p><pre>index = Int(stepper.value)</pre><pre>image.image = UIImage(named: images[index])</pre><pre>pageControl.currentPage = index</pre><pre>segment.selectedSegmentIndex = index</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWB8wr1svis-hdY5n5sAdg.gif" /></figure><p><a href="https://github.com/WeiFangChou/Homework6-6">GitHub - WeiFangChou/Homework6-6: UIColor RGB Homework</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a77eb6adcae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E8%AA%BF%E8%89%B2app-%E5%88%A9%E7%94%A8uicolor%E8%AA%BF%E6%95%B4%E8%83%8C%E6%99%AF%E9%A1%8F%E8%89%B2-8a77eb6adcae">調色App — 利用UIColor調整背景顏色</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>