Created
April 11, 2018 17:16
-
-
Save vishw33/a460d71275d222b706763c1d196bdc9e to your computer and use it in GitHub Desktop.
Revisions
-
vishw33 created this gist
Apr 11, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ 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 } }