Skip to content

Instantly share code, notes, and snippets.

@tLewisII
Created August 17, 2014 00:21
Show Gist options
  • Save tLewisII/66c6d5c182932acc7206 to your computer and use it in GitHub Desktop.
Save tLewisII/66c6d5c182932acc7206 to your computer and use it in GitHub Desktop.
Syntax differences
// this...
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
let group = data?[self.tableView.indexPathForSelectedRow().row]
if let destination = segue.destinationViewController as? ViewController {
destination.title = group?.valueForProperty(ALAssetsGroupPropertyName) as? NSString
destination.data = PhotoManager.lazySendableForGroup(manager) <^> group
} else {
println("Cast failed, proposed class of segue view controller is wrong")
}
}
// or this?
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
let blockManager = self.manager
(data?[self.tableView.indexPathForSelectedRow().row] >>= {
(group:ALAssetsGroup) -> ()? in
(segue.destinationViewController as? ViewController >>= {
(destination:ViewController) -> ()? in
destination.title = group.valueForProperty(ALAssetsGroupPropertyName) as? NSString
destination.data = blockManager.lazySendableForGroup(group)
return ()
}) ?? println("ViewController cast failed")
}) ?? println("Data array was None")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment