Precision Timing in iOS & Swift

Time is what we want most, but what we use worst. -William Pen Timestamp is a very important issue we deal with in every single iOS/OSX project. Unlike timestamp, sometimes we want to measure method performance. Practically, i would use it for fun exploration. However, there are cases especially in games development where the precise time helps maintain consistent gameplay with scores. I explored a bit on how we can leverage the systems provided APIs to just get the current time stamp as precisely as possible.

Read More

Spicing up OSX terminal experience!

Why? Let me show you how my terminal looks like. I got this idea from a good friend and colleague of mine, while at work. I am always fond of good UI but I love to stick to command line when possible. Reasons: many. I love my terminal. While at work, i have 1 monitor dedicated to full screen terminal. And i love the subtle aesthetics of CLI UI. Now, if you want similar termnial then keep reading.

Read More

Why String Manipulation is alien in Swift3?

Objective-C era NSRange has a very simple API. Finding a range, replacing, splitting or chopping are some few tricks off the bat for simple string manipulation. Objective-C and its idiomatic NSRange API looks such: public struct _NSRange { public var location: Int public var length: Int } Lets say we wanted to extract just the name from a JSON string we got. let a: NSString = “name: Bj P.

Read More

Why is there AnyHashable in Swift3?

Evolution is predominant. Struggle for Survival applies to just anything that you see. Swift Programming Language is not an exception. Swift continues to change, evolve and mature over time. We can keep our feet wet, migrating year after year to Swift X version. I would. If it strives to be better. This years, Swift 2 -> Swift 3 was little more than a mini project. We saw lots of changes. For this edition, we will focus on [AnyObject: NSObject], which became [AnyHashable: Any].

Read More

Xcode8 ZStyle Code Formatter: How to write consistent styled code?

Yet again somebody missed to insert a empty line before the end of file, I missed to provide a empty space after dictionary Key [AnyHashable:Any] and you might miss to leave any of these kinds of code: //....... return data } func compute(a:Int,b:Int)->Int{ //....... Which should have been: //....... return data } func compute(a: Int, b: Int) -> Int { //....... So you see where I’m heading with this.

Read More