Always Try, Try?, And Try!, Never give up

How-to-Get-Started-With-Unit-Testing-Through-Xcode-in-Swift1

Beside Swift being powerful, expressive language with a flexible, elegant syntax. There is one of the features I appreciate most is native support for error handling with try keyword.

It is easy to ignore errors in Objective-C. You have to do a bit of extra work to enable error handling.

[swift]

NSError *error = nil;// Initialize Data With Contents of URL

NSData *data = [[NSData alloc] initWithContentsOfURL:URL options:0 error:&error];

if (error) {

// Error Handling …

}

[/swift]

Continue reading

Blog Post Rating :