-
Hi all. In case I want to use just the synchronisation part of some state but dont want to write to it on certain level of hierarchy, I can use SharedReader, right? But when I have @SharedReader var name: String in state, I cannot just use SharedReader(name) or SharedReader("David") in preview or feature state init like I am able to do with Shared. I supposed both SharedReader and Shared are the same except SharedReader is not writable. Am I doing something wrong? OK @Shared var name: String
init(name: String) {
_name = Shared(name)
} nOK (Cannot convert value of type 'String' to expected argument type 'Shared') @SharedReader var name: String
init(name: String) {
_name = SharedReader(name)
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @jiledaa, we do not expose that initializer on Is there a specific use case in mind you have for this? |
Beta Was this translation helpful? Give feedback.
In that case you need the parent to pass the child the
Shared
state, and then the child can turn it into aSharedReader
: