Skip to content

Instantly share code, notes, and snippets.

@SebastianBoldt
Created February 4, 2022 13:45
Show Gist options
  • Save SebastianBoldt/3d14dfb93b92ce384e211301e39d6baa to your computer and use it in GitHub Desktop.
Save SebastianBoldt/3d14dfb93b92ce384e211301e39d6baa to your computer and use it in GitHub Desktop.
actor BankAccount {
var balance: Int = 0
let accountHolder: String?
init(accountHolder: String) {
self.accountHolder = accountHolder
}
func logBalance() {
print(balance) // Accessing Balance without await
}
}
func loggingProxy(account: isolated BankAccount) {
account.logBalance()
}
Task {
let bankAccount = BankAccount(accountHolder: "Sebastian Boldt")
await loggingProxy(account: bankAccount)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment