Created
July 14, 2014 01:09
-
-
Save bitops/64066a61622195b217c3 to your computer and use it in GitHub Desktop.
Swift 'each' style Ruby extension to Array, copied from https://github.com/oarrabi/Collection-Each/blob/master/source/Collection%2BEach.swift#L10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func each(iterator: (T) -> Void) -> Array { | |
for item in self { | |
iterator(item) | |
} | |
return self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment