Avatar
@swift-6.0.3 var users = [ (firstName: "John", lastName: "Doe"), (firstName: "Ashley", lastName: "Hatch"), (firstName: "Alice", lastName: "Bob"), (firstName: "Sam", lastName: "Coffey"), (firstName: "Kristie", lastName: "Mewis"), (firstName: "Ashley", lastName: "Sanchez") ] users = users.sorted(by: { $0.lastName < $1.lastName }) users = users.sorted(by: { $0.firstName < $1.firstName }) users.forEach { print($0) } (edited)