Latest 0.9.0
Homepage https://github.com/JanGorman/Chester
License MIT
Platforms ios 8.0, tvos 9.0
Authors

Carthage compatible
Build Status
codecov.io
Version
License
Platform

Note that Chester is work in progress and it’s functionality is still very limited.

Usage

Chester uses the builder pattern to construct GraphQL queries. In its basic form use it like this:

import Chester

let query = QueryBuilder()
  .from("posts")
  .with(arguments: Argument(key: "id", value: "20"), Argument(key: "author", value: "Chester"))
  .with(fields: "id", "title", "content")

// For cases with dynamic input, probably best to use a do-catch:

do {
  let queryString = try query.build
} catch {
  // Can specify which errors to catch
}

// Or if you're sure of your query

guard let queryString = try? query.build else { return }

You can add subqueries. Add as many as needed. You can nest them as well.

let commentsQuery = QueryBuilder()
  .from("comments")
  .with(fields: "id", content)
let postsQuery = QueryBuilder()
  .from("posts")
  .with(fields: "id", "title")
  .with(subQuery: commentsQuery)

You can search on multiple collections at once

let search = QueryBuilder()
  .from("search")
  .with(arguments: Argument(key: "text", value: "an"))
  .on("Human", "Droid")
  .with(fields: "name")
  .build()

Check the included unit tests for further examples.

Requirements

  • Swift 5
  • Xcode 10.2+
  • iOS 8

Installation

Chester is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Chester"

Or Carthage. Add Chester to your Cartfile:

github "JanGorman/Chester"

Author

Jan Gorman

License

Chester is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Chester",
    "version": "0.9.0",
    "summary": "Chester is a Swift GraphQL query builder.",
    "description": "Work in progress: Simplify building GraphQL queries with Chester.",
    "homepage": "https://github.com/JanGorman/Chester",
    "license": "MIT",
    "authors": {
        "Jan Gorman": "[email protected]"
    },
    "social_media_url": "http://twitter.com/JanGorman",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "swift_versions": "5.0",
    "source": {
        "git": "https://github.com/JanGorman/Chester.git",
        "tag": "0.9.0"
    },
    "source_files": [
        "Classes",
        "Chester/*.swift"
    ]
}

Pin It on Pinterest

Share This