Last active
August 29, 2015 14:02
-
-
Save Nub/d5c999959eb7196c8687 to your computer and use it in GitHub Desktop.
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 T[] { | |
func filterMap<U>(transform: (T) -> U?) -> U[] { | |
var newArray = U[] | |
for i in self { | |
if let filterMappedValue = transform?(i) { | |
newArray += filterMappedValue | |
} | |
} | |
return newArray | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment