Vito Barba Vito Barba - 1 month ago 7
iOS Question

Sort a relationship in cosmicmind graph's library

I'm using the graph library and I need sort a relationship from a relationship.subject field [ " idOrder " ] .
it's possible to do it?
And if IdOrder isn't a int but a date?

Answer

yes you can do this for Swift 3, which is currently in the development branch.

_ = graph.search(forRelationship: ["T1"]).sorted { (a, b) -> Bool in
        return a.subject!["idOrder"] as! Int > b.subject!["idOrder"] as! Int
    }

All the best :)

Comments