-3

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?

1 Answers1

0

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 :)

CosmicMind
  • 1,499
  • 1
  • 10
  • 6
  • I am very grateful for the answer. He helped me a lot. If instead of a whole it were a date? – Vito Barba Oct 23 '16 at 17:57
  • For a date, you can use the `createdDate` property like so graph.search(forRelationship: ["T1"]).sorted { (a, b) -> Bool in return a.createdDate < b.createdDate } – CosmicMind Oct 25 '16 at 17:07