Originally created by @seanliu1 on GitHub (May 21, 2019).
I am looking for something similar to [NSPredicate predicateWithFormat:@"person.children.@count > 0"]
I tried to use
dataStack.fetchAll(From().where(\person.children.count == 0)
but it will give error
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.
I wonder what is the correct syntax for this case?
Originally created by @seanliu1 on GitHub (May 21, 2019).
I am looking for something similar to [NSPredicate predicateWithFormat:@"person.children.@count > 0"]
I tried to use
dataStack.fetchAll(From<person>().where(\person.children.count == 0)
but it will give error
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.
I wonder what is the correct syntax for this case?
adam
added the question label 2025-12-29 15:28:02 +01:00
@JohnEstropia commented on GitHub (May 23, 2019):
Sorry I haven't gotten to add this anywhere in the README yet, but this is the current syntax for it:
```swift
dataStack.fetchAll(
From().where((\.person ~ \.children).count() == 0)
)
```
Thanks, I actually already figure out but not as elegant as yours.
I was using where(format: "episodes.@count == 0", argumentArray: nil) it also works, but it wont do any compile time check for your.
@seanliu1 commented on GitHub (May 23, 2019):
Thanks, I actually already figure out but not as elegant as yours.
I was using where(format: "episodes.@count == 0", argumentArray: nil) it also works, but it wont do any compile time check for your.
what if we want a child from the list with a particular id ?
@Vertuals commented on GitHub (Nov 5, 2021):
@JohnEstropia What if we want a person from the list with a particular child id ?
> Sorry I haven't gotten to add this anywhere in the README yet, but this is the current syntax for it:
>
> ```swift
> dataStack.fetchAll(
> From().where((\.person ~ \.children).count() == 0)
> )
> ```
what if we want a child from the list with a particular id ?
@Vertuals Sorry, there are no syntax sugars for them in CoreStore yet, but you can use the ANY and ALL operators in your own NSPredicate and pass it to the CoreStore where() clause
@JohnEstropia commented on GitHub (Nov 8, 2021):
@Vertuals Sorry, there are no syntax sugars for them in CoreStore yet, but you can use the [`ANY` and `ALL`](https://stackoverflow.com/questions/30076452/difference-between-all-any-and-some-operators-in-nspredicate) operators in your own `NSPredicate` and pass it to the CoreStore `where()` clause
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 @seanliu1 on GitHub (May 21, 2019).
I am looking for something similar to [NSPredicate predicateWithFormat:@"person.children.@count > 0"]
I tried to use
dataStack.fetchAll(From().where(\person.children.count == 0)
but it will give error
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.
I wonder what is the correct syntax for this case?
@JohnEstropia commented on GitHub (May 23, 2019):
Sorry I haven't gotten to add this anywhere in the README yet, but this is the current syntax for it:
@seanliu1 commented on GitHub (May 23, 2019):
Thanks, I actually already figure out but not as elegant as yours.
I was using where(format: "episodes.@count == 0", argumentArray: nil) it also works, but it wont do any compile time check for your.
@Vertuals commented on GitHub (Nov 5, 2021):
@JohnEstropia What if we want a person from the list with a particular child id ?
what if we want a child from the list with a particular id ?
@JohnEstropia commented on GitHub (Nov 8, 2021):
@Vertuals Sorry, there are no syntax sugars for them in CoreStore yet, but you can use the
ANYandALLoperators in your ownNSPredicateand pass it to the CoreStorewhere()clause