Skip to content

Instantly share code, notes, and snippets.

@radex
Created January 19, 2015 15:13
Show Gist options
  • Save radex/abc77fc6e95ac9043a34 to your computer and use it in GitHub Desktop.
Save radex/abc77fc6e95ac9043a34 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(cast(NSDictionary))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment