How to sort an array of custom objects by property value in Swift?
Hello everyone! I just started learning Swift and ran into a problem when working with arrays. I have a `User` struct with several properties:
```swift
struct User {
let name: String
let age: Int
let score: Double
}
```
I create an array of users:
```swift
let users = [
User(name: "Anna", age: 25, score: 85.5),
User(name: "Boris", age: 30, score: 92.3),
User(name: "Victor", age: 22, score: 78.1)
]
```
I need to sort this array by age (from youngest to oldest) and by name (in alphabetical order). I tried using `sort()` and `sorted()`, but the compiler complains that `User` does not conform to the `Comparable` protocol.
How to properly sort an array of custom objects in Swift? Preferably with code examples. Thanks in advance.