swiftgraphcosmicmind

Problem Search Predicate with graph ver 3.1.1


the graph version was updated via cocoapods all 3.1.1

now however the application notifies me of errors when I use the search, I think I have solved the problem in part but it still notifies me error, I don't know how to replace the control on a field as it was in version 2.2.2. Can anyone tell me something?

Before All ok

func caricaPromemoriaConPriorita(valore : Int)  -> [Entity] {

        let search = Search<Entity>(graph: db).for(types: "Promemoria").where(properties: [(key: "priorita", value: valore)])

        return search.sync().sorted { ($0["dataFine"] as! Date) < ($1["dataFine"] as! Date)}
    }

Ver 3.1.1 error I modified it this way, it works to define the table but I don't know how to do it for comparison

 let predicate: Predicate = .type(["Promemoria"])
        let search = Search<Entity>(graph: db).where(predicate)

Hello, the graph version was updated via cocoapods all 3.1.1

now however the application notifies me of errors when I use the search, I think I have solved the problem in part but it still notifies me error, I don't know how to replace the control on a field as it was in version 2.2.2. Can anyone tell me something?

how do you get the same result that I get with this code?

.where(properties: [(key: "priorita", value: valore)])

Tks


Solution

  • With new api:

    let search = Search<Entity>(graph: db).where(.type("Promemoria") && "priorita" == valore)
    search.sync().sorted { ($0.dataFine as! Date) < ($1.dataFine as! Date)}