<?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 ViviLee on Medium]]></title>
        <description><![CDATA[Stories by ViviLee on Medium]]></description>
        <link>https://medium.com/@vivivvvvv?source=rss-94f1989b25f0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*waSGI_v67i8XntPlIlJWMg.jpeg</url>
            <title>Stories by ViviLee on Medium</title>
            <link>https://medium.com/@vivivvvvv?source=rss-94f1989b25f0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 10:27:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vivivvvvv/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[[PMP專案管理 PMBOK GUIDE 專案管理知識體系指南 第六版]第一～三章 讀書筆記]]></title>
            <link>https://vivivvvvv.medium.com/pmp%E5%B0%88%E6%A1%88%E7%AE%A1%E7%90%86-pmbok-guide-%E5%B0%88%E6%A1%88%E7%AE%A1%E7%90%86%E7%9F%A5%E8%AD%98%E9%AB%94%E7%B3%BB%E6%8C%87%E5%8D%97-%E7%AC%AC%E5%85%AD%E7%89%88-%E7%AC%AC%E4%B8%80-%E4%B8%89%E7%AB%A0-%E8%AE%80%E6%9B%B8%E7%AD%86%E8%A8%98-76eb13379ed2?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/76eb13379ed2</guid>
            <category><![CDATA[pmp]]></category>
            <category><![CDATA[專案管理]]></category>
            <category><![CDATA[pmbok]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[讀書筆記]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Tue, 11 Oct 2022 14:25:19 GMT</pubDate>
            <atom:updated>2022-10-11T14:26:40.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*Hkio4wLMSoD4RCq6W2zRrQ.jpeg" /></figure><p>此為PMI國際專案管理學會整理的專案管理理論集合，買了第六版一年左右一直沒看，這個月連假開始翻閱它，共分為13章，邊看邊筆記。</p><h3>第一章 引言</h3><p>專案成果：領導者與專案經理於工作中應用專案管理實務、原則、過程、工作，以及技術的成果。</p><p><strong>專案 Project：</strong>為了創造獨特的產品、服務或成果所做的暫時性努力。</p><p><strong>專案集 Program：</strong>一組相互關聯且被協調管理的專案、子專案集及專案集活動，以獲取在個別管理時無法獲得的效益。</p><p><strong>專案組合 Portfolio：</strong>將專案、專案集、子專案組合，以及營運視為一個群組來管理以達策略目標。</p><p><strong>專案生命週期 Project and Development Life Cycles</strong> 又可稱為開發生命週期，分為以下：</p><ul><li><strong>預測式生命週期 Predictive life cycle</strong>：初期就決定好專案的範疇、時間及成本，且任何變更都需被仔細管理，又稱為瀑布式 Waterfall 生命週期。</li><li><strong>迭代式生命週期 Iterative life cycle</strong>：初期就決定範疇，但時間與成本會隨專案團隊對於產品理解的增加而定期修正。迭代指的是透過一系列重複循環的週期來開發產品，而增量 Increments則是指持續逐步增加產品的功能性。</li><li><strong>增量式生命週期 Incremental life cycle</strong>：透過一系列迭代產生可交付成果，並在預定的時間軸內逐步增加功能性。只有在最終迭代可交付成果具備必要與充足能力，才可被視為完成。</li><li><strong>調適性生命週期 Adaptive life cycle</strong>：敏捷的、迭代的或增量的，範疇於迭代開始前才被定義與批准，亦可稱為敏捷式或變更導向生命週期。</li><li><strong>混合式生命週期 Hybrid life cycle</strong>：預測式與敏捷式的組合，當已充分理解專案要素或已有既定需求時，可遵循預測式開發生命週期；當專案要素仍在發展或演變中，則遵循調適性開發生命週期。</li></ul><p><strong>產品生命週期：</strong>與專案生命週期各自獨立，也可由專案產生，指的是產品由概念到交付、成長、成熟，以及衰退的一系列演進階段。</p><p><strong>專案管理十大知識領域</strong>：</p><ul><li>整合 integration</li><li>範疇 scope</li><li>時程 schedule</li><li>成本 cost</li><li>品質 quality</li><li>資源 resource</li><li>溝通 communications</li><li>風險 risk</li><li>採購 procurement</li><li>利害關係人 stakeholder</li></ul><p><strong>專案商業文件</strong>Project Management Business Documents與定義：</p><ul><li><strong>專案商業企畫案 Project Business Case</strong>：一份可記載經濟可行性研究的文件，用以對缺乏明確定義的所選組件進行效益之有效性論證，且可作為未來授權專案管理活動的基礎。</li></ul><blockquote>需要評量 Needs Assessment： 於商業企畫案完成前進行，包括對商業目的與目標以及議題與機會的理解，並提出建議提案書，需要評量的結果可摘要於商業企畫案中。</blockquote><ul><li><strong>專案效益管理計畫書 Project Benefitd Management Plan：</strong>為創造、最大化及延續專案效益之過程而定義的文件。說明專案的效益將如何與何時被交付，以及應採用的效益衡量機制為何。</li><li><strong>專案章程 Project Charter：</strong>由專案贊助者發布，用以正式核准專案成立並授權專案經理運用組織資源開發專案活動的文件。</li><li><strong>專案管理計畫書 Project Management Plan：</strong>是一份說明如何執行、監視及管制專案的文件。</li></ul><h3>第二章 專案運行的環境</h3><p>專案之所在與其運行環境可對專案造成一定影響，主要分為</p><ul><li><strong>企業環境因素 (EEFs) Enterprise Environmental Factors：</strong>源於專案外部環境，條件可存在於組織內部與外部。</li></ul><blockquote><strong>組織內部的企業因素 EEFs Interernal to the Organization</strong><br>- 組織的文化、結構及自理<br>- 設施與資源的地理分佈 <br>- 基礎設施<br>- 資訊科技軟體<br>- 資源可用性<br>- 員工能力</blockquote><blockquote><strong>組織外部的企業環境因素 EEFs External to the Organization</strong><br>- 市場情勢<br>- 社會與文化的影響及議題<br>- 法規限制<br>- 商務資料庫<br>- 學術性研究<br>- 政府或產業標準<br>- 財務考量<br>- 實體環境要素</blockquote><ul><li><strong>組織過程資產 (OPAS) Organizational Process Assets：</strong>指的是施行組織所需特別制定與運用的計畫書、過程、政策、程序，以及知識庫。</li></ul><blockquote>- 過程、政策及程序 Processes, Policies, and Procedures：更新並非專案的一部分，而是由專案管理辦公室(PMO)或其他專案外的功能部門制定，且須遵循組織政策，包含起始與規劃、執行、監視與管制、結束。</blockquote><blockquote>- 組織知識庫 Organizational Knowledge Repositories：隨著專案資訊而更新，如財務績效、經驗學習、績效指標、議題等。</blockquote><p><strong>組織系統 Organizational System：</strong>專案在組織與治理框架所設定的限制內運作，為了有效且有效率運作專案，專案經理需了解組織內的各種責任、當責及職權的歸屬。專案經理能有效運用其權力、影響力、適任力與領導力、政治能力以完成專案。<br>系統因素包括：管理要素、治理框架以及組織架構類型。<br>系統為多個組件的集合，集合能實現單一組件無法達成的結果，眾多系統組件之間的相互影響可創造組織的文化與能力，系統原則：動態的、可最佳化的、組建可最佳化、系統與組建不能同時最佳化、系統的呈現是非線性的（投入的變更並不會產出所預期的產出變更）。</p><p><strong>治理框架 Governance Framework：</strong>治理是組織能在期間施展職權的框架，框架包括規則、政策、程序、規範、關係、系統以及過程。<br>此框架能影響如何設定與達成組織目標、如何監視與評量風險、如何最佳化績效。</p><p><strong>專案組合、專案集與專案的治理：</strong>專案治理指的是為創建一獨特產品、服務或成果，進而滿足組織的策略的及營運上的目的，而用來指導專案管理各種活動的框架、功能及過程。實務指南說明四個治理領域：一致性、風險、績效及溝通，每個領域下都具備功能部門：監督、管制、整合及決策制定。無論在專案組合或是專案集環境內運行的專案，功能型部門都有其支援治理的過程與活動。</p><p><strong>專案管理辦公室 PMO：</strong>將專案治理過程標準化，並促進各種資源、方法論、工具，以及技術分享的組織結構。責任區間可大可小，從提供專案管理支援到直接管理，每個類型對專案管控與影響不同。例如：</p><ul><li>支援型 Supportive：提供諮詢性角色，並對專案提供範本、最佳實務、訓練、以及來自其他專案的各種資訊與經驗學習，就是專案知識庫，管制程度低。</li><li>管制型 Controlling：藉由多種途徑提供支援，並要求相關規定的遵循，包括專案管理架構或方法論的採用、特定範本表格及工具的使用、對治理框架的遵守，管控程度中等。</li><li>指示型 Directive：採直接管理方式，專案經理由PMO分派，且直接對PMO報告，管制程度高。</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*kba06OWfEmjAQ4iUhgEqfQ.jpeg" /></figure><p>專案管理辦公室可能需要承擔橫跨整個組織範圍的責任，支援策略一致性的校準與交付組織的價值上扮演重要角色，並可將組織策略專案得來的資料與資訊整合，進一步評估高階策略目標要如何達成，也是一個介於組織的專案組合、專案集、專案，以及組織衡量系統間的聯繫點。</p><p>PMO在專案整個生命週期中是個不可或缺的利害關係人與關鍵決策制定者，可以：提建議、帶領知識轉移、終結專案，必要時可採取其他行動。</p><p>PMO的主要職能之一是提供專案經理多種不同方式的支援，包括：</p><ul><li>管理所管轄的所有專案之共享資源</li><li>辨識與發展專案管理方法論、最佳實務及標準</li><li>指導、輔導、 訓練與監督</li><li>藉由專案稽核途徑，監視對於專案管理標準、政策、程序與範本的遵循</li><li>發展與管理各種專案政策、程序、範本，以及其他共享文件（組織過程資產）</li><li>協調各專案之間的溝通</li></ul><h3>第三章 專案經理的角色</h3><p><strong>專案經理 Project Manager：</strong>不同於功能經理或營運經理，功能經理專注於某功能或事業單位的管理監督，營運經理負責確保商業營運效率，專案經理則是由施行組織指派，負責領導團隊達成專案目標的個人。</p><p>專案經理應致力於：</p><ul><li>展現專案管理的價值</li><li>提升組織對專案管理的接受度</li><li>增進組織內既有的專案管理辦公室PMO的效能</li></ul><p><strong>專案經理的職能：</strong>透過PMI人才三角(The PMI Talent Triangle)可顯示專案經理職能發展(PMCD)架構中提到的專案經理需具備的三項關鍵技能是：</p><ul><li><strong>專業專案管理 Technical project management：</strong>與專案、專案集及專案組合管理特定領域有關的知識、技巧及行為，即執行這些角色的專業層面。</li></ul><pre>有效應用專案管理知識，以交付專案預期成果的技能。<br>頂尖專案經理會展現一些關鍵技能，包括：<br>- 關注於管理每個專案的關鍵專業專案管理要素，隨時備妥對的工作，包括：專案的關鍵成功因素、時程、選定的財務報告、議題紀錄。<br>- 為每個專案量身訂作傳統的與敏捷的工具、技術與方法。<br>- 安排時間完整規劃，並謹慎排序。<br>- 管理專案要素，包括：時程、成本、資源及風險。</pre><ul><li><strong>領導 Leadership：</strong>引領、激勵及指導團隊所需的知識、技巧及行為，以協助組織達成商業目的。</li></ul><pre>領導技巧可展現必要的能力，如：協商、韌性、溝通、問題解決、批判性思考，以及人際關係技巧。<br>領導與管理最終目的都要把工作完成，許多技能與品質的根本之道是能處理政治，政治涉及到影響、協商、自主及權力。<br>權力可能源自個人或組織所展現的特性，形式很多種，包括有職位、資訊、參照、情境、個人魅力、關係、專家、獎勵導向、處罰或強制、迎合、施壓、出於愧疚、說服與迴避的。<br>頂尖的專案經理是主動積極與具有意圖的，會努力在組織的政策、協定及程序的範圍內取得所需的權力與職權，而非等待被授權。</pre><ul><li><strong>策略與商業管理 Strategic and business management：</strong>在產業與組織中的知識與專業技能，其有助於增進績效，並交付更好的商業成果。</li></ul><pre>涉及綜觀組織概況的能力，以及有效協商與實施支持策略配適與創新的決策與行動的能力。這些能力可能包括其他功能部門的工作知識，如財務、行銷與營運。也可能包括發展與應用產品及產業相關德專業知識。此商業知識亦稱為領域知識。<br>專案經理應具備充分商業知識以能夠：<br>- 向他人解釋專案的必要商業資訊。<br>- 與專案贊助者、團隊及主題專家合作發展適當的專案交付策略。<br>- 以最大化專案商業價值的方式實施策略。</pre><pre>為制定專案成功交付的最佳決策，專案經理應探索與考量這些運作組織業務的營運經理之專業知識。對專案主題了解越多越好，至少有足夠知識向他人解釋下列組織面向：<br>- 策略<br>- 使命<br>- 目的與目標<br>- 產品與服務<br>- 營運（如：地理位置、類型、技術）<br>- 市場與市場條件（如：客戶、市場狀況、上市時間因素等）<br>- 競爭</pre><pre>為確保一致性，專案經理應將下列專案與組織的知識與資訊應用到專案上：<br>- 策略<br>- 使命<br>- 目的與目標<br>- 優先等級<br>- 戰略<br>- 產品與服務（如：可交付的成果）</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4_2n3e0O9bVTZKMeOzSbQ.jpeg" /></figure><p>領導與管理的比較：管理較接近運用一組已知的預期行為來指示他人，使其達成另一狀態。領導涉及以討論或辯論方式與他人共事，以帶領達到另一個狀態。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ZUg2rHjDbuL_XUrHqU6chg.jpeg" /></figure><p><strong>進行整合 Performing Integration：</strong>進行專案整合時，專案經理具有雙重角色：</p><ul><li>與專案贊助者一起了解策略目標，並確保專案目標及成果與專案組合、專案集與商業領域保持一致的方面上，專案經理扮演關鍵角色，以此方式協助策略整合與執行。</li><li>專案經理負責引領團隊關注專案層面上真正重要的事物，須整合過程、知識及人員。</li></ul><p>三個不同層面發生的整合：</p><ul><li>於<strong>過程層面</strong>進行整合： 管制專案期間中會相互影響的過程，可能會影響範疇、時程或是預算，如管制範疇過程與進行整合變更管制過程可能會涉及變更申請。</li><li>於<strong>認知層面</strong>的整合：管理專案的方法可能取決特定的專案特徵，如專案大小，專案或組織的複雜度或是組織文化。因此專案經理應精通所有專案管理知識領域，方可應用經驗、見解、領導力以及技術與商業管理技能到專案中。</li><li>於<strong>背景層面</strong>的整合：社交網路、多元文化、虛擬團隊及新價值觀都是近期專案面臨的全新情況，為引導專案團隊，專案經理應考慮專案背景在溝通規劃與知識管理上可能的影響，認知新要素並在專案中妥善運用這些環境新要素，以獲得成功。</li></ul><p>整合與複雜度 Integration and Complexity：有些專案可能被認為是複雜且難以管理的。複雜度的三個維度定義為：</p><ul><li>系統行為 System behavior：組件與系統的相依關係</li><li>人類行為 Human behavior：不同個體與群體之間的交互作用</li><li>不明確性 Ambiguity：出現議題、缺乏理解或混淆造成的不確定性</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76eb13379ed2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD自動部署概念]]></title>
            <link>https://vivivvvvv.medium.com/ci-cd%E8%87%AA%E5%8B%95%E9%83%A8%E7%BD%B2%E6%A6%82%E5%BF%B5-20f6f60e1068?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/20f6f60e1068</guid>
            <category><![CDATA[argo]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Fri, 07 Oct 2022 03:01:56 GMT</pubDate>
            <atom:updated>2022-10-07T03:01:56.397Z</atom:updated>
            <content:encoded><![CDATA[<p>職務調動從PM轉到SA，負責的專案也改變，其中不乏有未完成自動上版流程的專案，為了想讓上版與部署的流程可以更順暢，省時省人力，開始認真研究與撰寫相關文件，從較單純的前端開始練習與實作。</p><p>之前聽過幾次CI/CD說明與教學，沒有實際使用過還是會覺得很抽象，畢竟當PM時候只要請工程師幫忙推上去環境就好(笑)，根本不知道背後準備的工那麼多。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KkaFpDVoDWZFbm5h.png" /></figure><p>首先先了解CICD的概念，簡單說就是上版流程自動化，開發人員將code推到git上後，就可以將後續相關的流程透過系統與工具快速有效率的完成：</p><p>CI 持續整合 (Continuous Integration)</p><p>CD 持續部署 (Continuous Deployment)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/0*NfC8Zph2ZVchQEDI" /></figure><p><strong>Gitlab</strong></p><p>為符合容器化架構，在開發的專案中加上 Dockerfile，定義建置專案系統架構環境，並透過.dockerignore 讓未來 build image 時可以排除不需部署到正式環境的檔案，完成階段性開發 code 後，再一起 git push 至 gitlab 中。</p><p><strong>Nexus</strong></p><p>用來暫存程式套件庫的工具，私有套件庫也會推上這邊存放，在 package.json 或 compose.json 中進行註冊，在 build code 下載套件時會透過 Nexus 進行下載動作，並暫存在 Nexus 上，若有拉過的套件就可以直接從 Nexus 下載，加快 build code 的速度。</p><p><strong>Jenkins</strong></p><p>用來 build code 與 deploy，可透過 pipelines 的格式或 freestyle 的指令撰寫自動部署的腳本，讓 Jenkins 搭配 Gitlab 將程式部署在自己的 lab 或是 server 環境中，自動部署的腳本中，也會在部署前將程式碼弱掃、單元測試…等等的卡控點加入檢查，全部通過即可進入下一階段。</p><p>將 build image 與 run container 等相關環境部署動作納入腳本，並透過 docker build 時設定 tag，最後用 docker push 指令將 build 好的 image 推送至 Harbor 進行保存並透過 tag 進行版本控管；如果環境是在 GCP/K8S/OKD/OCP 之類的環境，則可在 Jenkins pipeline 中額外將 image 的 tag 修改回 kustomize 文件內，讓後續部署時能找到正確的 image 版本。</p><p><strong>Harbor</strong></p><p>Image 的保存工具， build 好的 image 都會存放在這邊作為存取管理，也包含基本容器風險掃描功能。</p><p><strong>Kustomize</strong></p><p>定義部署至容器化平台的 YAML 設定檔，透過 Kustomize 工具將 YAML 設定檔轉換為 K8S 的部署文件，提供 ArgoCD 進行部署使用。</p><p><strong>Argo CD</strong></p><p>讀取專案指定的 kustomize 裡面各項設定與環境變數，透過 kustomize 製作成的 yaml 檔案建立 workflow，自動化執行所有部署流程。</p><p><strong>Lens</strong></p><p>透過 Lens 載入 K8S 環境設定檔，可查看 K8S 上的資訊，像是可以透過 terminal 進入 Pods 中查看 container 的內部，或是進行相關的管理，類似功能還有一套叫作 Rancher 的工具，以瀏覽器的方式進行 K8S 管理。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20f6f60e1068" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[計算機練習：HTML+CSS＋JavaScript]]></title>
            <link>https://vivivvvvv.medium.com/%E8%A8%88%E7%AE%97%E6%A9%9F%E7%B7%B4%E7%BF%92-html-css-javascript-bab1a7b1230?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bab1a7b1230</guid>
            <category><![CDATA[計算機]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Mon, 20 Sep 2021 13:13:43 GMT</pubDate>
            <atom:updated>2021-09-20T13:13:43.733Z</atom:updated>
            <content:encoded><![CDATA[<p>第二個練習是計算機，依舊很壞習慣的花很多時間修畫面都不做邏輯，最後開始用JavaScript操作時耗了很多時間釐清思緒。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*LaPJ5DnfWjV8sJ3B70Nvdg.gif" /><figcaption><strong>計算機</strong></figcaption></figure><h3>HTML</h3><pre>&lt;html&gt;</pre><pre>&lt;head&gt;</pre><pre>&lt;TITLE&gt;vivi幫你算清楚&lt;/TITLE&gt;</pre><pre>&lt;link href=&quot;css/cal.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;</pre><pre>&lt;!-- &lt;script&gt;</pre><pre>alert(&quot;hihi&quot;)</pre><pre>&lt;/script&gt; --&gt;</pre><pre>&lt;style&gt;</pre><pre>p {</pre><pre>color: red;</pre><pre>}</pre><pre>&lt;/style&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body align=&quot;center&quot;&gt;</pre><pre>&lt;h1&gt;精打細算小幫手&lt;/h1&gt;</pre><pre>&lt;p&gt;</pre><pre>&lt;IMG SRC=img/plan.jpg width=&quot;300px&quot;&gt;</pre><pre>&lt;/p&gt;</pre><pre>&lt;hr&gt;</pre><pre>&lt;caption&gt;</pre><pre>&lt;h2&gt;&lt;strong&gt;神算V 計算通&lt;/strong&gt;&lt;/h2&gt;</pre><pre>&lt;/caption&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;table align=&quot;center&quot; id=&#39;calculate&#39;&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;th colspan=&quot;4&quot;&gt;&lt;input value=&quot;0&quot; class=&quot;result&quot;&gt;&lt;/th&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td colspan=&quot;2&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;AC&quot; class=&quot;AC&quot; id=&quot;erase&quot; onclick=&quot;clearNum()&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;%&quot; class=&quot;formula&quot;id=&quot;%&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;/&quot; class=&quot;formula&quot; id=&quot;/&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;7&quot; class=&quot;number&quot; id=&quot;7&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;8&quot; class=&quot;number&quot; id=&quot;8&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;9&quot; class=&quot;number&quot; id=&quot;9&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;*&quot; class=&quot;formula&quot; id=&quot;*&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;4&quot; class=&quot;number&quot; id=&quot;4&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;5&quot; class=&quot;number&quot; id=&quot;5&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;6&quot; class=&quot;number&quot; id=&quot;6&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;-&quot; class=&quot;formula&quot; id=&quot;-&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;1&quot; class=&quot;number&quot; id=&quot;1&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;2&quot; class=&quot;number&quot; id=&quot;2&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;3&quot; class=&quot;number&quot; id=&quot;3&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;+&quot; class=&quot;formula&quot; id=&quot;+&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td colspan=&quot;2&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;0&quot; class=&quot;number_0&quot; id=&quot;0&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;.&quot; class=&quot;number&quot; id=&quot;0.&quot; onclick=&quot;add(this)&quot;&gt;&lt;/td&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;=&quot; class=&quot;formula&quot; id=&quot;=&quot; onclick=&quot;eva()&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;/table&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;script src=&quot;js/cal.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;/html&gt;</pre><h3>CSS</h3><pre>input[type=button] {</pre><pre>border: 0;</pre><pre>height: 60px;</pre><pre>width: 60px;</pre><pre>}</pre><pre>.formula {</pre><pre>border: 0;</pre><pre>background-color: #f14edc;</pre><pre>color: #fff;</pre><pre>border-radius: 50%;</pre><pre>cursor: pointer;</pre><pre>font-size: 20px;</pre><pre>}</pre><pre>.formula:hover {</pre><pre>color: #9d0049;</pre><pre>background-color: #fff;</pre><pre>border: 2px #f14edc solid;</pre><pre>font-size: 25px;</pre><pre>}</pre><pre>.number {</pre><pre>border: 0;</pre><pre>background-color: #e07232;</pre><pre>color: #fff;</pre><pre>border-radius: 50%;</pre><pre>cursor: pointer;</pre><pre>font-size: 20px;</pre><pre>}</pre><pre>.number:hover {</pre><pre>color: #9d0049;</pre><pre>background-color: #fff;</pre><pre>border: 2px #e07232 solid;</pre><pre>font-size: 25px;</pre><pre>}</pre><pre>.AC {</pre><pre>border: 0;</pre><pre>background-color: #5e0404;</pre><pre>color: #fff;</pre><pre>border-radius: 50%;</pre><pre>cursor: pointer;</pre><pre>font-size: 20px;</pre><pre>width: 120px !important;</pre><pre>}</pre><pre>.AC:hover {</pre><pre>color: #9d0049;</pre><pre>background-color: #fff;</pre><pre>border: 2px #5e0404 solid;</pre><pre>font-size: 25px;</pre><pre>width: 120px !important;</pre><pre>}</pre><pre>.number_0 {</pre><pre>border: 0;</pre><pre>background-color: #447aee;</pre><pre>color: #fff;</pre><pre>border-radius: 32px;</pre><pre>cursor: pointer;</pre><pre>font-size: 20px;</pre><pre>width: 120px !important;</pre><pre>}</pre><pre>.number_0:hover {</pre><pre>color: #9d0049;</pre><pre>background-color: #fff;</pre><pre>border: 2px #447aee solid;</pre><pre>font-size: 25px;</pre><pre>width: 120px !important;</pre><pre>}</pre><pre>.result {</pre><pre>border-color:rgb(6, 6, 54);</pre><pre>border-width:3px;</pre><pre>border-style:solid;</pre><pre>background-color: #f7c0d9;</pre><pre>color: rgb(55, 7, 94);</pre><pre>border-radius: 16px;</pre><pre>cursor: pointer;</pre><pre>font-size: 20px;</pre><pre>width: auto;</pre><pre>height: 60px;</pre><pre>padding-left: 15px;</pre><pre>padding-right: 15px;</pre><pre>}</pre><h3>JavaScript</h3><pre>// 計算click次數 且初始顯示0</pre><pre>var isClick = 0</pre><pre>// 將算式暫存為結果做準備</pre><pre>var everyClick = &quot;&quot;</pre><pre>// 按鍵的功能</pre><pre>function add(clickNum) {</pre><pre>// 如果是第一次按按鍵則清空原本的0</pre><pre>if (isClick == 0) {</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value = &#39;&#39;</pre><pre>}</pre><pre>// click次數累加</pre><pre>isClick++;</pre><pre>// 如果按鍵class是數字 則顯示於結果列</pre><pre>var btn = clickNum.getAttribute(&quot;class&quot;);</pre><pre>if (btn == &quot;number_0&quot; || btn == &quot;number&quot;) {</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value += clickNum.value;</pre><pre>}</pre><pre>// 計算符號除了％外 輸入時要抓畫面的數值與計算符號 一起記錄到everyclick 且畫面清空</pre><pre>if (btn == &quot;formula&quot; &amp;&amp; clickNum.value != &quot;%&quot;) {</pre><pre>everyClick = everyClick + document.getElementsByClassName(&quot;result&quot;)[0].value + clickNum.value;</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value = &quot;&quot;</pre><pre>// alert(everyClick)</pre><pre>}</pre><pre>// 輸入％時 將畫面數字/100</pre><pre>if (clickNum.value == &quot;%&quot;){</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value = Math.round (document.getElementsByClassName(&quot;result&quot;)[0].value)/100;</pre><pre>}</pre><pre>}</pre><pre>// 點選等於的輸入計算結果 eval計算everyclick中的資料</pre><pre>function eva() {</pre><pre>everyClick = everyClick + document.getElementsByClassName(&quot;result&quot;)[0].value;</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value = eval(everyClick);</pre><pre>isClick = 0;</pre><pre>everyClick = &quot;&quot;;</pre><pre>// alert(everyClick)</pre><pre>}</pre><pre>// 點選AC清除輸入框 且將everyclick清空計算</pre><pre>function clearNum() {</pre><pre>document.getElementsByClassName(&quot;result&quot;)[0].value = &quot;&quot;;</pre><pre>everyClick = &quot;&quot;;</pre><pre>}</pre><p>這次還有很多判斷需要改善，像是input標籤的運用很多沒實際用到的，以及之後必須再細分每個動作再開始寫，不然每改一個又爆一個。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bab1a7b1230" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[留言板練習前端：HTML+CSS＋JavaScript]]></title>
            <link>https://vivivvvvv.medium.com/%E7%95%99%E8%A8%80%E6%9D%BF%E7%B7%B4%E7%BF%92%E5%89%8D%E7%AB%AF-html-css-javascript-837f36b5fc23?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/837f36b5fc23</guid>
            <category><![CDATA[message-boards]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Sun, 19 Sep 2021 15:15:04 GMT</pubDate>
            <atom:updated>2021-09-20T08:45:36.928Z</atom:updated>
            <content:encoded><![CDATA[<p>身為網頁程式初學者的我，先從前端開始學習網頁程式，從HTML做出基礎，再帶入CSS樣式設計，再加入JavaScript的動作。</p><blockquote><strong>練習內容：</strong><br>留言板可以輸入姓名與email跟意見反饋，會將輸入的資料顯示於下方表格新增列與資料，也可以刪除整列資料。</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnwDPC5_vihrKeHp3ekyDQ.gif" /><figcaption><strong>message_board</strong></figcaption></figure><p>HTML</p><pre>&lt;HTML&gt;</pre><pre>&lt;HEAD&gt;</pre><pre>&lt;!-- 頁籤標題 --&gt;</pre><pre>&lt;TITLE&gt;vivi留言&lt;/TITLE&gt;</pre><pre>&lt;!-- 引用css/style設計 --&gt;</pre><pre>&lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;</pre><pre>&lt;style&gt;</pre><pre>p {</pre><pre>color: red;</pre><pre>}</pre><pre>&lt;/style&gt;</pre><pre>&lt;/HEAD&gt;</pre><pre>&lt;BODY align=&quot;center&quot;&gt;</pre><pre>&lt;h1&gt;想說甚麼，勇敢說！&lt;/h1&gt;</pre><pre>&lt;p&gt;寫下你的資料與意見，我們將再與您聯絡。&lt;/p&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;!-- 輸入框 先宣告submit不回傳 再定義各個欄位form內容 --&gt;</pre><pre>&lt;form action=&quot;&quot; method=&quot;post&quot; onsubmit=&quot;return false;&quot;&gt;</pre><pre>&lt;INPUT TYPE=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; value=&quot;&quot; placeholder=&quot;姓名&quot; class=&quot;BG-Copy&quot; size=&quot;30&quot; /&gt;</pre><pre>&lt;INPUT TYPE=&quot;text&quot; id=&quot;useremail&quot; name=&quot;useremail&quot; value=&quot;&quot; placeholder=&quot;email&quot; class=&quot;BG-Copy&quot; size=&quot;30&quot; /&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;TEXTAREA NAME=&quot;feedback&quot; id=&quot;feedback&quot; ROWS=&quot;8&quot; COLS=&quot;80&quot; placeholder=&quot;想說甚麼都可以&quot; class=&quot;BG-Copy&quot;</pre><pre>style=&quot;border:2px #2f3944 solid;&quot;&gt;&lt;/TEXTAREA&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;!-- 定義送出鍵的動作，使用JavaScript的function--&gt;</pre><pre>&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;送出&quot; class=&quot;Base&quot; style=&#39;text-align:&quot;right&quot;&#39; onclick=&#39;processFormData();addMsg()&#39;&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;p&gt;</pre><pre>&lt;!-- 插圖 --&gt;</pre><pre>&lt;IMG SRC=feedback.gif width=&quot;300px&quot;&gt;</pre><pre>&lt;/p&gt;</pre><pre>&lt;!-- 分隔線hr --&gt;</pre><pre>&lt;hr&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;CAPTION&gt;</pre><pre>&lt;h2&gt;&lt;strong&gt;我的歷史紀錄&lt;/strong&gt;&lt;/h2&gt;</pre><pre>&lt;/CAPTION&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;!-- 表格定義 設定置中 --&gt;</pre><pre>&lt;table width=&quot;800px&quot; align=&quot;center&quot; id=&#39;Feedback_table&#39;&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;th width=&quot;25%&quot;&gt;留言時間&lt;/th&gt;</pre><pre>&lt;th width=&quot;15%&quot;&gt;姓名&lt;/th&gt;</pre><pre>&lt;th width=&quot;20%&quot;&gt;email&lt;/th&gt;</pre><pre>&lt;th width=&quot;30%&quot;&gt;意見內容&lt;/th&gt;</pre><pre>&lt;th width=&quot;10%&quot;&gt;&lt;/th&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;/table&gt;</pre><pre>&lt;/BODY&gt;</pre><pre>&lt;!-- 引用js/index的javascript--&gt;</pre><pre>&lt;script src=&quot;js/index.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;/HTML&gt;</pre><p>CSS</p><pre>.Base {</pre><pre>width: 150px;</pre><pre>height: 50px;</pre><pre>margin: 10px 0 10px 500px;</pre><pre>padding: 10px 35px 10px 35px;</pre><pre>border-radius: 2px;</pre><pre>box-shadow: 2px 2px 0 0 rgba(157, 139, 127, 0.25);</pre><pre>background-color: #c20c8bde;</pre><pre>color: white;;</pre><pre>}</pre><pre>.BG-Copy {</pre><pre>margin: 10px 40px 10px 10px;</pre><pre>padding: 10px 5px 10px 5px;</pre><pre>border-color: #2f3944 ;</pre><pre>}</pre><pre>table {</pre><pre>border:2px solid #2f3944;</pre><pre>font-family: 微軟正黑體;</pre><pre>font-size:16px;</pre><pre>text-align:center;</pre><pre>border-collapse:collapse;</pre><pre>}</pre><pre>th {</pre><pre>background-color: #c20c8bde;</pre><pre>border:1px solid #2f3944;</pre><pre>color:#fff;</pre><pre>}</pre><pre>td {</pre><pre>border:1px solid #2f3944;</pre><pre>}</pre><pre>tr{</pre><pre>height:60px;</pre><pre>}</pre><p>JavaScript</p><pre>var nameElement = document.getElementById(&quot;username&quot;);</pre><pre>var emailElement = document.getElementById(&quot;useremail&quot;);</pre><pre>var feedbackElement = document.getElementById(&quot;feedback&quot;);</pre><pre>function processFormData() {</pre><pre>const name = nameElement.value;</pre><pre>const email = emailElement.value;</pre><pre>alert(&quot;謝謝&quot; + name + &quot;的回饋，我們將再用email:&quot; + email + &quot;與您聯繫!&quot;);</pre><pre>}</pre><pre>function addMsg() {</pre><pre>// 獲取table標籤元素</pre><pre>let table = document.getElementById(&quot;Feedback_table&quot;);</pre><pre>// 建立新行</pre><pre>let newRow = table.insertRow();</pre><pre>// 建立三個新單元格 向表格中插入元素</pre><pre>newRow.insertCell().innerHTML = new Date().toLocaleString();</pre><pre>newRow.insertCell().innerHTML = nameElement.value;</pre><pre>newRow.insertCell().innerHTML = emailElement.value;</pre><pre>newRow.insertCell().innerHTML = feedbackElement.value;</pre><pre>newRow.insertCell().innerHTML = &#39;&lt;input type=&quot;button&quot; value=&quot;Delete&quot; onclick=&quot;delRow(this)&quot;&gt;&lt;/input&gt;&#39;</pre><pre>nameElement.value = &#39;&#39;;</pre><pre>emailElement.value = &#39;&#39;;</pre><pre>feedbackElement.value = &#39;&#39;;</pre><pre>}</pre><pre>function delRow(r) {</pre><pre>// 指定i=r(this)的父層+父層</pre><pre>var i = r.parentNode.parentNode.rowIndex;</pre><pre>// 刪除指定階層</pre><pre>document.getElementById(&quot;Feedback_table&quot;).deleteRow(i);</pre><pre>alert(&quot;謝謝您的回饋，我們已將資訊刪除!&quot;);</pre><pre>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=837f36b5fc23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[亂數練習：骰子比大小]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BA%82%E6%95%B8%E7%B7%B4%E7%BF%92-%E9%AA%B0%E5%AD%90%E6%AF%94%E5%A4%A7%E5%B0%8F-6b5e8522bad4?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b5e8522bad4</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Sun, 21 Mar 2021 05:48:07 GMT</pubDate>
            <atom:updated>2021-03-21T13:07:51.850Z</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/48-%E9%AA%B0%E5%AD%90%E8%BD%89%E8%BD%89%E8%BD%89%E5%92%8C%E9%AA%B0%E5%AD%90%E5%90%B9%E7%89%9B-69368b4e8382">#48 骰子轉轉轉 &amp; 骰子吹牛</a></p><p>分為PC跟玩家，各有三顆骰子隨機產生點數，互相比大小，除了玩家點數總和大於PC算贏外，其餘都算輸。</p><p>分為兩邊亂數產生骰面圖案</p><p>並計算兩邊各自總和</p><p>兩邊總和比大小並產生對應結果</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blc4oqJZeYw4zipm16SIvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUcpi20YaM-ScYFpD2wybQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dTS5Z4SVLQTp7lnZGungPg.png" /><figcaption>初始與結果畫面</figcaption></figure><pre>完整程式：</pre><pre>//</pre><pre>// ViewController.swift</pre><pre>// dice20210104</pre><pre>//</pre><pre>// Created by Vivi Lee on 2021/1/4.</pre><pre>//</pre><pre><strong>import</strong> UIKit</pre><pre><strong>class</strong> ViewController: UIViewController {</pre><pre><strong>@IBOutlet</strong> <strong>var</strong> PCdiceImageViews: [UIImageView]!</pre><pre><strong>@IBOutlet</strong> <strong>var</strong> YoudiceImageViews: [UIImageView]!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> resultImage: UIImageView!</pre><pre><strong>var</strong> PC = [“dice1”,”dice2&quot;,”dice3&quot;]</pre><pre><strong>var</strong> You = [“dice4”,”dice5&quot;,”dice6&quot;]</pre><pre><strong>var</strong> sumPC = 0</pre><pre><strong>var</strong> sumYou = 0</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>resultImage.isHidden = <strong>true</strong></pre><pre>}</pre><pre><strong>@IBAction</strong> <strong>func</strong> actionBtn(<strong>_</strong> sender: UIButton) {</pre><pre><strong>for</strong> imageView <strong>in</strong> PCdiceImageViews {</pre><pre><strong>let</strong> number = Int.random(in: 1…6)</pre><pre>imageView.image = UIImage(systemName: “die.face.\(number).fill”)</pre><pre>sumPC += number</pre><pre>}</pre><pre><strong>for</strong> imageView <strong>in</strong> YoudiceImageViews {</pre><pre><strong>let</strong> number = Int.random(in: 1…6)</pre><pre>imageView.image = UIImage(systemName: “die.face.\(number).fill”)</pre><pre>sumYou += number</pre><pre>}</pre><pre>print(sumPC)</pre><pre>print(sumYou)</pre><pre>resultImage.isHidden = <strong>false</strong></pre><pre><strong>if</strong> sumYou &gt; sumPC{</pre><pre>resultImage.image = UIImage(named: “win”)</pre><pre>}</pre><pre><strong>else</strong> {</pre><pre>resultImage.image = UIImage(named: “lose”)</pre><pre>}</pre><pre>}</pre><pre>}</pre><p><a href="https://github.com/ViviLeevvv528/dice20210104">ViviLeevvv528/dice20210104</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b5e8522bad4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BA%82%E6%95%B8%E7%B7%B4%E7%BF%92-%E9%AA%B0%E5%AD%90%E6%AF%94%E5%A4%A7%E5%B0%8F-6b5e8522bad4">亂數練習：骰子比大小</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[練習：猜拳遊戲]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E7%B7%B4%E7%BF%92-%E7%8C%9C%E6%8B%B3%E9%81%8A%E6%88%B2-d71b6f0d8ffa?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d71b6f0d8ffa</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Sat, 13 Mar 2021 14:02:19 GMT</pubDate>
            <atom:updated>2021-03-21T05:26:27.822Z</atom:updated>
            <content:encoded><![CDATA[<h3>亂數練習：猜拳遊戲</h3><p>雖然看似不難，但對於邏輯還沒打通任督二脈（以及好久沒有練習）的我而言還是吃盡苦頭，運用到幾個技巧：array /if else / random / sender / func。</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/%E5%89%AA%E5%88%80-%E7%9F%B3%E9%A0%AD-%E5%B8%83-app-%E6%88%96%E5%85%B6%E5%AE%83%E7%8C%9C%E6%8B%B3%E9%81%8A%E6%88%B2-2643747a6eb6">#10 猜拳遊戲 App</a></p><p>邏輯大概是這樣</p><pre>畫面<br>1. 電腦出拳畫面隨機<br>2. 玩家出拳畫面與出拳按鈕<br>3. 初始畫面與輸贏結果畫面</pre><pre>觸發動作<br>1. 玩家點選剪刀、石頭、布 按鈕<br>宣告: <br>按鈕 剪刀= Scissor<br>按鈕 石頭=Rock <br>按鈕 布=Paper<br>2. 玩家出拳畫面顯示所選<br>依據按鈕結果顯示對應的圖片<br>3. 電腦隨機出拳畫面<br>隨機產生出拳與對應圖片<br>4. 判斷輸贏顯示結果在結果畫面<br>If 玩家&lt;電腦，顯示lose圖<br>If 玩家&gt;電腦，顯示win圖<br>If 玩家=電腦，顯示平手圖</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ww4lmgtp-wQVcLbwhc6Ivw.png" /><figcaption>初始畫面</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJe6aMhXewM5vtfPg4KReg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1REtry82V59AG8QBOO9tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*brIXU91Lmogg_R31SUrFsw.png" /><figcaption>結果畫面</figcaption></figure><p>完整程式</p><pre>//</pre><pre>// ViewController.swift</pre><pre>// 猜拳遊戲</pre><pre>//</pre><pre>// Created by Vivi Lee on 2021/3/7.</pre><pre>//</pre><pre><strong>import</strong> UIKit</pre><pre><strong>class</strong> ViewController: UIViewController {</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> pcPlayer: UIImageView!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> player: UIImageView!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> result: UIImageView!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> scissorBtn: UIButton!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> rockBtn: UIButton!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> paperBtn: UIButton!</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>restarGame()</pre><pre>}</pre><pre>//設定猜拳顯示的圖片</pre><pre><strong>let</strong> rockImage = UIImage(named: “rock”)</pre><pre><strong>let</strong> paperImage = UIImage(named: “paper”)</pre><pre><strong>let</strong> scissorImage = UIImage(named: “scissor”)</pre><pre>//pc隨機圖片array</pre><pre><strong>let</strong> pcPlayerImage = [“rock”,”paper”, “scissor”]</pre><pre><strong>func</strong> pcPlay() {</pre><pre>pcPlayer.image = UIImage(named: pcPlayerImage.randomElement()!)</pre><pre>}</pre><pre>// 設定結果顯示圖片</pre><pre><strong>let</strong> winImage = UIImage(named: “win”)</pre><pre><strong>let</strong> loseImage = UIImage(named: “lose”)</pre><pre><strong>let</strong> winwinImage = UIImage(named: “try”)</pre><pre><strong>func</strong> gameResult() {</pre><pre><strong>if</strong> player.image == pcPlayer.image{</pre><pre>result.image = winwinImage</pre><pre>}</pre><pre><strong>if</strong> player.image == scissorImage{</pre><pre><strong>if</strong> pcPlayer.image == UIImage(named: “rock”){</pre><pre>result.image = loseImage</pre><pre>}</pre><pre><strong>else</strong> <strong>if</strong> pcPlayer.image == UIImage(named: “paper”){</pre><pre>result.image = winImage</pre><pre>}</pre><pre>}</pre><pre><strong>else</strong> <strong>if</strong> player.image == rockImage{</pre><pre><strong>if</strong> pcPlayer.image == UIImage(named:”paper”){</pre><pre>result.image = loseImage</pre><pre>}</pre><pre><strong>else</strong> <strong>if</strong> pcPlayer.image == UIImage(named: “scissor”){</pre><pre>result.image = winImage</pre><pre>}</pre><pre>}</pre><pre><strong>else</strong> <strong>if</strong> player.image == paperImage{</pre><pre><strong>if</strong> pcPlayer.image == UIImage(named:”scissor”){</pre><pre>result.image = loseImage</pre><pre>}</pre><pre><strong>else</strong> <strong>if</strong> pcPlayer.image == UIImage(named: “rock”){</pre><pre>result.image = winImage</pre><pre>}</pre><pre>}</pre><pre>}</pre><pre><strong>func</strong> restarGame(){</pre><pre>player.image = <strong>nil</strong></pre><pre>pcPlayer.image = <strong>nil</strong></pre><pre>result.image = UIImage(named:”vs”)</pre><pre>}</pre><pre>// 按鈕定義三種出拳</pre><pre><strong>@IBAction</strong> <strong>func</strong> playGameAction(<strong>_</strong> sender: UIButton) {</pre><pre><strong>if</strong> sender == scissorBtn{</pre><pre>player.image = scissorImage</pre><pre>}</pre><pre><strong>if</strong> sender == rockBtn{</pre><pre>player.image = rockImage</pre><pre>}</pre><pre><strong>if</strong> sender == paperBtn{</pre><pre>player.image = paperImage</pre><pre>}</pre><pre>pcPlay()</pre><pre>gameResult()</pre><pre>}</pre><pre>}</pre><p><a href="https://github.com/ViviLeevvv528/rock-paper-scissors">ViviLeevvv528/rock-paper-scissors</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d71b6f0d8ffa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E7%B7%B4%E7%BF%92-%E7%8C%9C%E6%8B%B3%E9%81%8A%E6%88%B2-d71b6f0d8ffa">練習：猜拳遊戲</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[課堂練習：畫喬治亞國旗]]></title>
            <link>https://vivivvvvv.medium.com/%E8%AA%B2%E5%A0%82%E7%B7%B4%E7%BF%92-%E7%95%AB%E5%96%AC%E6%B2%BB%E4%BA%9E%E5%9C%8B%E6%97%97-e3ed8e0a8132?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3ed8e0a8132</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Mon, 25 Jan 2021 12:27:47 GMT</pubDate>
            <atom:updated>2021-01-25T12:27:47.527Z</atom:updated>
            <content:encoded><![CDATA[<p>課程練習筆記</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*YluhjeQiSY5-C5BGUFO-DQ.png" /></figure><pre><strong>import</strong> UIKit</pre><pre><strong>func</strong> getCrossView() -&gt; UIView {</pre><pre><strong>let</strong> view = UIView(frame: CGRect(x: 0, y: 0, width: 170, height: 105))<strong>import</strong> UIKit</pre><pre><strong>func</strong> getCrossView() -&gt; UIView {</pre><pre>//    先畫白色背景</pre><pre><strong>let</strong> view = UIView(frame: CGRect(x: 0, y: 0, width: 170, height: 105))</pre><pre>view.backgroundColor = UIColor.white</pre><pre>//    再畫紅色十字</pre><pre><strong>let</strong> hRedView = UIView(frame: CGRect(x: 0, y: 0, width: 54, height: 20))</pre><pre>hRedView.backgroundColor = UIColor.red</pre><pre>hRedView.center = view.center</pre><pre>view.addSubview(hRedView)</pre><pre><strong>let</strong> vRedView = UIView(frame: CGRect(x: 0, y: 0, width: 20, height: 54))</pre><pre>vRedView.backgroundColor = UIColor.red</pre><pre>vRedView.center = view.center</pre><pre>view.addSubview(vRedView)</pre><pre><strong>return</strong> view</pre><pre>}</pre><pre>//計算並標記四個區域位置</pre><pre><strong>var</strong> points = [CGPoint(x: 0, y: 0), CGPoint(x: 230, y: 0), CGPoint(x: 0, y: 162),</pre><pre>CGPoint(x: 230, y: 162)]</pre><pre>//畫出紅底</pre><pre><strong>let</strong> redView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 267))</pre><pre>redView.backgroundColor = UIColor.red</pre><pre>//重複四個白底紅十字的圖</pre><pre><strong>for</strong> point <strong>in</strong> points {</pre><pre><strong>let</strong> crossView = getCrossView()</pre><pre>crossView.frame.origin = point</pre><pre>redView.addSubview(crossView)</pre><pre>}</pre><pre>redView</pre><p>使用到for &amp; return &amp; array</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3ed8e0a8132" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[選擇題練習：心理測驗]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E9%81%B8%E6%93%87%E9%A1%8C%E7%B7%B4%E7%BF%92-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97-d22ee77cb81c?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d22ee77cb81c</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 07:55:06 GMT</pubDate>
            <atom:updated>2021-01-17T13:43:37.387Z</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/25-%E9%81%B8%E6%93%87%E9%A1%8C-app-234770143812">#25 選擇題 App</a></p><p>但我想變化成心理測驗的方式呈現，題目是這個</p><p><a href="https://iview.sina.com.tw/post/21693212">https://iview.sina.com.tw/post/21693212</a></p><p>因為每題的答案選項跟分數數量不一，先將csv設計成陣列</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-3UmVpO_0gFOMvzfWS8bA.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%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8-codablecsv-%E8%A7%A3%E6%9E%90-csv-%E4%BB%A5airtable-%E7%82%BA%E4%BE%8B-1cc8bc6a9570">利用 CodableCSV 解析 csv，以Airtable 為例</a></p><p>再來看看呈現方式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*Dr2lCCw_XP6YZo_SAOx1-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*QyEDcm4yfJ7uVB9Ajml_jw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*xsQm4vvGbtJOKwyGbhxFrw.png" /></figure><p>以及完整程式</p><pre>//</pre><pre>//  ViewController.swift</pre><pre>//  MultipleChoice</pre><pre>//</pre><pre>//  Created by Vivi Lee on 2021/1/9.</pre><pre>//</pre><pre><strong>import</strong> UIKit</pre><pre>//匯入csv</pre><pre><strong>import</strong> CodableCSV</pre><pre>//定義欄位</pre><pre><strong>struct</strong> Psytest: Codable {</pre><pre><strong>let</strong> question: String</pre><pre><strong>let</strong> answer: [String]</pre><pre><strong>let</strong> score: [String]</pre><pre>//宣告使用多選項type定義欄位</pre><pre><strong>init</strong>(from decoder: Decoder) <strong>throws</strong> {</pre><pre><strong>let</strong> container = <strong>try</strong> decoder.container(keyedBy: CodingKeys.<strong>self</strong>)</pre><pre>question = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .question)</pre><pre><strong>let</strong> answerString = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .answer)</pre><pre>answer = answerString.components(separatedBy: &quot;,&quot;)</pre><pre><strong>let</strong> scoreString = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .score)</pre><pre>score = scoreString.components(separatedBy: &quot;,&quot;)</pre><pre>}</pre><pre>}</pre><pre>//宣告使用csv產生的data array</pre><pre><strong>extension</strong> Psytest {</pre><pre><strong>static</strong> <strong>var</strong> data: [Self] {</pre><pre><strong>var</strong> array = [<strong>Self</strong>]()</pre><pre><strong>if</strong> <strong>let</strong> data = NSDataAsset(name: &quot;Psytests&quot;)?.data {</pre><pre><strong>let</strong> decoder = CSVDecoder {</pre><pre>$0.headerStrategy = .firstLine</pre><pre>}</pre><pre><strong>do</strong> {</pre><pre>array = <strong>try</strong> decoder.decode([<strong>Self</strong>].<strong>self</strong>, from: data)</pre><pre>} <strong>catch</strong> {</pre><pre>print(error)</pre><pre>}</pre><pre>}</pre><pre><strong>return</strong> array</pre><pre>}</pre><pre>}</pre><pre><strong>class</strong> ViewController: UIViewController {</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> questionLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>var</strong> answerTables: [UIButton]!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> resultLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> startButton: UIButton!</pre><pre>//    設定取用data</pre><pre><strong>var</strong> psytests = Psytest.data</pre><pre>//    宣告index儲存目前題數</pre><pre><strong>var</strong> index = 0</pre><pre>//    宣告total儲存目前分數</pre><pre><strong>var</strong> total = 0</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>print(psytests)</pre><pre>cleanContent()</pre><pre>//        print(psytests[0])</pre><pre>//        print(psytests[0].question)</pre><pre>//        print(psytests[0].answer[0])</pre><pre>//        print(psytests[0].score[0])</pre><pre>}</pre><pre>//    測驗的顯示動作</pre><pre><strong>func</strong> startTest(){</pre><pre>//        開始鍵點一次後就可以隱藏</pre><pre>startButton.isHidden = <strong>true</strong></pre><pre>//        定義答案題數</pre><pre><strong>var</strong> i = 0</pre><pre>//        print(psytests.count)</pre><pre>//        題數依照題庫數量</pre><pre><strong>if</strong> index &lt; psytests.count {</pre><pre>//        問題呈現文字定義</pre><pre>questionLabel.text = psytests[index].question</pre><pre>//        print(psytests[index].answer[index])</pre><pre>//        答案選擇要依序呈現，並且以陣列呈現</pre><pre><strong>for</strong> val <strong>in</strong> psytests[index].answer{</pre><pre>//            print(val)</pre><pre>answerTables[i].setTitle(val, for: UIControl.State.normal)</pre><pre>i = i + 1</pre><pre>}</pre><pre>}</pre><pre>}</pre><pre>//清除的動作</pre><pre><strong>func</strong> cleanContent(){</pre><pre>//        問題清空</pre><pre>questionLabel.text = &quot;&quot;</pre><pre>//        七個答案選項都清空</pre><pre><strong>for</strong> i <strong>in</strong> 0...6{</pre><pre>answerTables[i].setTitle(&quot;&quot;, for: UIControl.State.normal)</pre><pre>}</pre><pre>}</pre><pre>//    秀結果分數動作</pre><pre><strong>func</strong> showResult(){</pre><pre><strong>if</strong> total &gt;= 60{</pre><pre>resultLabel.text = &quot;在別人眼中是一個以利益為先的人，你有虚榮之心，較自我中心，同時喜歡支配別人，雖然有人會羨慕及仰望你，但其實你的信賴度很低，真正相信你的人並不多。&quot;</pre><pre>}</pre><pre><strong>if</strong> total &gt;= 51{</pre><pre>resultLabel.text = &quot;你在別人眼中是領導者，也是一個能在短時間內做出決定的人。你是一個很容易興奮，而且情緒起伏很大、十分衝動的人。另外，你勇敢、喜歡接受挑戰，只要有機會，你都會接受新嘗試，和你親近的人，會被你的熱情吸引。&quot;</pre><pre>}</pre><pre><strong>if</strong> total &gt;= 41{</pre><pre>resultLabel.text = &quot;你身邊的人都認為你活潑、有魅力、有趣和開朗，無論去到哪裡，你也受到注目，但你很會看別人的眼色，所以不會變得驕傲自大。另外，你在別人眼中亦是一個多情和親切的人，在別人有困難時，第一時間都會想起你，因為你擁有樂於助人的形象。&quot;</pre><pre>}</pre><pre><strong>if</strong> total &gt;= 31{</pre><pre>resultLabel.text = &quot;別人眼中的你，是一個賢明、慎重、小心、現實的人，而且十分聰明，有很高的能力和才能，為人謙虚。另外，你和別人交往時，不會以輕挑態度接近，而對認識的朋友十分真誠，希望別人亦能以相同的態度待你。&quot;</pre><pre>}</pre><pre><strong>if</strong> total &gt;= 21{</pre><pre>resultLabel.text = &quot;在別人眼中，你是一個固執和非常小心的人。無論什麼事你也會慎重和小心，一旦遇上令你著迷的事，你會非常衝動地朝著目標前進。不過，因為做事實在太仔細，有時候會給人「太執著」、「太認真」的感覺，在適當時候記得要顧及別人的感受。&quot;</pre><pre>}</pre><pre><strong>else</strong> {</pre><pre>resultLabel.text = &quot;在別人眼中的你，是十分害羞、膽小、柔弱的人，你也是有「選擇困難」的人，任何事都要別人替你決定，而別人也盡量不想與你有牽連。此外，你的觀察力很高，經常發現到一些別人沒有發現的錯誤或問題，所以和你不熟的人會以為你很高智慧，但和你親近的人就知道這不是事實。&quot;</pre><pre>}</pre><pre>}</pre><pre><strong>@IBAction</strong> <strong>func</strong> startBtn(<strong>_</strong> sender: <strong>Any</strong>) {</pre><pre>cleanContent()</pre><pre>startTest()</pre><pre>}</pre><pre><strong>@IBAction</strong> <strong>func</strong> answerBtns(<strong>_</strong> sender: UIButton) {</pre><pre>//        print(total)</pre><pre>//        先假設題目數量不要超過</pre><pre><strong>if</strong> index &lt; psytests.count {</pre><pre>//            再假設tag取用數量依照score欄內數量</pre><pre><strong>if</strong> sender.tag &lt;= psytests[index].score.count {</pre><pre>//                計分方式要將欄位中的字串轉為數字</pre><pre>total = total + Int(psytests[index].score[sender.tag - 1])!</pre><pre>//                依序秀題數</pre><pre>index = index + 1</pre><pre>cleanContent()</pre><pre>startTest()</pre><pre>//                print(total)</pre><pre>//                如果跑完10題秀出成績結果</pre><pre><strong>if</strong> index == 10{</pre><pre>showResult()</pre><pre>}</pre><pre>}</pre><pre>}</pre><pre>}</pre><pre>}</pre><p>動態呈現</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWMWXCffMl9o%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWMWXCffMl9o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWMWXCffMl9o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/947a19a8a39ef22d3bb99315efeabd87/href">https://medium.com/media/947a19a8a39ef22d3bb99315efeabd87/href</a></iframe><p>最後歡迎大家下載玩玩看</p><p><a href="https://github.com/ViviLeevvv528/MultipleChoice">ViviLeevvv528/MultipleChoice</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d22ee77cb81c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E9%81%B8%E6%93%87%E9%A1%8C%E7%B7%B4%E7%BF%92-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97-d22ee77cb81c">選擇題練習：心理測驗</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[課程心得: 文組生的iOS APP程式設計入門]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E8%AA%B2%E7%A8%8B%E5%BF%83%E5%BE%97-%E6%96%87%E7%B5%84%E7%94%9F%E7%9A%84ios-app%E7%A8%8B%E5%BC%8F%E8%A8%AD%E8%A8%88%E5%85%A5%E9%96%80-f8027b36ea8b?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8027b36ea8b</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[peter-pan]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 12:10:38 GMT</pubDate>
            <atom:updated>2021-01-11T14:00:28.826Z</atom:updated>
            <content:encoded><![CDATA[<p>課程已經結束，但腦中的疑問還是很多，未完成的作業也是...(淚)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*JC0exgs9yz7TYxRDCK2Rrg.jpeg" /></figure><p>本人曾是幼教系畢業又溫柔又可愛的幼稚園老師(?)，但經過多年的職涯轉折，現在是苦(顧)命(人)的(怨)PM，聽過各種工程師對PM的抱怨，期許自己不要成為甚麼都聽不懂的笨蛋PM(但我其實還是很怕被工程師嗆爆所以不敢提起自己在學程式(噤聲) )。</p><p>一直以來都使用iPhone，再加上剛買了熱騰騰的 MAC pro，各種理由都顯示了寫Swift應該就是天意，而且我那麼有邏輯，現在開始應該也不遲吧，總而言之就這樣一頭栽入了文組生的寫扣日常。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*nrdjHLOi3ITqtJo_KLo20w.jpeg" /></figure><p>經過了這幾個月的訓(折)練(磨)，我發現會寫程式的人很多，但會教人的工程師還真的不容易找，幸好當初選擇的是彼得潘大大。不管任何時問總是光速地給予方向，比起給魚吃，更堅持教會我們怎麼釣魚，起初常常在問完後對自己的人生與智商充滿巨大的疑問，但根據那些線索去估狗尋找答案與研究的過程反而更能理解吸收。</p><p>每一堂課彼得潘都設定了主題，用淺顯易懂的概念說明(佐以很有年代感的歌曲)，透過這些能讓非本科系的迷途羔羊更有系統地學習跟消化(不過沒有好好寫作業跟認真練習的話還是很殘酷的會離完成作業這件事越來越遠，怎麼想破頭都寫不出來)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*XYxz_QxDNYnOpPOWWkhEMQ.jpeg" /><figcaption>跟xcode程式互看兩天也寫不出來的我</figcaption></figure><p>每次課堂下課都會覺得資訊量過大、頭好脹，但透過課程學習到的知識完成作業，卻又會得到滿滿的成就感，所以都會督促自己乖乖寫作業(雖然時間不太夠加上領悟力不夠快所以寫得很慢)，另外的附加好處就是因為第一堂課時彼得潘說只要做滿10個作業就可以申請學習證書(羞)，所以收集控如我更是不能放棄機會(以下附上虛榮的證書本人)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AxwjSBshZR7SrBiywinFwQ.jpeg" /></figure><p>課程咻一下的就結束了，但想學的東西好多，不懂的東西也還是好多，但時間卻好少好少，雖然我還在猶豫這樣的狀(資)態(質)能否繼續報進階班，但肯定的是我會好好把之前的課程再複習理解，並繼續把其他有興趣的作業練習完成，並要對自己更有自信一點！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*7S6lvYihF3MfAMQ1JH2Jag.jpeg" /></figure><p>非常感謝彼得潘，還有謝謝身邊陪伴我、鼓勵我又願意教我(然後不小心會幫我寫完作業還被罵)的捧油。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*BUOHlMDSGk7-bHg37CHVZw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8027b36ea8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E8%AA%B2%E7%A8%8B%E5%BF%83%E5%BE%97-%E6%96%87%E7%B5%84%E7%94%9F%E7%9A%84ios-app%E7%A8%8B%E5%BC%8F%E8%A8%AD%E8%A8%88%E5%85%A5%E9%96%80-f8027b36ea8b">課程心得: 文組生的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[猜猜歌：練習問答/亂數/音樂播放/帶入 Airtable-csv]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E7%8C%9C%E7%8C%9C%E6%AD%8C-%E7%B7%B4%E7%BF%92%E5%95%8F%E7%AD%94-%E4%BA%82%E6%95%B8-%E9%9F%B3%E6%A8%82%E6%92%AD%E6%94%BE-%E5%B8%B6%E5%85%A5-airtable-csv-4b6a1cbbda1f?source=rss-94f1989b25f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b6a1cbbda1f</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[ViviLee]]></dc:creator>
            <pubDate>Wed, 06 Jan 2021 15:07:20 GMT</pubDate>
            <atom:updated>2021-01-06T15:08:51.654Z</atom:updated>
            <content:encoded><![CDATA[<p>這次作業理想太宏大，經歷很多挫折洩氣以及很多人的幫忙與參考才完成。</p><p>這次選了很多好聽的經典歌曲，有興趣可以玩玩看：）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZWSlgtMVpXiQHgMqpYG1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xawZqyAvQRwXm0kgmK5drw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4oZuTdPckLn397NM6pz0w.png" /></figure><p>作業內容</p><ul><li><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/%E5%95%8F%E7%AD%94%E9%A1%8C-app-%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-ios-app-%E4%BD%9C%E6%A5%AD-495bc02771bd">#3 問答 &amp; 填充題 App</a></li><li><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/25-%E9%81%B8%E6%93%87%E9%A1%8C-app-234770143812">#25 選擇題 App</a></li></ul><p>程式內容</p><pre>//</pre><pre>// ViewController.swift</pre><pre>// QA 20201228</pre><pre>//</pre><pre>// Created by Vivi Lee on 2020/12/28.</pre><pre>//</pre><pre>// 載入ui畫面</pre><pre><strong>import</strong> UIKit</pre><pre>// 載入聲音</pre><pre><strong>import</strong> AVFoundation</pre><pre><strong>var</strong> name = “”</pre><pre><strong>var</strong> random = Int.random(in: 0…44)</pre><pre>// 載入csv解析</pre><pre><strong>import</strong> CodableCSV</pre><pre>// 設定csv匯入與定義欄位</pre><pre><strong>struct</strong> music: Codable {</pre><pre><strong>let</strong> name: String</pre><pre><strong>let</strong> singer: String</pre><pre><strong>let</strong> musicURL: URL</pre><pre><strong>let</strong> image: [URL]</pre><pre>// 宣告圖片的進階寫法</pre><pre><strong>init</strong>(from decoder: Decoder) <strong>throws</strong> {</pre><pre><strong>let</strong> container = <strong>try</strong> decoder.container(keyedBy: CodingKeys.<strong>self</strong>)</pre><pre>name = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .name)</pre><pre>singer = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .singer)</pre><pre>musicURL = <strong>try</strong> container.decode(URL.<strong>self</strong>, forKey: .musicURL)</pre><pre><strong>let</strong> imagesString = <strong>try</strong> container.decode(String.<strong>self</strong>, forKey: .image)</pre><pre>image = imagesString.components(separatedBy: “,”).map {</pre><pre>URL(string: $0.components(separatedBy: “(“)[1].replacingOccurrences(of: “)”, with: “”))!</pre><pre>}</pre><pre>print(image[0])</pre><pre>}</pre><pre>}</pre><pre>// 宣告讀取csv 產生的 data</pre><pre><strong>extension</strong> music {</pre><pre><strong>static</strong> <strong>var</strong> data: [Self] {</pre><pre><strong>var</strong> array = [<strong>Self</strong>]()</pre><pre><strong>if</strong> <strong>let</strong> data = NSDataAsset(name: “music”)?.data {</pre><pre><strong>let</strong> decoder = CSVDecoder {</pre><pre>$0.headerStrategy = .firstLine</pre><pre>}</pre><pre><strong>do</strong> {</pre><pre>array = <strong>try</strong> decoder.decode([<strong>Self</strong>].<strong>self</strong>, from: data)</pre><pre>} <strong>catch</strong> {</pre><pre>print(error)</pre><pre>print(“loooooook here”)</pre><pre>}</pre><pre>}</pre><pre><strong>return</strong> array</pre><pre>}</pre><pre>}</pre><pre><strong>class</strong> ViewController: UIViewController {</pre><pre>//設定取用data</pre><pre><strong>var</strong> musics = music.data</pre><pre>// 設定question定義</pre><pre><strong>var</strong> questions = “”</pre><pre><strong>var</strong> index = 0</pre><pre>// 定義問題</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> questionLabel: UILabel!</pre><pre>// 定義答案</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> answerLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> answerSingerLabel: UILabel!</pre><pre>// 定義答案歌手顯示照片</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> singerImage: UIImageView!</pre><pre>// 播放音樂的動作定義</pre><pre><strong>let</strong> player = AVPlayer()</pre><pre><strong>@IBAction</strong> <strong>func</strong> play(<strong>_</strong> sender: <strong>Any</strong>) {</pre><pre>autoplay()</pre><pre>}</pre><pre>// 設定自動播放功能</pre><pre><strong>func</strong> autoplay() {</pre><pre><strong>let</strong> fileUrl = musics[random].musicURL</pre><pre><strong>let</strong> playerItem = AVPlayerItem(url: fileUrl)</pre><pre>player.replaceCurrentItem(with: playerItem)</pre><pre>player.play()</pre><pre>}</pre><pre><strong>@IBAction</strong> <strong>func</strong> pause(<strong>_</strong> sender: <strong>Any</strong>) {</pre><pre>player.pause()</pre><pre>}</pre><pre><strong>@IBAction</strong> <strong>func</strong> restart(<strong>_</strong> sender: <strong>Any</strong>) {</pre><pre>// player.stop()</pre><pre>player.seek(to: .zero) //因為stop音樂功能不支援了 改成寫指定到時間0</pre><pre>player.play()</pre><pre>}</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>}</pre><pre>//設定點選顯示答案要出現的內容</pre><pre><strong>@IBAction</strong> <strong>func</strong> showAnswerBtn(<strong>_</strong> sender: UIButton) {</pre><pre>answerLabel.text = musics[random].name</pre><pre>answerSingerLabel.text = musics[random].singer</pre><pre>singerImage.image = <strong>try</strong>? UIImage(data: Data(contentsOf: musics[random].image[0]))</pre><pre>}</pre><pre>// 設定點選下一首的功能跟動作</pre><pre><strong>@IBAction</strong> <strong>func</strong> nextBtn(<strong>_</strong> sender: UIButton) {</pre><pre>player.pause()</pre><pre>random = Int.random(in: 0…44)</pre><pre>autoplay()</pre><pre>answerLabel.text = “”</pre><pre>answerSingerLabel.text = “”</pre><pre>singerImage.image = UIImage(named: “microphone”)</pre><pre>}</pre><pre><strong>override</strong> <strong>func</strong> didReceiveMemoryWarning() {</pre><pre><strong>super</strong>.didReceiveMemoryWarning()</pre><pre>// Dispose of any resources that can be recreated.</pre><pre>}</pre><pre>}</pre><p>動態呈現</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdOxqsPlH_OU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdOxqsPlH_OU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdOxqsPlH_OU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d1beded7e4455e791ef6a20cc606685/href">https://medium.com/media/6d1beded7e4455e791ef6a20cc606685/href</a></iframe><p><a href="https://github.com/ViviLeevvv528/QA-20201228">ViviLeevvv528/QA-20201228</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b6a1cbbda1f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E7%8C%9C%E7%8C%9C%E6%AD%8C-%E7%B7%B4%E7%BF%92%E5%95%8F%E7%AD%94-%E4%BA%82%E6%95%B8-%E9%9F%B3%E6%A8%82%E6%92%AD%E6%94%BE-%E5%B8%B6%E5%85%A5-airtable-csv-4b6a1cbbda1f">猜猜歌：練習問答/亂數/音樂播放/帶入 Airtable-csv</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>