The sequel to the hit indie game Her Story will have a relatively star-studded cast. Creator Sam Barlow and Annapurna Interactive have revealed the main cast for Telling Lies, and you might just recognize some of them even if they aren't mega-stars….
Category: I-phone
Iphone ,Apple I-Phone Tutorials,Jailbraik,3g,3gs,2g, 3gs untethered ,3.1.2,3.1.3,geohot
‘Fortnite’ Ice Storm event blankets the map in snow
Fortnite has had its share of map-changing events, but its latest might be the most conspicuous to date. Epic kicked off its Ice Storm event on January 19th through an in-game spectacle where the mysterious ice sphere (added with the recent 7.20 pat…
Chevy made a full-size Silverado truck out of Lego bricks
Hey, Bugatti, you're not the only one who can fashion a full-size car out of toy bricks as a publicity stunt. Chevy has enlisted the help of students from Oxford Community School and Ralph Waldo Emerson Elementary to create a one-for-one rendition o…
Try Catch in Swift – A Quick Guide To Basic Error Handling With Try, Try? & Try!
If you’re new to Swift then you’ve likely noticed the three different types of Try statements – try, try! And try?
In order to understand the different try statements we first need to know how to declare errors, Swift provides a nice way for doing this using enums like in this example:
enum CorrectError: Error {
// specific case for error, nice way to create many different errors easily
case Wrong
}
Functions throw errors in Swift by using the throws keyword which is placed before the return arrow (the ->) like the throwing function in this example:
func isRight() throws -> Bool {
throw CorrectError.Wrong
// return statement never executes
return true
}
In order to utilize a throwing function one of the 3 different try statements.
The try keywords is used within the do -> catch statement like below, typically you’ll use this when you want to catch different types of errors:
// try isRight function
let answer = try isRight()
// never printed because of thrown error
print("it is right")
} catch CorrectError.Wrong{
// this gets printed because of error
print("Wrong")
}
The try! keyword expects a normal type so function being executed must not throw any error at all or the program will crash with a fatal error as nil is returned.
let answer = try! isRight()
// never executed because of error
print ("is right")
The try? keyword returns an optional type so if the function throws an error this value is nil.
let answer = try? isRight()
if answer != nil {
// won’t print because of thrown error
print("is right")
} else {
// prints because of thrown error
print ("Wrong")
}
As you can see Swift provides a nice syntax for handling errors. This is a vast improvement over error handling in the original release of Swift, and in Objective-C.
Original article: Try Catch in Swift – A Quick Guide To Basic Error Handling With Try, Try? & Try!
©2019 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.
Netflix renews ‘The Kominsky Method’ after Golden Globe wins
Netflix isn't shy about its pursuit of critical glory. The streaming giant has renewed The Kominsky Method for a second season just a couple of weeks after it won two Golden Globe awards for best actor in a musical or comedy (Michael Douglas) and be…
Ducati confirms plans for an electric motorcycle
Ducati has hinted at a desire to make electric motorcycles before, but it's committing in a more substantial way. Company chief Claudio Domenicali told guests at a Spanish event that the "future is electric" and the company was "not far from starting…
Uber is hiring robotics teams to work on bikes and scooters
Uber is only gradually resuming its self-driving car program, but it's already thinking about expanding that technology to its two-wheeled services. The Telegraph has discovered that Uber is hiring for a "micromobility robotics" team that would brin…
Facebook introduces political petitions to your News Feed
Facebook's efforts to improve civic engagement are expanding beyond easy access to politicians and voter registration campaigns. As of January 21st, it's launching a Community Actions feature in the US that brings political petitions to the News Fee…
The best USB-C MacBook and laptop chargers
By Nick Guy
This post was done in partnership with Wirecutter. When readers choose to buy Wirecutter's independently chosen editorial picks, Wirecutter and Engadget may earn affiliate commission. Read the full USB-C MacBook and laptop chargers guide…
After Math: Watch out now!
You'd think that the week after CES would bring at least a brief lull in the firehose that is tech news, but you'd be wrong. Google's paying $40 million for Fossil's smartwatch tech; LG's holding a huge sale for last year's most expensive sets ahead…
Facebook backs an independent AI ethics research center
Facebook is just as interested as its peers in fostering ethical AI. The social network has teamed up with the Technical University of Munich to back the formation of an independent AI ethics research center. The plainly titled Institute for Ethics…
Apple gets first crack at documentaries from Ron Howard
Apple may have more than a few documentaries on tap for its upcoming streaming video service. Variety has learned that Apple has a "first-look" deal with Imagine Documentaries, the production company from Ron Howard and Brian Grazer. The move will…
Hitman convicted thanks to fitness watch location data
An alleged hitman has learned hard lessons about the the value of GPS data on fitness watches. A Liverpool jury has found Mark Fellows guilty of the 2015 murder of mob boss Paul Massey in part thanks to location info from the accused's Garmin Forerun…
DNC claims Russians launched more phishing attacks after midterms
The New York Times cites court documents filed by the Democratic National Committee that said it believes a Russian group launched a hacking attempt against it after last year's midterm elections. The lawsuit alleges a conspiracy between President Tr…
Netflix is reviving ‘Unsolved Mysteries’ with ‘Stranger Things’ producer
Netflix is continuing its string of reboots by reviving Unsolved Mysteries, according to a report from Deadline. The streaming service is giving the greenlight to a 12-episode run of the true-crime and paranormal activity show. Shawn Levy, the execut…