Practice writing methods on your own, through a hands-on challenge.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3535-programming-in-swift/lessons/47
Practice writing methods on your own, through a hands-on challenge.
Iām being told that the sort method on collections has been replaced with sorted(by: ), is this just something that has been updated between Swift 3 and 4?
Yeah you can do the same thing with sorted(by:) like this:
students.sorted(by: { student 1, student2 in return student1.grade > student2.grade })
This topic was automatically closed after 166 days. New replies are no longer allowed.