Originally created by @llYunall on GitHub (Jul 15, 2021).
Hello,
I'm trying to do a NSPredicate with two dates and it gives me an error all the time.
This is the code that I'm using:
Do you know how can I use a Date variable in the predicate?
Thanks!
Originally created by @llYunall on GitHub (Jul 15, 2021).
Hello,
I'm trying to do a NSPredicate with two dates and it gives me an error all the time.
<img width="1677" alt="Captura de pantalla 2021-07-15 a las 19 37 32" src="https://user-images.githubusercontent.com/87494445/125832511-c4c5a431-7a45-407e-8d43-2fb5f154a1f7.png">
This is the code that I'm using:
<img width="1578" alt="Captura de pantalla 2021-07-15 a las 19 41 27" src="https://user-images.githubusercontent.com/87494445/125832955-ac9ce8ed-cf9a-45fa-a555-8ca4bc9b17cd.png">
Do you know how can I use a Date variable in the predicate?
Thanks!
@JohnEstropia commented on GitHub (Jul 20, 2021):
You don't need to use an `NSPredicate`. It will mess up the generic type resolution. I also recommend the query builder syntax instead:
```swift
let smallFlush = try CoreStoreDefaults.dataStack.queryValue(
From<Statistic>()
.select(Int.self, .count(\.id))
.where(
combinedByAnd: \.localDate >= startDate,
\.localDate >= endDate,
(\.device ~ \.bluetoothUUID) == bluetoothUUID,
\.flushType == "0"
)
)
```
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 @llYunall on GitHub (Jul 15, 2021).
Hello,
I'm trying to do a NSPredicate with two dates and it gives me an error all the time.
This is the code that I'm using:
Do you know how can I use a Date variable in the predicate?
Thanks!
@JohnEstropia commented on GitHub (Jul 20, 2021):
You don't need to use an
NSPredicate. It will mess up the generic type resolution. I also recommend the query builder syntax instead:@llYunall commented on GitHub (Jul 20, 2021):
Perfect! Thanks a lot :)