let callActionHandler = { (action:UIAlertAction!) -> Void) in
let alertMessage = UIAlertController(title: "Service Unavailable", message: "Sorry, the call feature is not available yet. Please retry later", preferredStyle: UIAlertControllerStyle.Alert)
alertMessage.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertMessage, animated: true, completion: nil)
};
let callAction = UIAlertAction(title: "Call" + "123-000-\(indexPath.row)", style: UIAlertActionStyle.Default ) { (action:UIAlertAction!) -> Void in
println("check this out")
}
let callAction = UIAlertAction(title: "Call" + "123-000-\(indexPath.row)", style: UIAlertActionStyle.Default, handler: { (action:UIAlertAction!) -> Void in
println("Lets check this out")
})
let callAction = UIAlertAction(title: "Call" + "123-000-\(indexPath.row)", style: UIAlertActionStyle.Default , handler: callActionHandler)
- Here we have 3 code snippets, my doubts are:
- What is the difference between Code Snippet 1 and Code Snippet 2?
- Which of fragment 1 or fragment 2 is the best representation and should be used?
- What exactly does Snippet 1 code mean? Is this a kind of property (completion) of observation in fast?
- The way we want to write iOS8 is shown in Snippet 1, i.e. when I press the enter button during Xcode autocompletion, it converts to Snippet 1. Should we use Code Snippet 1 or still prefer to use Snippet 2/3, because they are easy to understand?
thank
source
share