Advertisement
Larme

Untitled

May 19th, 2023
1,803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.46 KB | None | 0 0
  1.     let sortedKeys2 = Array(parents.keys).sorted { lhs, rhs in
  2.         let lhsContent = parents[lhs] ?? []
  3.         let rhsContent = parents[rhs] ?? []
  4.         switch (lhsContent.isEmpty, rhsContent.isEmpty) {
  5.         case (true, true):
  6.             return rhs > lhs
  7.         case (true, false):
  8.             return true
  9.         case (false, true):
  10.             return false
  11.         case (false, false):
  12.             return rhsContent.contains(lhs)
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement