diff options
Diffstat (limited to 'Hutch/Views/Lookup/UserProfileViewModel.swift')
| -rw-r--r-- | Hutch/Views/Lookup/UserProfileViewModel.swift | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Hutch/Views/Lookup/UserProfileViewModel.swift b/Hutch/Views/Lookup/UserProfileViewModel.swift index 56c2852..b88d36a 100644 --- a/Hutch/Views/Lookup/UserProfileViewModel.swift +++ b/Hutch/Views/Lookup/UserProfileViewModel.swift @@ -61,6 +61,17 @@ final class UserProfileViewModel { } } + func updateRepository(_ repository: RepositorySummary) { + guard let index = repositories.firstIndex(where: { $0.id == repository.id }) else { return } + repositories[index] = repository + repositories.sort { lhs, rhs in + if lhs.updated == rhs.updated { + return lhs.name.localizedCaseInsensitiveCompare(rhs.name) == .orderedAscending + } + return lhs.updated > rhs.updated + } + } + func loadTrackers() async { isLoadingTrackers = true trackersError = nil |
