I have the following code using async sequence
class Store {
static let INSTANCE = Store()
private var updateListenerTask: Task<Void, Error>? = nil
private init() {
//Start a transaction listener as close to app launch as possible so you don't miss any transactions.
updateListenerTask = listenForTransactions()
}
private func listenForTransactions() -> Task<Void, Error> {
return Task.detached {
// STEP 1: Begin loop
for await result in Transaction.updates {
...
// STEP 2: Inside loop (No break/ return statement in this loop body)
}
// STEP 3: End loop
}
}
May I know, what will be the exit condition for this async sequence loop?
Or, it will always be an infinity loop? So far, per my testing, only STEP 1 and STEP 2 will be executed. STEP 3 is never executed.
Thank you.