marinofaggiana 4 years ago
parent
commit
b845cb6ccc
1 changed files with 2 additions and 1 deletions
  1. 2 1
      iOSClient/Data/NCManageDatabase.swift

+ 2 - 1
iOSClient/Data/NCManageDatabase.swift

@@ -376,7 +376,8 @@ class NCManageDatabase: NSObject {
         
         let realm = try! Realm()
         
-        let results = realm.objects(tableAccount.self).sorted(byKeyPath: "active", ascending: false)
+        let sorted = [SortDescriptor(keyPath: "active", ascending: false), SortDescriptor(keyPath: "user", ascending: true)]
+        let results = realm.objects(tableAccount.self).sorted(by: sorted)
         
         return Array(results.map { tableAccount.init(value:$0) })
     }