Created
August 22, 2018 14:34
-
-
Save Viniciuscarvalho/939834fd1c9f6c22556bd837fa446ac6 to your computer and use it in GitHub Desktop.
Extensão de reduce para unir elementos de um array de objeto e apresenta-los concatenados em lista.
This file contains hidden or 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 where Iterator.Element == ObjectoDoModelo { | |
| func presentableNames() -> String { | |
| return self.compactMap({ $0.elementoDoObjeto }) | |
| .reduce("", { $0 + "\n" + $1 }).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment