class Socket {
// ...
public var alive: Bool {
@asyncHandler get { // would this work?
let handle = detach { await self.checkSocketStatus() }
return await handle.get()
// Would this work?
}
}
private func checkSocketStatus() async -> Bool { /* ... */ }
}
If we had @asyncHandler would the above example still be a motivation?
I am more familiar with languages that do not support async properties so I am on the fence about its utility. Personally I feel that it makes Swift harder to reason about.
Let’s say I have to interact with an sdk property that is async only. What are the mechanisms available to me to be able to call this property if I am not in an async context?