Created
February 4, 2022 13:45
-
-
Save SebastianBoldt/3d14dfb93b92ce384e211301e39d6baa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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