Created
April 9, 2025 07:22
-
-
Save jacobsapps/723f61929638039164b76fe80464f934 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class ContactsService { | |
let userAPI = UserAPI() | |
private(set) var contacts = [Contact]() | |
private let contactsActor = TaskActor<[Contact]>() | |
func fetchContacts() async throws { | |
contacts = try await contactsActor.run { [weak self] in | |
try await self?.userAPI.fetchAllUsersInContacts() ?? [] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment