Skip to content

Instantly share code, notes, and snippets.

@charlieInDen
Created August 23, 2020 05:52
Show Gist options
  • Save charlieInDen/d68292c003beee094694722263d01833 to your computer and use it in GitHub Desktop.
Save charlieInDen/d68292c003beee094694722263d01833 to your computer and use it in GitHub Desktop.
OwnMap Method
extension Sequence {
// T is the output type
func myMap<T>(_ transform: (Element) -> T) -> [T] {
var result: [T] = []
self.forEach { (item) in
result.append(transform(item))
}
return result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment