Created
April 11, 2018 17:16
-
-
Save vishw33/a460d71275d222b706763c1d196bdc9e to your computer and use it in GitHub Desktop.
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 Element == Person | |
| { | |
| func arrangePersonsByAge() -> [Element] | |
| { | |
| var arr = self | |
| arr.sort { (a, b) -> Bool in | |
| a.age > b.age | |
| } | |
| return arr | |
| } | |
| func arrangePersonsBySalary() -> [Element] | |
| { | |
| var arr = self | |
| arr.sort { (a, b) -> Bool in | |
| a.salary < b.salary | |
| } | |
| return arr | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment