Hi everyone, this is slightly Apple Platform related, but I will try and keep it relatively generic as I think it could be useful on other platforms.
For a bit of context, I am trying to build a Property Wrapper that interacts with the Keychain with the standard CRU functionality, to ensure values are not overwritten in different contexts I have set up my helper object for interacting with the keychain set up as an Actor
I am using this helper object as the "storage" for my Property Wrapper, of course this leads to a problem with concurrent properties, I would like to have the wrappedValue
property as a get, set
property, but I need to access the helper object in an asynchronous context, because I want to have a setter I cannot have an async getter and I cannot seem to work out how I can access the actor in a synchronous way, I am probably missing something obvious, or I am trying to do something outside of the scope of Property Wrappers/Actors but my google-fu is failing me, so I thought I would ask around here.
I'm not sure it is much help, but this is how I left my code last night:
var wrappedValue: Value {
get { Task { await storage.value } }
set { Task { await storage.update(newValue) } }
}