[swift] Swift 딕셔너리에서 특정 값을 기준으로 키를 오름차순 정렬하는 방법은?
let myDict: [String: Int] = ["one": 1, "four": 4, "three": 3, "two": 2]
let sortedKeys = myDict.keys.sorted(by: { myDict[$0]! < myDict[$1]! })
for key in sortedKeys {
    print("\(key): \(myDict[key]!)")
}

위의 코드는 myDict 딕셔너리를 값에 따라 정렬한 후, 정렬된 키를 출력하는 예제입니다.

이 방법을 사용하면 값에 따라 딕셔너리의 키를 정렬할 수 있습니다.

참고 자료: https://developer.apple.com/documentation/swift/dictionary/1539569-sorted