CosmicMind / Graph

Graph is a semantic database that is used to create data-driven applications.
http://cosmicmind.com
MIT License
873 stars 72 forks source link

Remove optionals on accessing GraphJSON properties #145

Closed OrkhanAlikhanov closed 6 years ago

OrkhanAlikhanov commented 6 years ago
let json = GraphJSON(...)
guard let firstName = json.user?.name?.first?.asString else {
  return
}

Above can be reduced to:

guard let firstName = json.user.name.first.asString else {
  return 
}

We can continue to use asX anyways which returns Optional

daniel-jonathan commented 6 years ago

Fixed in https://github.com/CosmicMind/Graph/pull/146