Celebrating WWDC 2022 and the 100th Daily Coding Tip š„³
All tutorials will be free this week!

When I tried to use the new for in try await
pattern, Xcode 14 Beta told me that it required something conforming to AsyncSequence
.
The following code is based on Appleās documentation comments for AsyncSequence
, as I thought this would be a quick way to get a type that would work for this.
Now I know this example doesnāt need SwiftUI, but I thought it would be useful to show it as a task attached to an empty view. By creating an async function that doesnāt actually wait or throw, we are able to fulfil the expectations of this new way to loop in asynchronous sequences that may throw.