<?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 Jack Ngai on Medium]]></title>
        <description><![CDATA[Stories by Jack Ngai on Medium]]></description>
        <link>https://medium.com/@jackngai?source=rss-ce1b67025aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Jack Ngai on Medium</title>
            <link>https://medium.com/@jackngai?source=rss-ce1b67025aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:34:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jackngai/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[Cinder Precision Grill Review]]></title>
            <link>https://medium.com/@jackngai/cinder-precision-grill-review-1eb48c65c5f1?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eb48c65c5f1</guid>
            <category><![CDATA[unique-kitchen-gadgets]]></category>
            <category><![CDATA[gadgets]]></category>
            <category><![CDATA[cooking]]></category>
            <category><![CDATA[sous-vide]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Mon, 25 Sep 2017 20:42:27 GMT</pubDate>
            <atom:updated>2017-09-28T18:06:13.511Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0esK0Ig1ylmIyJgNyliC9Q.png" /><figcaption>Image from their press kit, I was too lazy to upload my own photo</figcaption></figure><p>*** 9/28/2017 — Updated to include info about the searing function for the Cinder Precision Grill ***</p><p>I have been using the Anova Bluetooth Precision Cooker for a few years now and I love sous-vide cooking with that device. But I was looking for something that will cut down the steps and the cook time. That’s when I found the Cinder Precision Grill.</p><p>Let’s take a step back and let me explain sous-vide. Sous-vide literally is french for “under vacuum”. Sous-vide cooking is using vacuum sealed (or Ziploc bags with the water displacement method) bags to cook food in a water bath at a constant temperature. The idea is to cook the food at the exact temperature that we want to serve it (ex: medium rare steak at 135 degrees). Normal cooking methods, whether in a skillet or an oven, blasts the food at 350 degrees or higher hoping to get the center of the food to the serving temperature while turning the outside into a burnt crisp. By cooking with sous-vide, your food will cook to the perfect temperature, retaining much more of the moisture in it, and the texture is exactly the same on the outside as the inside.</p><p>So that’s the benefit of sous-vide, here are the downsides:</p><ol><li>It takes hours to cook something, because of the lower temperature.</li><li>It doesn’t give the added flavor that searing does, so you will need to sear separately in a skillet after cooking in sous-vide.</li><li>You have extra utensils to clean up (the sous-vide device itself, the pot for the water to cook, even if it’s just rinsing it).</li></ol><p>The Cinder is kind of a like George Foreman Grill with a brain in it. It senses the temperature between the grill plates and cooks the food at the specified temperature and holds the temperature by surrounding the plates with a thick metallic skirt. I have the Cinder for nearly six months now. I can say it solves all the downsides listed above, but I’m still keeping my Anova. Let me explain why.</p><p>When I received the Cinder in the mail, I couldn’t believe how big it is. The size of the box is roughly the same as an old desktop size PC. It weighted as much too, if not a bit heavier. I had a George Foreman Grill over 10 years ago and this is 4x larger and 10x heavier. As soon as I placed it on my counter, I knew it is a permanent installation, unlike the Anova, which I put back in its original packaging when I done using it.</p><p>But as big as the Cinder is, it’s cooking area is still small. I can easily fit 2 or 3 ribeye steaks in its grill plates, but when I tried to fit 1 pound of thinly sliced chicken breasts, I had to use a sheet of aluminum foil to separate and stack them. This trick works but it shows that the Cinder isn’t made for cooking for more than 4 people. I had no problem cooking 60 chicken wings with the Anova as I just needed to use a much bigger pot. The Cinder might be good for everyday cooking, but you won’t be using it for parties (well, maybe for melting chocolate for chocolate dipped strawberries, but definitely not entree type food that will serve a large group).</p><p>I finally used Cinder to seared salmon yesterday (9/27/17), mainly because I wrote in this review that I never seared anything on it and it got me curious. I have to say it was an eye-opening experience. As I wrote in the original review, I have been trained to sear any food that I sous-vide as the food just looks unattractive (steaks looks gray, chicken looks rubbery) and lacks the extra grill flavor without searing. I also wrote it would be slower to wait until the grilling plates on the Cinder to cool down, wipe clean, then start the process to heat up the plates for grilling temperature than to grill on a skillet. I was so wrong. You don’t have to wait for the plates to cool down. It cooked the salmon to 140+ degrees, so the plates are hot, but they are not even as hot as boiling water. So I just grab a sheet of paper towel, damped it with water and wiped down the hot plates once I removed the salmon, being careful not to touch the plates. As soon as that’s done, I spin the dial on the Cinder to sear, and it took less than 5 minutes to get to searing temperature. I dropped the salmon back in, and 45 seconds later, done! The best part is since it seared salmon on both sides, I don’t have to flip it like I do on a skillet. Also, because I didn’t use any additional oil (even though you are suppose to), the salmon skin was seared perfectly. I have never been able to do that on a skillet or with a blowtorch. As an added touch, when I turned the Cinder off, it told me it is cooling the grill plates with its built-in fan. That’s just neat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H56SSeLDrsWpwWa-dkNStA.jpeg" /><figcaption>Another picture from their press kit, but that’s how my dinner looked last night</figcaption></figure><p>Now that you know how fast it sears food, let’s go back and talk about how fast it cooks it. The Cinder beats the Anova hands-down, probably by a factor of 2. Normally, you fill a pot with room water temperature and heat it using the heating elements in the Anova. You can start cooking when the water reaches cooking temperature. That can take anywhere from 15 to 30 minutes, depending on the size of the pot and the temperature. I usually cheat by heating the pot on a stove to near boiling, risking slightly overcooking the food on the outside, but since I sear anyway I don’t notice any difference. But even cheating by heating the water ahead, I normally have to start cooking before 4 PM if I want to have dinner ready by 7 PM. With the Cinder, I can start around 5:30 PM and still be able to have dinner ready by 7 PM, as long as the food is not from the freezer. It’s awesome that Cinder includes the option to handle frozen food in their app, but it is so bare-bones at this point, it isn’t pretty to look at compared to Anova’s. I can’t wait for them to update their app, but the current version is stable and functional.</p><p>So is the Cinder for everyone? No. At it’s current price point of $499, it is way too expensive compared to other sous-vide devices that retail for $149 or much, much less. But if you like playing with new gadgets, have the money to spend, and want sous-vide type food at 1/2 the cooking time, the Cinder might be for you. Just note that you can’t soft boil eggs with it and it’s not readily available as Cinder isn’t mass produced on the same scale as Anova or other sous-vide devices. It is currently on Indiegogo and ships by December 2017 (although, like any hardware on crowdfunded sites, they might not hit that ship date).</p><p>Rating: 4.25 out of 5 stars (added .25 as it does a marvelous job searing food)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eb48c65c5f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift — Creating a view without storyboard]]></title>
            <link>https://medium.com/@jackngai/swift-creating-a-view-without-storyboard-65bfc21e4124?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/65bfc21e4124</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift-3]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Fri, 28 Jul 2017 03:40:06 GMT</pubDate>
            <atom:updated>2017-07-28T03:40:06.232Z</atom:updated>
            <content:encoded><![CDATA[<p>I know it is easy to build a single view application with storyboard. Xcode practically sets up everything for you. I will let you google the reasons why you should stop using storyboard. I’m just going to show you how to set one up to match what Apple creates for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*ZUR-neOf5L-PpUMd33JCDw.png" /><figcaption>You don’t need this.</figcaption></figure><p>After creating the project, go into Project-&gt;Targets-&gt;Deployment Info, delete the word “Main” from Main Interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nq0r3hRVPC3QAb5sMXGTQA.png" /><figcaption>Press ⌘ + 1 if you don’t see the Project Navigator for step 1.</figcaption></figure><p>Next, delete Main.storyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*bhAp95jtnrbnj4drdNiDQg.png" /><figcaption>Sayonara!</figcaption></figure><p>Now, you need add the code to draw the window, make it key and visible, and set ViewController.swift as the root view controller in AppDelegate.swift to create the view. This is the code:</p><p>window = UIWindow(frame: UIScreen.main.bounds)</p><p>window?.makeKeyAndVisible()</p><p>window?.rootViewController = ViewController()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*0mqLah2myvSuL_Eayh9GNA.png" /><figcaption>There are Windows on Apple.</figcaption></figure><p>Feel free to read up on <a href="https://developer.apple.com/documentation/uikit/uiwindow">Apple’s documentation on UIWindow</a> to learn about the methods used in the code.</p><p>Now, go to ViewController.swift and change the background to white so it matches what Apple gave you in storyboard.</p><p>view.backgroundColor = .white</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*lBA_Ri46xu-PVOYPvSdyWA.png" /><figcaption>Don’t like white? Change it to your favorite (ui)color</figcaption></figure><p>At this point, you are done. If you run the app now, you will have a blank white screen in the simulator, exactly the same thing Apple provides you with storyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*DtgQ1cGmwEvKPrZhyBPxNQ.png" /><figcaption>carte blanche</figcaption></figure><p>But you ask, how do I add buttons, text fields, image views? All programmatically. I won’t cover all that in this post, but here’s a small snippet of code to show you how to add a text field in ViewController.swift.</p><p>// In ViewController class, outside of any methods</p><p>let textField = UITextField(frame: CGRect(x: 0, y: 10, width: 200, height: 40))</p><p>// In ViewDidLoad() method</p><p>textField.text = “Hello World”</p><p>view.addSubview(textField)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*hKXuK2j1tAgMaNV1PXYZ3w.png" /><figcaption>3 lines of code to create and display a text field</figcaption></figure><p>This is how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*uQf5aEgG2zc9IpizBT536w.png" /><figcaption>Simple, right?</figcaption></figure><p>That’s it. Of course there’s a lot more to it: Using layout anchors to set constraint; Changing the font type, font size and color; Adding targets. The list goes on. But this is a good start.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65bfc21e4124" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Firebase — iOS Swift Codelab]]></title>
            <link>https://medium.com/@jackngai/learning-firebase-ios-swift-codelab-7db4ccd4bd16?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7db4ccd4bd16</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 20:25:55 GMT</pubDate>
            <atom:updated>2017-07-19T20:25:55.791Z</atom:updated>
            <content:encoded><![CDATA[<p>I just ran through this <a href="https://codelabs.developers.google.com/codelabs/firebase-ios-swift">codelab</a>. It teaches you how to create a basic chat app in iOS and shows you everything that Firebase is able to do (realtime database, storage, ads, analytics, crash logging, to name a few). I love that you get a complete overview of everything you can do with Firebase. The downside is you just end up copy-pasting all their code and the timer on the top right corner indicating how much time remaining is only accurate based on how fast you can copy and paste. If you try to read through the code and understand it, it will take a lot longer than the 34 minutes that they have listed in the first page.</p><p>I guess it’s starting point, it all comes back down to reading the documentation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7db4ccd4bd16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — A new journey begins]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-a-new-journey-begins-9ed36915b26b?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ed36915b26b</guid>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Fri, 13 Jan 2017 21:15:27 GMT</pubDate>
            <atom:updated>2017-04-10T02:33:55.119Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes! I finally got my iOS Developer Nanodegree from Udacity. It was tougher than I expected, but I’m really happy at accomplishing this goal. While I wish I can sit back and relax, this is just the beginning. Instead of focusing singularly on the Nanodegree, I now have to focus on these three goals:</p><ol><li>Getting my first app published in the App Store</li><li>Start my career as an iOS Developer (AKA find a job)</li><li>Continue learning to use new libraries and frameworks in Swift</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eX6zGtCo1DHEvgfFJvSySQ.jpeg" /></figure><p>I climbed my first mountain. Off to the next. Game on!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ed36915b26b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 166]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-166-f61d0aa00f5?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f61d0aa00f5</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[core-data]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Tue, 13 Dec 2016 17:35:09 GMT</pubDate>
            <atom:updated>2016-12-13T17:35:09.935Z</atom:updated>
            <content:encoded><![CDATA[<p>Sorry for dropping off from this for exactly 100 days. I didn’t mean to drop off for exactly 100 days, but it took me roughly that long to finish all the projects I had left in my Udacity iOS Developer Nanodegree. Right now, I still have the Career Development projects in order to graduate with my Nanodegree Plus. I expect to finish them before the end of the year but it is also all the time I have left to get my Nanodegree (unless Udacity offers extensions). Anyway, let’s me take a step back and explain what I learned the last 100 days.</p><p>The On The Map project is all about learning how to communicate with server side API’s to get data on to an iOS device. It was pretty hard as you have to authenticate (login with a username/password) and then “translate” the data from JSON into arrays or dictionaries. The hardest concept is the asynchronous nature of this process. You really don’t know when and how long it takes for the server to respond and provide you the data. You might also be sending multiple requests to the server and it is quite likely you will receive responses that were not in the order you sent them, so you have to use completion handlers to keep them in order. On top of that, you have to perform all of this in a background queue so that the UI is not frozen while you are waiting for the data from the server.</p><p>The project after was Virtual Tourist. This project builds on what I already learned in On The Map by adding Core Data, a way to store databases worth of data on an iOS device. This was really tricky and I had a really hard time with this one as that’s when I decided to switch to Swift 3. None of the course materials (which were in Swift 2.2) helped as Apple made so much changes to Core Data that I felt like I was completely lost. I scoured every resource on the internet to find a complete tutorial for Core Data in Swift 3 and ended up getting the Ray Wenderlich team’s Core Data for Swift 3 book. The way the RW team teaches is by example, so it is really easy to see how things work. The downside (and I experienced this way back when I went through a few of their iOS tutorials last year) is that they give away too much of the answer and you don’t learn as much as you can when you figure things out on your own. But this book was perfect for me at that moment as it clarified all the changes Apple made to Core Data and I was able to plow along.</p><p>The hardest concept for Core Data was concurrency. This is what happens when you have multiple items trying to access (either write or read) to the database in Core Data at the same time? If you don’t have it setup properly, you are more than likely to get a random crash. I still don’t quite have a good concept of this but I know that every time I use Core Data, I add the extra argument to debug concurrency issues and try to perform every Core Data task within context. That last part probably doesn’t make much sense if you don’t use Core Data, but I’m not knowledgeable enough to thoroughly explain the topic (I can probably explain it better if I had a gun pointed to my head, but I much prefer you read this <a href="https://medium.com/bpxl-craft/some-lessons-learned-on-core-data-5f095ecb1882">post</a> instead).</p><p>So that brings me to the final project. No more learning. It is all about using everything I learned and putting it together in an app on my own. Well, the no more learning part is not true. I actually ended up learning a lot because I ended up using a lot of things not taught in class (NSFetchedResultsController, UISegmentedControl, UIStepper, UIPickerView) when I was putting together my app. I will probably go over my app in another post, as I really should continue working on the Career Development portion of my Nanodegree as it is a requirement as I signed up for the Nanodegree Plus. At this point, I’m happy I’m close to the end of this journey and I will put up one more post to let everyone know if I complete my Nanodegree.</p><p>P.S. Just an update on the Apple Watch Auto Unlock feature, it turns out I was on a beta version of WatchOS 3, and the Auto Unlock was not working properly with the beta. I’m happy to say Auto Unlock is working now, but at best, it only works around 75% to 85% of the time. This is nowhere near the standard I hold Apple to, although there is another update for my watch. It might improve the Auto Unlock performance, but the hour long (I remember some were as long as 4 hours last year) updates are a pain and that’s something Apple should really work on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f61d0aa00f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 66]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-66-896dbd4719f9?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/896dbd4719f9</guid>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[cocoapods]]></category>
            <category><![CDATA[macos-sierra]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Wed, 14 Sep 2016 16:34:22 GMT</pubDate>
            <atom:updated>2016-09-14T16:34:22.804Z</atom:updated>
            <content:encoded><![CDATA[<p>It has been a while since I wrote my last post. 21 days to be exact. I haven’t been slacking, well I have for this blog, but not in learning about Swift. I learned about table views and collection views, setting up custom cells in both, and learning to use navigation views and a tab bar controller to access both. That was essentially the MemeMe 2.0 project for the Udacity iOS Nanodegree.</p><p>I then went through the elective course (yes, there’s plenty of elective courses they recommend) on Swift debugging. I knew the basics of using breakpoints and po in LLDB, but I didn’t know how to use stack trace and view hierarchy. I also installed CocoaPods just to install XCGLogger, but then end up also going through this <a href="https://www.raywenderlich.com/97014/use-cocoapods-with-swift">tutorial</a> and installed AlamoFire. I also found out Google started <a href="https://www.youtube.com/watch?v=cvyk5iRymqA">a show</a> last year to teach iOS developers.</p><p>So just a couple of days ago I started the On The Map project from Udacity which teaches networking on iOS. I then took the “red pill” and took another elective on GCD (<a href="https://developer.apple.com/reference/dispatch">Grand Central Dispatch</a>). I vaguely recall race condition and deadlock back in college but this mini course taught me how to solve them (more like prevent them). I’m now back on the On The Map project. I haven’t started any coding for it yet, but really looking forward to.</p><p>P.S. Since I didn’t start any coding for On The Map, I figured I will upgrade to MacOS Sierra just to try out the Auto Unlock feature with my Apple Watch and my 2015 MacBook Air. That was 2 hours down the drain as I can’t get it to work (I’m getting the message “your mac was unable to communicate with your apple watch”). Considering it saves ~30 seconds a day (probably less as this only unlocks your Mac from a sleep state, not from a restart state), when this feature is working for me, it will take me ~240 days using this feature to get that 2 hours back.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=896dbd4719f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 45]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-45-b928658179f4?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b928658179f4</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Wed, 24 Aug 2016 16:51:48 GMT</pubDate>
            <atom:updated>2016-08-24T16:51:48.307Z</atom:updated>
            <content:encoded><![CDATA[<p>Promise this will be much shorter than yesterday’s post. So I tried out UIScrollView to move the view up. Programmatically, it is about the same as using view.frame.origin.y. But it was a pain to setup in Storyboard. I kept on getting the “scrollable content size is ambiguous” message, which I finally solved by adding another view within the scroll view. I ended up with 12 constraints with UIScrollView compared to 5 with the old method. I really don’t see the benefit of using UIScrollView.</p><p>On a related note, I mentioned yesterday maybe someday Apple can setup the OS to handle shifting the view up when a keyboard is shown. It turns out they already did that with UITableView, at least that’s my understanding after reading their documentation. I’m probably wrong or it probably isn’t easy to implement, but I can’t wait to find out more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b928658179f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 44]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-44-2e746583ea2?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e746583ea2</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Tue, 23 Aug 2016 16:35:04 GMT</pubDate>
            <atom:updated>2016-08-23T16:36:35.775Z</atom:updated>
            <content:encoded><![CDATA[<p>I just finished the second project for the course. It is a meme editor which shows an image and two text fields for you to create a meme with. I never realized there’s so much intricate details in an app as simple as this one.</p><p>One example is editing the bottom text field. When you tap on the text field, it is hidden from view by the keyboard. The user obviously wants to see what he/she is typing, so you have to somehow move it up above the keyboard. Before I started learning Swift, I thought this was handled automatically by the OS, but that’s not the case. You actually have to do it programmatically.</p><p>There’s two ways to do this. In class, we learn to shift the entire view up based on the height of the keyboard (the other way is to use UIScrollView, which I looked into but didn’t use). Now we will begin diving into a rabbit hole as you have to use NSNotifications (which deserves a post of its own) to get the size of the keyboard and when the keyboard is shown and hidden away from view.</p><p>You might say, why don’t we just use a fixed size to shift the view up instead of getting the size of the keyboard? The answer is 3rd party keyboards. Since they have varying sizes, your fixed size might not shift the view enough for some keyboards. Then it gets trickier as even Apple’s own keyboard sends two notifications that the keyboard is showing (I’m guessing but I think Apple have some documentation about this) because there is the keyboard and the “suggested words” portion of the keyboard which triggers a separate notification. I was having a problem with my app shifting the view 2x the height of the keyboard because of the two notifications. It wasn’t as hard to fix as it was to track down why it was happening.</p><p>Considering how much Apple have done with Auto Layouts (I’m loving stack views), maybe, just maybe they will have the OS handle this in the future? In the mean time, I will play around with UIScrollView to see if it is easier than shifting the entire view up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e746583ea2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 40]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-40-5a696b6d165b?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a696b6d165b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Fri, 19 Aug 2016 16:00:15 GMT</pubDate>
            <atom:updated>2016-08-19T16:00:15.228Z</atom:updated>
            <content:encoded><![CDATA[<p>I been learning about Segue (pronounced Segway, like the personal transportation vehicle) and Delegation the last couple of days. Both seem to be difficult topics but are relatively easy once you understand how to use them.</p><p>Segues are links between View Controllers in a storyboard. It is absolutely necessary if you want to move beyond a single view app. When I tried to learn them back in April, I couldn’t understand it. It didn’t help that I was only spending an hour on the exercise and then giving up, so I felt more and more lost. This time around, I was able to absorb the material much more quickly in about 2–3 hours. Part of it I again attribute to learning the basics of Swift (from the Beginners iOS Nanodegree), but the other part is just being able to spend a consistent (and a much larger) chunk of time on it. I completed the exercise, which was to create an app that links two View Controllers with 3 different segues, one created programmatically, one using code and storyboard, and the last one using only storyboard with ease. I only wish I could have told myself from 4 months ago to slow down and learn the basics instead of pushing forward.</p><p>Delegation in Swift is a design pattern that lets objects in your app work together or in place of another object. In the course, we are using the UITextFieldDelegate protocol to set delegates for 3 different text fields. Since Swift is an event-driven programming language, think of delegates as objects that contains a bunch of methods that can react to certain events. A good example is textFieldShouldBeginEditing, a method that is called when a text field is selected and the user is about to type in text into the field. You can modify this method to prevent the user from typing in text unless a specific requirement is met (Ex: another text field have to be filled in).</p><p>The tricky thing is remembering everything. I feel I already need a refresher on things like Map &amp; Reduce, which I learned during the Beginning iOS class, but I can’t implement properly unless I go through my notes. I guess that’s where practicing comes in.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a696b6d165b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning to program in Swift — Day 35]]></title>
            <link>https://medium.com/@jackngai/learning-to-program-in-swift-day-35-b2db8df84e27?source=rss-ce1b67025aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2db8df84e27</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Jack Ngai]]></dc:creator>
            <pubDate>Sun, 14 Aug 2016 19:53:53 GMT</pubDate>
            <atom:updated>2016-08-14T19:53:53.709Z</atom:updated>
            <content:encoded><![CDATA[<p>I finally figured out how to show the launch screen properly. The launch screen is usually where developers put their application name, copyright info, or whatever they want. It shows up for like a second before the actual app is displayed.</p><p>Maybe it was how I originally setup Xcode, but every Xcode project I create have a blank Launch Screen. I end up deleting the launch screen file and creating a new launch screen file (Command + N -&gt;User Interface-&gt;Launch Screen). The new file will have my application name and copyright info filled in. But then I have to go back to Project Settings-&gt;General-&gt;App Icons and Launch Screen and “reconnect” the Launch Screen even though it is listed in the drop down menu.</p><p>I know the Launch Screen isn’t really even part of Swift, but learning Xcode’s interface is probably just as important. I also found out that I can open any GitHub project simply using the third option, “Check out an existing project” from Xcode’s start up screen. I can’t believe I have been wasting time downloading each project, unzipping, and then opening it in Xcode.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2db8df84e27" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>