Skip to content

Instantly share code, notes, and snippets.

@radex
Created January 19, 2015 15:12
Show Gist options
  • Save radex/faf19a077e6cc108bffd to your computer and use it in GitHub Desktop.
Save radex/faf19a077e6cc108bffd to your computer and use it in GitHub Desktop.
import Foundation
func foo() -> AnyObject? {
return NSDictionary()
}
func cast<A>(type: A.Type)(object: Any) -> A? {
return object as? A
}
foo().map { x in cast(NSDictionary)(object: x) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment