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