Colors and Strokes

Today is about NSAttributedString, a special kind of string that can carry information such as color, stroke, font, etc. on top of just string themselves. An app called “Attributor” can be used to demonstrate this. Also performing transitions between screens – segues. A button whose action is connecting to another view controller, and the connection itself is a segue. It can have an identifier which can be referenced in code and pass on information between views. Super when the app has multiple views. Later, I learned about UINavigationController and UITabBarController with multiple MVCs working together. I feel that these material are really basic but also very useful.
For the Chinese Zodiac Sign app, I figured out how to convert Gregorian dates into not only Chinese calendar-based dates, but also to the zodiac sign of that specific day! Basically what I did was to have an instance of DateFormatter() and have its locale property set to Locale(identifier: "zh_CN"), and its calendar property set to Calendar.Identifier.chinese, this way the DateFormatter can display a string of Chinese characters for a Chinese-calendar date translated from any Gregorian date. One of the characters in the resulting string reveals about the zodiac sign.

Chinese Character Zodiac Sign

Simply enough, extracting that character from the string and have a switch case to translate it into English version of the zodiac sign. However, there are still lots to do about saving a person’s birthday and keeping it inside persistent storage. Will work on that in the next few days when I learn more about Core Data. Now here is a video showing the app “Attributor”:


Leave a Reply

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

You are commenting using your 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