From 537ed932a4c8d639089f276e322de4e946b0d26b Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Fri, 8 Dec 2023 10:04:55 -0800 Subject: Starting to move to async/await model so the client code is no longer burdoned by observation and isn't bound to this app. --- Hotline/Models/Hotline.swift | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Hotline/Models/Hotline.swift (limited to 'Hotline/Models/Hotline.swift') diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift new file mode 100644 index 0000000..70f68a9 --- /dev/null +++ b/Hotline/Models/Hotline.swift @@ -0,0 +1,21 @@ +import SwiftUI + +@Observable final class Hotline { + let trackerClient: HotlineTrackerClient + + + + init(trackerClient: HotlineTrackerClient) { + self.trackerClient = trackerClient + } + + @MainActor func getServers(address: String, port: Int) async { + let fetchedServers = await withCheckedContinuation { [weak self] continuation in + self?.trackerClient.fetch() { + continuation.resume(returning: []) + } + } + + + } +} -- cgit