Skip to content

Instantly share code, notes, and snippets.

@SebastianBoldt
Created February 3, 2022 12:22
Show Gist options
  • Save SebastianBoldt/8e807e8a55ae0c0417d0f1993c9fb294 to your computer and use it in GitHub Desktop.
Save SebastianBoldt/8e807e8a55ae0c0417d0f1993c9fb294 to your computer and use it in GitHub Desktop.
let url = URL(string:"https://www.sebastianboldt.com")
let pollingSequence = URLPollingSequence(url: url!, delay: 2)
do {
for try await item in pollingSequence {
guard let data = item else {
continue
}
print(String(data: data, encoding: String.Encoding.utf8) ?? "Not decodable")
}
} catch {
print(error.localizedDescription)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment