Meeting another Freelancer

Today I spent the afternoon with another iOS freelancer named Li. He has been developing iOS apps independently for almost two years, after obtaining a non-CS/ECE degree from Queen’s, very much like me. It turned out we have so much in common, even the fact that we both came to Canada in elementary school grade 5, from the same hometown!

We chatted about freelancing as well as iOS development independently in general. He suggests that some really good source of learning how to code is coding spaces such as Lighthouse Lab where lots of people with industrial experience are able to provide some insight in your code. Second, reverse engineering from other people’s GitHub projects, and hacking and breaking the code down to test what code does what, piece by piece. Thirdly, by focusing on a personal project where you know you are doing meaningful work, and by having the drive to push yourself and complete something that belongs to you – really enhances the learning experience. Lastly, by involving in boot camps like Lighthouse Lab, lots of the motivation come from the intense pressure of having to learn each day’s material to understand the next day’s material. In addition to the Stanford course, Li suggested me another book called “iOS Big Ranch Guide” by Christian Keur and Aaron Hillegass. I looked it up and it actually updates very frequently as Swift and iOS versions are updated. At this moment the book is already ordered!

In terms of freelancing, client relations is a crucial part in becoming successful. Sometimes the client is vague or simply does not know what he/she wants exactly. By suggesting and selling creative ideas, clients are more likely to accept them, especially if the idea is credited to the client somehow. Next, when showing off your portfolio, it is important to get good at the show and tell. It really reveals your competency as a developer. And of course, your own uniqueness.

Later in the day, Li showed me his app which I thought is incredibly cool. It is an ancient-China-themed hack and slash action game. What’s amazing is, one: it incorporates Force Touch as the attack strength on devices that support it; two: he hand-draws all the graphics for the game on a Bamboo tablet using PhotoShop; third; he composes all of the game’s music assets all by himself! I became fascinated by how talented he is as I listened (and watched) to his music playing inside Logic Pro X. His songs sound really good, to the point where I wouldn’t think it is made by a non-professional music producer. It is incredible that someone from the finance industry is able to code, draw, animate, compose and put all of these together to make something he’s enjoying so much doing. Li said although he’s been working on it for quite a while, the app is planning to be released in two months. I’m super excited to be one of his beta testers.

Li also has another personal app: a highly customizable speed-reading app that can display text one word at a time, with options to pause longer at commas and periods. The display speed is also variable, with options to accelerate, stop, and manually scroll up and down. When stopped, it has the option to look up a word in the dictionary, or even have the text-to-speech engine pronouncing it. Personally I have read lots about speed reading, and I know how helpful such an app can be.

After returning home, I went through lecture 3 of the CS193P course in iTunes U. It added more functions to Matchismo: 12 cards instead of 1; flipping a card now checks if they match, and if they do, the score will be shown on the bottom. The ugly “Flips” label has been replace with a slightly less ugly, centered “Score” label. Yes, I felt that centering it made it less ugly. I believe prettier UI will be implemented soon. The negative score is caused by the fact that there’s a cost of 1 point each time a card is flipped. And hey, let’s leave the time of the simulator in there too.

Simulator Screen Shot Jun 11, 2017, 2.56.36 AM

P.S. I am registered as a paid Apple Developer today. Hooray! Here I come, push notifications, more apps on the demo phone, Testflight, and beta software!

Learning about Objective-C

Coming back from an iOS Coding club, I realized the importance of knowing Objective-C as a developer for iOS. Club member Harrison recommended the CS193P course from iTunes U library, so today I gave it a go and went through two lectures.

The lectures are densely-packed with information, but it is absolutely wonderful that I can take notes after pausing the video, and playing at half speed over and over when something is hard to understand. Today I learnt that this programming language is more than 30-years old and it is a strict superset of the C language (Probably lots of others languages are too). It uses C-style header (.h) and implementation files (.m), and it certainly is syntactically weird compared to other languages like Java.

Objective-C differs from C in that, it is completely object-oriented, it adds syntax for classes and methods. Objective-C differs from other modern OO programming languages in that, it has a special way of implementing public and private properties: the public properties are declared inside the header file, whereas the private properties are in the implementation file. During implementation, the getters and setters of public properties are automatically generated unless otherwise overwritten. For memory management, it uses the so called “automatic reference counting”, meaning that as soon as there are no more “strong” pointers pointing to an instance in the memory, the memory it occupies is instantly freed, so you know exactly when things are released. Moreover, in Objective-C, when a pointer is pointing to nil, or null in other languages, the pointer will actually return 0 instead of crashing the program, which is very convenient.

In Objective-C, both square brackets and dot-notation are used to access the instance’s properties and methods, I got really confused until I learned today that, by convention, only use dot notation when accessing the instance’s setters and getters.

As an exercise, I made an app “Matchismo” that flips a playing card around: a random card is draw from a deck of card each time it is tapped. There is a temporary ugly label below showing how many flips have occurred. This app allowed me to really understand the underlying principle of the MVC design strategy – grouping code into model, the view, and the controller, and a set of rules of how one is communicated to another.

I believe Objective-C is really a necessity for any iOS developer, not only because Swift is still in development, but also because lots of code written for iOS are still in Objective-C. I’ll continue to learn Objective-C from the iTunes U library in the upcoming few days.

Networking and More Sketch

These two days I have been going to networking events, asking around about the iOS industry. Yesterday I actually have met another independent iOS developer named Adam. Boy, aren’t I glad! It turned out we had a lot in common. Although he used to develop web apps, he recently started to develop for iOS and he actually has an app in the app store “Deep Journey“. The app is a visualization tool for the Mandelbrot Set, implemented using Apple’s graphic library “Metal”. I was quite impressed that he is able to independently develop something like that.

At home, I have been learning from Caleb Stultz‘s lectures about using Sketch. Here what I have learnt: Working with layers, styles, shapes, masking images, proportional scaling objects, text following a path, shape boolean, making symbols from groups and exporting graphics for different screen sizes of any popular mobile device. Additionally, I have also gone ahead and followed his tutorials on how to design a chat app simply called “Chat”. From the looks of it, I think his designs are highly conforming to the iOS Human Interface Guidelines, which is essential in getting it approved for the App Store.


Sketching with Sketch

I heard lots about the app called Sketch, citing it the “industry standard” for designing UI in mobile apps. Luckily I found that it has a trial version, so I began learning to use it. It certainly didn’t disappoint me. Its snap and alignment features are very handy and simple to use. The design interface is simple, and as someone who loves shortcut keys, Sketch offers a separate hotkey for each of the most frequently used tools such as rectangle (R), line (L)  and text (T). After a UI has been designed, it can be immediately imported into Xcode for further development. Pretty cool!

iPhone 7
A screenshot of an iPhone 7 artboard designed in Sketch

Got the Date() Down!

Been working on the Chinese Zodiac app. First I have sketched out the app in a basic functional flow diagram, followed by the adding in the corresponding UI elements. Next, I moved on to try and code it, but ran into much difficulty as I am not yet familiar with Core Data and the highly strict and inflexible Navigation Controller. I had very little trouble revisiting UITableView and UIDatePicker, but most proudly, I figured out not only how to create a Date object from DateComponents, but also extract DateComponents from a Date object, with the still-new Swift 3. It may not sound too exciting too people, but somehow I feel a sense of power, after having able to manipulate time with code.

Wireframe of the Chinese Zodiac app

Interestingly, buttons in the storyboard are restricted to text-based buttons, so a common technique used for more graphical approaches is to overlay a text-less button on top of an UIView rectangle. Unfortunately UIViews can only be a rectangle, and I wanted them to be circles; the solution I came up was to make the UIView into a square, and code in its view.layer.cornerRadius as exactly half of the square’s side length. Although, this solution works when users run the app,  but doesn’t preview in the storyboard. This explains the yellow squares in the app wireframe screenshots.

While browsing for various topics about Swift, I came across a blogger/Swift educator named Bob Lee, who has been writing and teaching Swift and iOS development. His blog posts are amazingly comprehensive and complete. As he puts it:

I try to use analogy to explain iOS Development so that my 13-year-old sister may understand.

It’s nice to see successful peers in the field of iOS development. Perhaps one day I can meet with him and chat about iOS.

Monorail Apps is Registered!

Today I went ahead and registered the name “Monorail Apps” as a legitimate business in Ontario via the ServiceOntario site! The process was really intuitive and simple, but sadly it does not guarantee name protection, meaning, anyone can register their business with any name, even though if the name is identical to any existing ones. There’s more to do to be fully legalized as a business, but today is a good start.

With the “Master Business License”, I am able to obtain a DUNS number which is required by the Apple Developer Program if the seller is going to be labeled as the company name. The DUNS number application will take 30 days to process, just in time for my July 31st goal of first app submission.

Yesterday, I have dived into a little bit into UX Design and its five-step process. It starts with research and planning, getting all the data that is relevant to the project. As part of step 1, I came across a powerful tool called “persona”: it is when the designer devises hypothetical and real data about typical users from different background and age groups, identifying their needs and emotions while using the app. The second step is to sketch the app with all the necessary functionalities and their corresponding UI elements in flow chart format. The step I liked to call Step 2.5 is the when the details are filled and refined as more feedbacks are received. Step 3 is prototyping, this is when the app itself is made to the finest detail possible based on steps 1-2.5. Step 4 is when it goes beta, lots of testing and refining. And finally, step 5, the launch, which is in many cases, just a beginning of a new chapter. I plan to implement this process to the Chinese Zodiac Signs app.

Using Swift’s Own Chinese Calendar

After some more research about the Chinese calendar, I actually found out that the Swift library support many types of calendar, including the Chinese calendar. Since the Chinese calendar adds a leap month every three years as opposed to the Gregorian calendar’s leap day (Feb. 29th), the Calendar object actually has a boolean property “isLeapMonth” to determine whether or not the year has a leap month.

To convert Gregorian calendar to Chinese, first I instantiated a calendar using “Calendar(identifier: Calendar.Identifier.chinese)”. Then, one is able to create a DateFormatter object with this instance of calendar by assigning it to DateFormatter.calendar. Finally, I used the DateFormatter to nicely format any Date object into the corresponding Chinese calendar date using DateFormatter.string(from: Date).

With the math figured out, the next step is to sketch the app’s functions and UI in detail. Planning to finish that before the weekend!


The Chinese Calendar

Aside from attending my own graduation ceremony today, I have read some articles about the Chinese calendar which will be implemented for my next app that includes Chinese Zodiac Signs. I found out that the modern Chinese calendar is essentially a calendar that counts by synodic months, which are complete phase periods of the moon observed on earth (time between one new moon to the next). Synodic months average to about 29.53 days, so 12 synodic months are about 11 days short from earth’s rotation around the sun: 365.24 days. To make up for this difference, a “leap month” called the intercalary month is inserted every 3 years.

The Chinese calendar has 24 solar terms or in Chinese “节气” which are used to mark the change of seasons and weather patterns. As a result, the intercalary month recalibrates the prediction of these “seasonal markers” for the use of planning out crop plantation and harvesting. But that’s another topic at another time.

With this information, I can write very little code to determine the Zodiac Sign for any given year and not relying on hard-coded data or CSV parsers.

“TacoPOP” – Protocols and Extensions

Hello! Today I have been writing another app called “TacoPOP” with a bunch of protocols and extensions, as I have introduced yesterday. To spice it up, I added a little animation when a Taco image is tapped.

Although this app is far from complete, I believe it has served its purpose of teaching me about protocols and extensions, which are handy tools when you want to modify existing objects that directly affect the app elements. In today’s case, UICollectionViewCell has been extended to perform a custom animation called “shake()”. Also, UICollectionView has been extended to perform a function called “shuffle()” to have its prototype cells exchange with another random cell, so the tacos would randomized every time the app is launched. Today is a traditional Chinese holiday called Dragon Boat Festival, which inspired my next app which will be related to Chinese Zodiac Signs!

Second post

Welcome to my second post! Wow, today has been lots of coding around an app called “TacoPop” which utilizes UICollectionView to show different images of tacos based on available customizations. In the app, you can choose your own protein (chicken, beef, brisket and fish) along with taco shells (corn or flour), and condiments (plain or loaded) using switch cases in the class initializer. Also another class called “DataService” which contains code for all the possible combinations using these four categories. I will be completing it tomorrow and a screen capture will be uploaded for tomorrow’s blog.

My friend WZ suggested an app to decide which movie to watch in the event when the ticket to our movie was sold out. I spend about 40 minutes and came up with an almost bug-free app “Movie Decider”. From the “beta testing” with my friends, I learnt that hiding buttons causes Stack View to re-adjust the constrains, but having the UILabel.text as simply blank doesn’t disable the button. It turned out to be an easy fix: UIButton.isEnabled = true. Other than that, they were quite impressed with what the app has to offer.

Simulator Screen Shot May 30, 2017, 1.10.05 AMLater tonight, I tried some coding challenges online, it was definitely very challenging. My friend and I solved one challenge together and another was work in progress. These challenges certainly motivated me to become a better programmer as a whole.