Skip to content

Instantly share code, notes, and snippets.

@alfianlosari
Created May 31, 2021 07:37
Show Gist options
  • Save alfianlosari/4d4925b3e235480a5c15564901231d5d to your computer and use it in GitHub Desktop.
Save alfianlosari/4d4925b3e235480a5c15564901231d5d to your computer and use it in GitHub Desktop.
Detach on sync main
static func main() {
detach {
do {
let ipifyResponse: IpifyResponse = try await fetchAPI(url: IpifyResponse.url)
//...
} catch {
print(error.localizedDescription)
}
}
RunLoop.main.run(until: Date.distantFuture)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment