Unified Contacts

22 July, 2014

Unified Storyboard

iOS 8 supports unified storyboard, which means you don't have to maintain separate storyboard for iPhone and iPad. iOS can determine how should the UI components display on the screen by detecting the traits. Here are 4 combinations.

iPad has a regular size class in vertical and horizontal directions in both portrait and landscape orientations.

iPhone has a regular size class in vertical direction and a compact size class in horizontal direction in portrait orientation. And has a compact size class in vertical and horizontal directions in landscape orientation.


 You can select the horizontal trait and vertical trait when you are placing UI components.
If components are coded for regular class, they will disappear when in compact mode.

14 July, 2014

Half-Open Range Operator changed in Xcode 6.0 Beta 3

You may see in the Swift programming guide, half-open range operator is written as 0..9 (the range is from 0 to 8, not including 9). In beta 3, it is changed to 0..<9 (much more meaningful, but personally feel it is not beautiful). A less than symbol is added.

05 July, 2014

The difference of let array and let dictionary

In Swift, let is used to declare constant and var is used to declare variable. In Objective-C, there are array and mutable array, also dictionary and mutable dictionary. Instinctively, you may think constant array is not mutable and the values inside the array is not editable. The truth is a constant array is not mutable but you may edit the values inside. However, constant dictionary is not the same as array. A constant dictionary is not mutable or editable.

I don't know why constant array is that special :(

Update:
Start from Beta 3, let array is now completely immutable, and var array is completely mutable.

Link: Swift Language Changes in Xcode 6 beta 3