Skip to content

Instantly share code, notes, and snippets.

@samirGuerdah
Created April 17, 2016 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samirGuerdah/fc3655e8664b0fda7ca827ee354490d7 to your computer and use it in GitHub Desktop.
Save samirGuerdah/fc3655e8664b0fda7ca827ee354490d7 to your computer and use it in GitHub Desktop.
extension Array {
func map<U>(transform: (element: Generator.Element) -> U) -> [U]{
var elements = [U]()
for item in self {
elements.append(transform(element: item))
}
return elements
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment