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.

June3rd-ChineseZodiac
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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s