<?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 T.c. Hung on Medium]]></title>
        <description><![CDATA[Stories by T.c. Hung on Medium]]></description>
        <link>https://medium.com/@tchung?source=rss-304812247f66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*54Uj_ZCplQgYB50WSwRtKg.jpeg</url>
            <title>Stories by T.c. Hung on Medium</title>
            <link>https://medium.com/@tchung?source=rss-304812247f66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:07:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tchung/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[做為 iPlayground 2019 Staff 的簡單回顧]]></title>
            <link>https://medium.com/@tchung/%E5%81%9A%E7%82%BA-iplayground-2019-staff-%E7%9A%84%E7%B0%A1%E5%96%AE%E5%9B%9E%E9%A1%A7-b026381f584d?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/b026381f584d</guid>
            <category><![CDATA[iplayground]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 16:53:41 GMT</pubDate>
            <atom:updated>2019-09-28T01:00:46.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRCJhT4V93qaVtuox_F7aw.png" /></figure><p>這是我第一次參加 iPlayground，去年主要是因為時間的關係，加上是第一屆，想說先觀望看看，所以沒有參與到。但後來能在 Youtube 上看到 session的錄影，即使我沒有買票，這實在是很佛心，感謝講者們無私的分享。</p><h4>為什麼報名工作人員</h4><p>大約在三月的時候吧，看到籌辦團隊在招人，一開始還在猶豫要不要報名，同時間，開始報名抽 WWDC 門票，想說抽抽看，如果抽中就衝了，結果真的抽中了！但我沒有其他認識的開發者會一起過去，感謝當時 <a href="https://twitter.com/ethanhuang13">13</a> 有開了一個要去 WWDC 的群組，可以在這裡找到其他也要去的台灣人。</p><p>這時也看到 13 和 <a href="https://twitter.com/hokilaJ">hokila</a> 也是 iPlayground 的工作人員，會在 WWDC 宣傳 iPlayground，想說那就報名 iPlayground 工作人員看看吧！也可以藉此認識更多開發者，以工作人員的方式參與，又比只當會眾，更有機會有較深的互動，尤其對我這種社交苦手來說，不施加一些壓力的話，就不會逼迫自己去踏出那一步。</p><h4>贊助組</h4><p>報名時，好像選了贊助組和場務組，在第一次實體見面會的時候，知道被分配到了贊助組，也認識了部分的工作人員，在之後就主要在 slack 與定期的線上會議討論。</p><p>而贊助組要做些什麼，可以看<a href="https://medium.com/@joe_chen_25/%E5%9C%A8%E8%B4%8A%E5%8A%A9%E7%B5%84%E6%89%93%E4%BA%86%E5%85%A9%E5%B9%B4%E9%86%AC%E6%B2%B9%E7%9A%84%E6%88%91-ae1b1e19530e">這篇</a>，基本上，一開始會先準備好贊助企劃書，然後開始找贊助商，看看有沒有其他疑問，需要進一步的面談或電訪，在確定贊助意願後，保持聯繫以提供活動前須知，以及索取活動所需的資料、素材，今年因為有國外贊助商的關係，有些資料要準備英文版，到了活動當天，當贊助商的小天使，可是我要懺悔，在活動當天，跟贊助商互動方面，都是靠組長們和其他組員 cover，特別感謝贊助組的大家：喬喬、涵宇、Tank、Bob，有你們真好。</p><p>籌備期間，slack 每一個 channel 都是可以加入的，所以也可以看到其他組別在做什麼，有時也會需要和其他組溝通，每個人都貢獻出自己的能力與專業知識，大家在工作之餘，還能一起把這樣大型的活動辦起來，實在很厲害，也很令人感動。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*okuab8JFkchFRWlCH3Ik5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nrbIrYD5s72s3jnOUhh21Q.jpeg" /><figcaption>iPlayground 2019 贊助組與贊助商們</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XmQe0S6_9rUstQaPmY8Mg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaaX33-LTHkpV3voyZ2vXw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSXVfNHkk7eBEUMH24a1Cw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhjwXcKkFebrBPoIyFOUTw.jpeg" /><figcaption>iPlayground photos</figcaption></figure><h4>總結</h4><p>回顧初衷是認識新朋友、建立人際關係，以結果來看，還有很大的進步空間，但如果一開始沒有踏出那一步，走出自己的舒適圈，以我來說，應該會成長得更加緩慢吧，就像沒有被要求寫心得文，也不會逼自己主動去整理、回顧這將近半年做的事，也因為踏出那一步，才會再審視自己的不足，進而想辦法去改進。</p><p>最後，這段時間對我來說，除了少部分時間因為個性內向，而感到焦慮外，大部分都是感到新鮮、愉快的，也記得一開始喬喬對大家說的，在這期間，最重要的事，就是讓自己保持愉快的，開心地做事，能做到如此，也是因為大家都很罩，像是涵宇的熱情，帶著我們認識贊助商、對我們打氣與指導，Tank 坦下許多困難的任務，與擔任首席外交官，Bob 主動協助許多事，並同為社交苦手的同溫層，能互相鼓勵，忍不住再次感謝大家&lt;(_ _)&gt; We are a team!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaX10qiIeOXSRm9kShH2WA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b026381f584d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift — map & flatMap]]></title>
            <link>https://medium.com/swift-x-techenghung/swift-map-flatmap-a11df7ef91f9?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/a11df7ef91f9</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Wed, 23 Aug 2017 10:35:53 GMT</pubDate>
            <atom:updated>2017-08-23T10:35:53.230Z</atom:updated>
            <content:encoded><![CDATA[<p>關於 map &amp; flatMap 把網路上的一些資源做重點整理</p><blockquote>Reference :</blockquote><blockquote>Swift 燒腦體操：<a href="http://www.infoq.com/cn/articles/swift-brain-gym-map-and-flatmap">http://www.infoq.com/cn/articles/swift-brain-gym-map-and-flatmap</a></blockquote><blockquote>應用範例：<a href="http://blog.xebia.com/the-power-of-map-and-flatmap-of-swift-optionals/">http://blog.xebia.com/the-power-of-map-and-flatmap-of-swift-optionals/</a></blockquote><blockquote>Monad &amp; Functor 圖解：<a href="http://www.ruanyifeng.com/blog/2015/07/monad.html">http://www.ruanyifeng.com/blog/2015/07/monad.html</a></blockquote><p><strong>Array 有一種map函數，兩種flatMap函數：</strong></p><p>當map的閉包返回值，不是Sequence type時，和flatMap的差異就僅在於是否判斷結果為nil。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEh4X6jBVgvNtThCRGSM7g.png" /><figcaption>圖片來源：Sai Li @ Swift Taipei</figcaption></figure><p><strong>Optional 有一種map函數，一種flatMap函數：</strong></p><p>兩者本質上一樣，提供調用者閉包函數，可返回Optional值，也可以是非Optional值。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0b_9-3RyLPWJ4MnGlvIkw.png" /><figcaption>圖片來源：Sai Li @ Swift Taipei</figcaption></figure><p>Array 和 Optional 的 map 函數都叫一樣的名字，是因為他們都是 <strong>Functor</strong>。</p><p>Array 和 Optional 的 flatMap 函數都叫一樣的名字，是因為他們都是 <strong>Monad</strong>。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Qx_bQda06-wk1tC752T3g.png" /><figcaption>圖片來源：Sai Li @ Swift Taipei</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*761nG8wJLrxPjDbSKNQsFQ.png" /><figcaption>Functor 圖解 — Functor 的函数定義是輸入「未封裝的值」到輸出「未封裝的值」</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*-0YzPJesrSNrTwSALrMnBw.png" /><figcaption>Monad 圖解 — Functor 的函数定義是輸入「未封裝的值」到輸出「封裝後的值」</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a11df7ef91f9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/swift-map-flatmap-a11df7ef91f9">Swift — map &amp; flatMap</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ARKit：Tracking, Scene Understanding, Rendering]]></title>
            <link>https://medium.com/swift-x-techenghung/arkit-tracking-scene-understanding-rendering-d256cb5a9da4?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/d256cb5a9da4</guid>
            <category><![CDATA[arkit]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Thu, 15 Jun 2017 09:57:25 GMT</pubDate>
            <atom:updated>2017-06-27T14:23:15.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eLWo-Z36OtE-2ZKhvVgaFQ.png" /></figure><p>從ARKit的圖片上，可以發現有三層的結構，分別是<strong>Tracking, Scene Understanding, Rendering</strong></p><h3>1. Tracking</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ei0p5Vgc98WNMIgsY4GoBA.png" /><figcaption>Source: <a href="https://developer.apple.com/videos/play/wwdc2017/602/">https://developer.apple.com/videos/play/wwdc2017/602/</a></figcaption></figure><p>關於<strong>World tracking</strong>，這邊想要提一下<strong>SLAM</strong>(Simultaneous Localization and Mapping)，也就是當iphone來到一個陌生環境時，能同步地，建構出與周遭環境，時間與空間的關係，可以從<a href="http://weibo.com/ttarticle/p/show?id=2309403994589869514382">這篇文章</a>知道更多。</p><p>ARKit即是利用<strong>VIO</strong>(Visual Inertial Odometry)的技術，來建構出虛擬物件與真實環境關係。</p><p>AR技術上，相較於google 的Tango手機，iphone不需要額外的設備(廣角鏡頭＆紅外線感測器)，關於更多<strong>VIO</strong>技術，就要再跟google大神請教。</p><h3>2. Scene UnderStanding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvtMStcjEEVH0iDW-6ZQKg.png" /><figcaption>Source: <a href="https://developer.apple.com/videos/play/wwdc2017/602/">https://developer.apple.com/videos/play/wwdc2017/602/</a></figcaption></figure><p>World Tracking分析並理解，設備目前所處的空間周遭之訊息。</p><p>使用<strong>hit-Test</strong>的方法(見<a href="https://developer.apple.com/documentation/arkit/arhittestresult"><strong>ARHitTestResult</strong></a> class)，可以想像成點擊畫面中的一個點，iphone發出射線，返回關於那個點在真實環境的資訊，找出相機畫面的點，相對於真實世界的位置。</p><p>如果在ARWorldTrackingSessionConfiguration啟用<a href="https://developer.apple.com/documentation/arkit/arworldtrackingsessionconfiguration/2867263-planedetection"><strong>planeDetection</strong></a>，ARKit會偵測相機畫面中的水平面，得到其位置與大小，我們就能把虛擬物件放在真實世界的平面上。</p><p>目前只有<strong>水平面的偵測</strong>，根據<a href="https://stackoverflow.com/a/44424070/7102802">stackflow上的問答</a>，有人在WWDC與Apple工程師對談中得知，<strong>垂直面的偵測</strong>是未來會增加功能。</p><p><strong>Light Estimation</strong>(環境光預測)，利用相機的感測，調整虛擬物件畫面，使得虛擬物件在相機畫面上，與真實世界相比，不會顯得突出、不自然。</p><h3>3. Rendering</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WES9DRcHRDyXh6VYZo24KA.png" /><figcaption>Source: <a href="https://developer.apple.com/videos/play/wwdc2017/602/">https://developer.apple.com/videos/play/wwdc2017/602/</a></figcaption></figure><p>與官方的SDK <strong>SceneKit, SpiritKit, Metal</strong>整合，呈現3D or 2D虛擬畫面，還有與外部的<strong>Unity, Unreal Engine</strong>合作。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJXvCgXvpR0konP9FJe49g.png" /><figcaption>Source: <a href="https://developer.apple.com/videos/play/wwdc2017/602/">https://developer.apple.com/videos/play/wwdc2017/602/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PscX2HwZDiRn4OY6ZcPjKg.png" /><figcaption>Source: <a href="https://developer.apple.com/videos/play/wwdc2017/602/">https://developer.apple.com/videos/play/wwdc2017/602/</a></figcaption></figure><h3>Best Practices and Limitations</h3><ol><li>不清晰的場景，會降低AR體驗，像是相機對著一面空白的牆，或是太暗的場景。</li></ol><p>2. 移動得太快或距離太遠，也會降低AR體驗。</p><p>3. planeDetection需要一點時間，一開始可能會偵測的不準確，一但偵測完理想的水平面後，最好將planeDetection關掉，避免已設置好的虛擬物件又被更動。</p><p>關於了解AR，可以詳見Apple提供的<a href="http://Understanding Augmented Reality">官方文件</a>。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d256cb5a9da4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/arkit-tracking-scene-understanding-rendering-d256cb5a9da4">ARKit：Tracking, Scene Understanding, Rendering</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ARKit：系統要求 ＆ ARWorldTrackingSessionConfiguration]]></title>
            <link>https://medium.com/swift-x-techenghung/arkit-%E7%B3%BB%E7%B5%B1%E8%A6%81%E6%B1%82-arworldtrackingsessionconfiguration-e011ba6d6541?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/e011ba6d6541</guid>
            <category><![CDATA[arkit]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 08:43:36 GMT</pubDate>
            <atom:updated>2017-09-07T06:59:24.214Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eLWo-Z36OtE-2ZKhvVgaFQ.png" /></figure><h3>Requirements</h3><ul><li>Xcode 9 Beta</li><li>iOS 11 Beta</li><li>A9 or better chip for ARWorldTrackingSessionConfiguration</li><li>若是使用A9 chip以下等級的機種，像是我的iphone6是A8 chip，所以就不符合系統要求，但Apple替我們開了一扇窗，提供了跛腳的AR體驗(ARSessionConfiguration)：</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7pVVWirhB_BqdftDGLvpA.png" /><figcaption>Source: <a href="https://developer.apple.com/documentation/arkit/building_a_basic_ar_experience">https://developer.apple.com/documentation/arkit/building_a_basic_ar_experience</a></figcaption></figure><h3>ARWorldTrackingSessionConfiguration v.s. ARSessionConfiguration</h3><p>顧名思義，ARWorldTrackingSessionConfiguration相較於ARSessionConfiguration多了WorldTracking的AR體驗，有6個自由度(6DOF)，包含了三軸的旋轉與平移，而ARSessionConfiguration只有3DOF，也就是在原地的三軸的旋轉，沒有平移，如下圖所示：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gazt7wxTvAREsLjkOUuww.png" /><figcaption>Source: <a href="https://developer.apple.com/documentation/arkit/arworldtrackingsessionconfiguration">https://developer.apple.com/documentation/arkit/arworldtrackingsessionconfiguration</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_NrKj0ssxFGNHa2uf6CSQ.png" /><figcaption>Source: <a href="https://developer.apple.com/documentation/arkit/arsessionconfiguration">https://developer.apple.com/documentation/arkit/arsessionconfiguration</a></figcaption></figure><p>開發者可以藉由以下程式碼，對支援ARWorldTrackingSessionConfiguration與否的裝置，進行ARSessionConfiguration的切換：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae677587fa5061024ec8f852a11443c8/href">https://medium.com/media/ae677587fa5061024ec8f852a11443c8/href</a></iframe><p>ARWorldTrackingSessionConfiguration提供了更身歷其境的AR體驗，像是以下Pokemon GO Demo影片</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fffky-kYj7zQ%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dffky-kYj7zQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fffky-kYj7zQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/54f0d8115a43268bed72629146b4bacf/href">https://medium.com/media/54f0d8115a43268bed72629146b4bacf/href</a></iframe><h3><strong>iOS11 beta 1 ARKit bug</strong></h3><p>雖然說Apple替我們開了一扇窗，提供了ARSessionConfiguration使用，但ios11 beta1 有bug，Apple忘記(？)把窗打開了，所以要可能要beta2 後，才能用我的iphone6來玩ARKit了… :(</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-BDQfitvmZrYxSccmrrLQ.png" /><figcaption>Source: <a href="http://www.redmondpie.com/ios-11-beta-1-release-notes-changes-and-known-issues-according-to-apple/">http://www.redmondpie.com/ios-11-beta-1-release-notes-changes-and-known-issues-according-to-apple/</a></figcaption></figure><p><em>2017.07.11 (update)</em></p><p><em>ios 11 beta 3 改版後，ARSessionConfiguration終於可以給A9 chip以下的機種使用囉！</em></p><p><em>另外，測試我的iphone6居然也能跑ARWorldTrackingSessionConfiguration！</em></p><p><em>2017.09.07 (update)</em></p><p><em>一陣子沒run ARKit的東西，發現似乎在iOS 11 beta5之後，iphone6就不能跑ARWorldTrackingConfiguration了… :(</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e011ba6d6541" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/arkit-%E7%B3%BB%E7%B5%B1%E8%A6%81%E6%B1%82-arworldtrackingsessionconfiguration-e011ba6d6541">ARKit：系統要求 ＆ ARWorldTrackingSessionConfiguration</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift 3 — Access Control Levels]]></title>
            <link>https://medium.com/swift-x-techenghung/swift-3-access-control-levels-d394b21c1b1a?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/d394b21c1b1a</guid>
            <category><![CDATA[access-control]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Mon, 06 Mar 2017 04:35:39 GMT</pubDate>
            <atom:updated>2017-03-06T04:35:39.325Z</atom:updated>
            <content:encoded><![CDATA[<p>訪問權限的大小依序為：</p><ul><li>open : Can be accessed and subclassed in the same modules &amp; different modules.</li><li>public : Can be accessed and subclassed in the same modules &amp; can be accessed (but not subclassed) in different modules.</li><li>internal(Default) : symbol visible within the current module.</li><li>fileprivate : symbol visible within the current file.</li><li>private : symbol visible within the current declaration.</li></ul><p>*什麼是module? swift檔案內，程式碼前面加”import”的，就是表示，來自於另一個module。</p><blockquote>A module is a single unit of code distribution — a framework or application that is built and shipped as a single unit and that can be imported by another module with Swift’s import keyword.</blockquote><p>Ref :</p><p>Apple doc.</p><p><a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html">The Swift Programming Language (Swift 3.0.1): Declarations</a></p><p>Swift 3必看：新的访问控制fileprivate和open</p><p><a href="http://www.jianshu.com/p/604305a61e57">Swift 3必看：新的访问控制fileprivate和open</a></p><p>The Complete Understanding of Access Control in Swift 3</p><p><a href="https://medium.com/ios-geek-community/the-complete-understanding-of-access-control-in-swift-3-c1c71f2add0b">The Complete Understanding of Access Control in Swift 3</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d394b21c1b1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/swift-3-access-control-levels-d394b21c1b1a">Swift 3 — Access Control Levels</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift 3 — Adaptive TableViewCell with CollectionView]]></title>
            <link>https://medium.com/swift-x-techenghung/swift-3-adaptive-tableviewcell-with-collectionview-67771ab05fed?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/67771ab05fed</guid>
            <category><![CDATA[adaptive-tableviewcell]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Tue, 21 Feb 2017 10:17:34 GMT</pubDate>
            <atom:updated>2017-02-21T10:17:34.174Z</atom:updated>
            <content:encoded><![CDATA[<p>此次實作想做出以下效果：</p><ol><li>在TableViewController下，實作不同的Dynamic Prototype Cells</li><li>Adaptive TableView Cell Height : 自適應的欄高</li><li>把CollectionView包在TableViewCell內，並同時也具有 Adaptive TableView Cell Height</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*YphDGkzYT_ftVhHFACcZEQ.png" /></figure><p>實作：</p><ol><li>利用不同的Identifier，包在if…else內，回傳cell</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/249d712c4eb1118ca74b7b9d98a2eff1/href">https://medium.com/media/249d712c4eb1118ca74b7b9d98a2eff1/href</a></iframe><p>2. Adaptive TableView Cell Height : 注意：Label的constrains要設定，Lines 1改為0</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1978d12919dccb183db78c7f4582a20/href">https://medium.com/media/a1978d12919dccb183db78c7f4582a20/href</a></iframe><p>3. 因為CollectionView的ContentSize是後來才知道的，所以利用一個變數，取得CollectionView的ContentSize之後，再到heightForRowAt更改TableView的Row height</p><p>Reference :</p><p><a href="http://stackoverflow.com/a/41342083/7102802">UICollectionView Dynamic Height</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8f7e585ce651fa40e95542ea3106899/href">https://medium.com/media/c8f7e585ce651fa40e95542ea3106899/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67771ab05fed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/swift-3-adaptive-tableviewcell-with-collectionview-67771ab05fed">Swift 3 — Adaptive TableViewCell with CollectionView</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift 3 — iOS Charts API]]></title>
            <link>https://medium.com/swift-x-techenghung/swift-3-ios-charts-api-1653d13d3359?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/1653d13d3359</guid>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Sat, 18 Feb 2017 10:21:54 GMT</pubDate>
            <atom:updated>2017-02-18T10:21:54.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPxC6XgmhLbncybvNAUiSQ.png" /></figure><ul><li>Charts API github : <a href="https://github.com/danielgindi/Charts">https://github.com/danielgindi/Charts</a></li><li>主要參考教學：<a href="http://www.appcoda.com.tw/ios-charts-api-tutorial/">http://www.appcoda.com.tw/ios-charts-api-tutorial/</a>，但此份教學是用之前的版本所寫的，所以部分語法與需要更新。</li><li>如果在Swift3、Charts 3.0、Xcode8的環境下，可參考：<a href="https://medium.com/@skoli/using-realm-and-charts-with-swift-3-in-ios-10-40c42e3838c0#.n8ffy5nkx">https://medium.com/@skoli/using-realm-and-charts-with-swift-3-in-ios-10-40c42e3838c0#.n8ffy5nkx</a></li><li>實作過程遇到的問題：</li></ul><ol><li>版本更新後，如何輸出X Axis的值：</li></ol><ul><li>How to Modify X Axis values Swift? : <a href="https://github.com/danielgindi/Charts/issues/1340">https://github.com/danielgindi/Charts/issues/1340</a></li><li>需要另外建立一個新的class for IAxisValueFormatter</li></ul><p>2. 輸出X Axis的值之後，目前bar chart只顯示出單數的值</p><p>3. pie chart沒有XAxis的屬性</p><p>4. 發生小插曲:Could not cast value of type ‘Charts.LineChartData’ (0x10f044920) to ‘Charts.PieChartData’ (0x10f0476c8). 因為在拉Outlet時，把名稱取相反造成Crash。</p><p>此次實作的連結：</p><p><a href="https://github.com/dan12411/iOSChartsDemo">GitHub - dan12411/iOSChartsDemo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1653d13d3359" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/swift-3-ios-charts-api-1653d13d3359">Swift 3 — iOS Charts API</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[最近要把一個專案從Swift 2.3轉到Swift 3.0，把遇到的一些 compile error 訊息整理如下：]]></title>
            <link>https://medium.com/swift-x-techenghung/%E6%9C%80%E8%BF%91%E8%A6%81%E6%8A%8A%E4%B8%80%E5%80%8B%E5%B0%88%E6%A1%88%E5%BE%9Eswift-2-3%E8%BD%89%E5%88%B0swift-3-0-%E6%8A%8A%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%BA%9B-compile-error-%E8%A8%8A%E6%81%AF%E6%95%B4%E7%90%86%E5%A6%82%E4%B8%8B-866eb5e89bbc?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/866eb5e89bbc</guid>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift-3]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Sat, 18 Feb 2017 05:06:03 GMT</pubDate>
            <atom:updated>2017-02-18T05:06:03.749Z</atom:updated>
            <content:encoded><![CDATA[<p>最近要把一個專案從Swift 2.3轉到Swift 3.0，把遇到的一些 compile error 訊息整理如下：</p><p>1. 先利用Xcode提供的轉換工具：<strong>Edit/Convert/To Current Swift Syntax…</strong>把系統會自動轉換的，都轉到最新的語法</p><p>2. ‘NSLog’ is unavailable: Variadic function is unavailable in swift :</p><ul><li>http://stackoverflow.com/questions/39827155/nslog-is-unavailable-variadic-function-is-unavailable-in-swift</li><li><a href="http://stackoverflow.com/questions/39989081/issue-with-nslog-with-swift-3">http://stackoverflow.com/questions/39989081/issue-with-nslog-with-swift-3</a></li><li>Write <strong>saveError as NSError</strong>to get an Objective-C style object. Or use “print&quot;</li></ul><p>3. Type ‘Any’ has no subscript members</p><ul><li>Change <strong>Any to [String:Any]</strong></li></ul><p>4. Cannot convert value of type ‘String?’ to expected argument type ‘NSString’ :</p><ul><li><a href="http://stackoverflow.com/questions/33948723/cannot-convert-value-of-type-nsstring-to-expected-argument-type-string">http://stackoverflow.com/questions/33948723/cannot-convert-value-of-type-nsstring-to-expected-argument-type-string</a></li><li>Use “as NSString”</li></ul><p>5. No ‘/’ candidates produce the expected contextual result type ‘NSNumber’ :</p><ul><li><a href="http://stackoverflow.com/questions/39517756/no-candidates-produce-the-expected-contextual-result-type-nsnumber">http://stackoverflow.com/questions/39517756/no-candidates-produce-the-expected-contextual-result-type-nsnumber</a></li><li>(As is) Double(correctGuesses) / Double(totalGuesses</li><li>(To be) <strong>NSNumber(value: </strong>Double(correctGuesses) / Double(totalGuesses)<strong>)</strong></li></ul><p>6. Cannot convert value of type ‘NSFetchRequest&lt;_&gt;’ :</p><ul><li>delete “: NSFetchRequest”, add <strong>&lt;NSFetchRequestResult&gt;</strong></li><li><a href="http://stackoverflow.com/questions/39503915/nsfetchrequest-core-data-swift-3-backward-compatibility">http://stackoverflow.com/questions/39503915/nsfetchrequest-core-data-swift-3-backward-compatibility</a></li></ul><p>7. Empty collection literal requires an explicit type :</p><ul><li><a href="http://stackoverflow.com/questions/39489211/empty-collection-literal-requires-an-explicit-type-error-on-swift3">http://stackoverflow.com/questions/39489211/empty-collection-literal-requires-an-explicit-type-error-on-swift3</a></li><li>var dict = [:] , add “<strong>as NSMutableDictionary</strong>”</li></ul><p>8. ‘(anyobject)’ is not a subtype of ‘nsobject’ :</p><ul><li><a href="http://stackoverflow.com/questions/41298183/compilation-error-in-swift3-anyobject-is-not-a-subtype-of-nsobject">http://stackoverflow.com/questions/41298183/compilation-error-in-swift3-anyobject-is-not-a-subtype-of-nsobject</a></li><li>Use “<strong>as! NSDictionary</strong>”</li></ul><p>9. CANNOT INVOKE INITIALIZER FOR TYPE ‘INT’ WITH AN ARGUMENT LIST OF TYPE ‘(QOS_CLASS_T)’ :</p><ul><li><a href="http://www.wadecantley.com/lifeblog/2016/10/4/migrating-code-to-swift-30-xcode-8">http://www.wadecantley.com/lifeblog/2016/10/4/migrating-code-to-swift-30-xcode-8</a></li><li>return DispatchQueue.global(qos: DispatchQoS.QoSClass.userInitiated)</li><li>Change to “<strong>(qos: DispatchQoS.QoSClass.userInitiated)</strong>”</li></ul><p>10. ‘isnan’ is unavailable: use the isNaN property :</p><ul><li><a href="https://github.com/tristanhimmelman/HidingNavigationBar/issues/48">https://github.com/tristanhimmelman/HidingNavigationBar/issues/48</a></li><li>change this line from “ if isnan(previousYOffset) == false “ to “ <strong>if previousYOffset.isNaN == false</strong> “</li></ul><p>11. cannot subscript a value of type ‘inout mkannotation ‘ :</p><ul><li>casting “as [AnyObject]”</li></ul><p>12. type of expression is ambiguous without more context :</p><ul><li>casting “as NSString”</li></ul><p>13. weak may only be applied to class and class-bound protocol types :</p><ul><li>weak var date: Date?, delete “weak”</li></ul><p>14. cannot call value of non-function type :</p><ul><li>delete “: NSSet”</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=866eb5e89bbc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/%E6%9C%80%E8%BF%91%E8%A6%81%E6%8A%8A%E4%B8%80%E5%80%8B%E5%B0%88%E6%A1%88%E5%BE%9Eswift-2-3%E8%BD%89%E5%88%B0swift-3-0-%E6%8A%8A%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%BA%9B-compile-error-%E8%A8%8A%E6%81%AF%E6%95%B4%E7%90%86%E5%A6%82%E4%B8%8B-866eb5e89bbc">最近要把一個專案從Swift 2.3轉到Swift 3.0，把遇到的一些 compile error 訊息整理如下：</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Codility — Iterations]]></title>
            <link>https://medium.com/swift-x-techenghung/codility-iterations-b07767c2cd66?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/b07767c2cd66</guid>
            <category><![CDATA[iteration]]></category>
            <category><![CDATA[binarygap]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[codility]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Fri, 06 Jan 2017 09:01:34 GMT</pubDate>
            <atom:updated>2017-01-06T12:13:36.284Z</atom:updated>
            <content:encoded><![CDATA[<h3>Codility — Iterations</h3><p><strong>(1) for-in loop</strong></p><blockquote>repeat some operations a given number of times, or repeat them for each element in some collection.</blockquote><p><strong>(2) while loop</strong></p><blockquote>the number of steps is not known in advance, or the values over which we loop are generated one by one.</blockquote><p><strong>(3) repeat-while loop</strong></p><blockquote>與 while loop 差異在，repeat-while loop會先執行一次，再檢查條件表達式。</blockquote><p><strong>Task — BinaryGap</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da1af5d7cdf28e2e3c1f67c8521b100f/href">https://medium.com/media/da1af5d7cdf28e2e3c1f67c8521b100f/href</a></iframe><p>More — Convert between Decimal, Binary and Hexadecimal in Swift</p><p><a href="http://stackoverflow.com/questions/36966442/convert-between-decimal-binary-and-hexadecimal-in-swift">http://stackoverflow.com/questions/36966442/convert-between-decimal-binary-and-hexadecimal-in-swift</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b07767c2cd66" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/codility-iterations-b07767c2cd66">Codility — Iterations</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ScrollView : contentOffset of Scroll View, Scroll View內放大縮小, 分頁效果]]></title>
            <link>https://medium.com/swift-x-techenghung/scrollview-contentoffset-of-scroll-view-scroll-view%E5%85%A7%E6%94%BE%E5%A4%A7%E7%B8%AE%E5%B0%8F-%E5%88%86%E9%A0%81%E6%95%88%E6%9E%9C-5f4bc13fd375?source=rss-304812247f66------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f4bc13fd375</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[pages]]></category>
            <category><![CDATA[scrollview]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[T.c. Hung]]></dc:creator>
            <pubDate>Fri, 06 Jan 2017 06:48:57 GMT</pubDate>
            <atom:updated>2017-01-06T06:48:57.522Z</atom:updated>
            <content:encoded><![CDATA[<p>Presenter : Peter Pan</p><p><strong>Scroll View</strong></p><ol><li>contentOffset：設定Scroll View捲動的位置，以下例子利用分段動畫＆contentOffset完成。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*HSVwIcMoywM4aPxYvs5CBQ.gif" /></figure><pre>// Scroll View內的動畫</pre><pre>UIView.animateKeyframes(withDuration: 20, delay: 0, options: .calculationModeLinear, animations: {</pre><pre>UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.25, animations: {</pre><pre>self.MyScroll.contentOffset = CGPoint(x: 500, y: 250)</pre><pre>})</pre><pre>UIView.addKeyframe(withRelativeStartTime: 0.25, relativeDuration: 0.25, animations: {</pre><pre>self.MyScroll.contentOffset = CGPoint(x: 100, y: 250)</pre><pre>})</pre><pre>UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.25, animations: {</pre><pre>self.MyScroll.contentOffset = CGPoint(x: 100, y: 0)</pre><pre>})</pre><pre>UIView.addKeyframe(withRelativeStartTime: 0.75, relativeDuration: 0.25, animations: {</pre><pre>self.MyScroll.contentOffset = CGPoint(x: 0, y: 0)</pre><pre>})</pre><pre>}, completion: nil)</pre><p>2. 放大縮小 : 利用以下程式碼 &amp; 設定Scroll View inspector 內的 Zoom，<strong>記得拉delegate</strong></p><p>在模擬器中，按著option，可模擬兩指做放大縮小的動作！</p><pre>// 兩指放大縮小Scroll內的元件(ex. image)<br>func viewForZooming(in scrollView: UIScrollView) -&gt; UIView? {</pre><pre>return MyImage</pre><pre>}</pre><p>zoomToRect : 局部放大</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*7bAvw3_9w3AzCLpZaqTmug.gif" /></figure><pre>// 設定放大的時間、位置、範圍<br>@IBAction func zoomToRect(_ sender: Any) {</pre><pre>UIView.animate(withDuration: 5, animations: {</pre><pre>self.MyScroll.zoom(to: CGRect(x: 100, y: 100, width: 100, height: 100), animated: false)</pre><pre>})</pre><pre>}</pre><p>3. Page(分頁效果)</p><p>可以用Scroll View來做到分頁效果，但可以有兩種做法，一種是一開始就把所有圖片，一次載入；另一種是只載入部分頁面(像是目前頁面 &amp; 上/下一頁)。</p><p>雖然第一種，比較簡單，但相對地，比較浪費資源，而第二種的話，要去計算，現在處於哪個page，然後去處理載入或移除哪些頁面。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*6DOEZv8kAnhkRPzvOSD4pw.gif" /><figcaption>Page View Demo</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f4bc13fd375" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-x-techenghung/scrollview-contentoffset-of-scroll-view-scroll-view%E5%85%A7%E6%94%BE%E5%A4%A7%E7%B8%AE%E5%B0%8F-%E5%88%86%E9%A0%81%E6%95%88%E6%9E%9C-5f4bc13fd375">ScrollView : contentOffset of Scroll View, Scroll View內放大縮小, 分頁效果</a> was originally published in <a href="https://medium.com/swift-x-techenghung">Swift X TeChengHung</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>