Originally created by @Maxim-Inv on GitHub (Oct 16, 2020).
I try to make observer of the value like described in the documentation:
observer = video.status.observe(options: [.new]) { (video, change) in
but stuck with the error: Generic parameter 'Value' could not be inferred
Here is my model:
class Video: CoreStoreObject {
@Field.Stored("status")
var status: String = ""
....
}
And it's ok when I refactor my model to xcdatamodel (to use NSManagedObject subclass):
observer = video.observe(\.status, options: [.new]) { (video, change) in
Originally created by @Maxim-Inv on GitHub (Oct 16, 2020).
I try to make observer of the value like described in the documentation:
```
observer = video.status.observe(options: [.new]) { (video, change) in
```
but stuck with the error:
`Generic parameter 'Value' could not be inferred`
<img width="993" alt="Screenshot 2020-10-16 at 16 13 41" src="https://user-images.githubusercontent.com/1230938/96263146-598b2100-0fcb-11eb-9008-a3d95c82a4df.png">
Here is my model:
```
class Video: CoreStoreObject {
@Field.Stored("status")
var status: String = ""
....
}
```
And it's ok when I refactor my model to xcdatamodel (to use NSManagedObject subclass):
```
observer = video.observe(\.status, options: [.new]) { (video, change) in
```
I can make it works with CoreStoreObject subclass changing this line to:
observer = video.observe(\Video.$status, options: [.new]) { (video, change) in
@Maxim-Inv commented on GitHub (Oct 16, 2020):
Maybe the documentation is a little out of date?
I can make it works with CoreStoreObject subclass changing this line to:
```
observer = video.observe(\Video.$status, options: [.new]) { (video, change) in
```
Since you are using @Field.Store, the syntax requires $ like you have discovered.
The documentation was using examples that used Value.Required and friends, which are not propertyWrappers and thus not need the $ syntax.
@JohnEstropia commented on GitHub (Oct 16, 2020):
Since you are using `@Field.Store`, the syntax requires `$` like you have discovered.
The documentation was using examples that used `Value.Required` and friends, which are not propertyWrappers and thus not need the `$` syntax.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @Maxim-Inv on GitHub (Oct 16, 2020).
I try to make observer of the value like described in the documentation:
but stuck with the error:
Generic parameter 'Value' could not be inferredHere is my model:
And it's ok when I refactor my model to xcdatamodel (to use NSManagedObject subclass):
@Maxim-Inv commented on GitHub (Oct 16, 2020):
Maybe the documentation is a little out of date?
I can make it works with CoreStoreObject subclass changing this line to:
@JohnEstropia commented on GitHub (Oct 16, 2020):
Since you are using
@Field.Store, the syntax requires$like you have discovered.The documentation was using examples that used
Value.Requiredand friends, which are not propertyWrappers and thus not need the$syntax.@Maxim-Inv commented on GitHub (Oct 16, 2020):
Got it. Thanks.
I think it would be better to add this case to the documentation, what do you think?