diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-08 10:04:55 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-08 10:04:55 -0800 |
| commit | 537ed932a4c8d639089f276e322de4e946b0d26b (patch) | |
| tree | 1d3604a5f777be87f2d3d405ddfe5725c687b99f /Hotline/Models/Hotline.swift | |
| parent | 767eb58da13d83aa321fff12c97fe433cd8fa734 (diff) | |
Starting to move to async/await model so the client code is no longer burdoned by observation and isn't bound to this app.
Diffstat (limited to 'Hotline/Models/Hotline.swift')
| -rw-r--r-- | Hotline/Models/Hotline.swift | 21 |
1 files changed, 21 insertions, 0 deletions
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: []) + } + } + + + } +} |