Avatar
import Foundation final class BankAccount { var balance = 0 func deposit(_ amount: Int) -> Int { balance += amount Thread.sleep(forTimeInterval: 1.0) return balance } } func bankAccountMain() { (1...100).forEach { _ in let bankAccount = BankAccount() Task { print(bankAccount.deposit(100)) } Task { print(bankAccount.deposit(100)) } } }