I think we're getting fairly into Actor Isolation part esp. the Global Actor part, it @QuinceyMorris agrees, maybe the mods can move us there.
In so far, you shouldn't trust that the code is executed on any particular actor (MainActor
in this case) unless the entire block is. So most likely it'll look something like:
override func viewWillAppear(_ animated: Bool) async {
super.viewWillAppear(animated)
let (signed, signature) = await try library.sign(data, using: pass)
await withActor(MainActor.self) {
self.isPassSigned = ...
}
}
or
@MainActor
func updateUI(...) {
self.isPassSigned = ...
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let (signed, signature) = await try library.sign(data, using: pass)
await updateUI(...)
}
I don't think design in this area would affect much (if at all) of this proposal, which pertains only async/await keywords and type relationships. So maybe we can move on to other threads.