I've discovered that there are really two ways to accomplish a Try
/Catch
strategy in Swift. The first example is technically correct but the "shorthand" example gives you the same end result.
Longhand
let obj = PFObject(className: "TestObject")
obj.setObject("bar", forKey: "foo")
do {
try obj.save()
} catch {
print("error")
}
Shorthand
let obj = PFObject(className: "TestObject")
obj.setObject("bar", forKey: "foo")
if let success = try? obj.save(){
print("success", success)
} else {
print("failure")
}
Subscribe to new posts
Processing your application
Please check your inbox and click the link to confirm your subscription
There was an error sending the email