{"repo":"GraphQLSwift/GraphQL","free":true,"listed":false,"github":"https://github.com/GraphQLSwift/GraphQL","clone":"git clone https://github.com/GraphQLSwift/GraphQL.git","description":"The Swift GraphQL implementation for macOS and Linux","language":"Swift","stars":963,"topics":["graphql","swift","vapor","swiftpm","swift-nio","graphiti"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"GraphQL [![Platforms][platforms-badge]][platforms-url] [![Versions][versions-badge]][versions-url] [![SSWG][sswg-badge]][sswg-url] [![License][mit-badge]][mit-url] The Swift implementation for GraphQL, a query language for APIs created by Facebook. This repo is a Swift port of the JavaScript reference implementation. To create GraphQL schemas more easily, use graphql-generator or Graphiti, and to expose your schema through HTTP, check out graphql-vapor or graphql-hummingbird Looking for help? Find resources from the GraphQL community. Usage Schema Definition The GraphQLSchema object can be used to define GraphQL Schemas and Types. These schemas are made up of types, fields, arguments, and resolver functions. Below is an example: For more complex schema examples see the test files. Execution Once a schema has been defined queries may be executed against it using the global graphql function: The result of this query is a GraphQLResult that encodes to the following JSON: Subscription This package supports GraphQL subscription. To create a subscription field in a GraphQL schema, use the subscribe resolver that returns any type that conforms to AsyncSequence , with a Sendable element type. You must also provide a resolver , which defines how to process each event as it occurs and must return the field result type. Here is an example: To execute a subscription use the graphqlSubscribe function: The code above will print the following JSON every 3 seconds: Encoding Results If you en","default_branch":null,"files":null,"tree":[],"storefront":"/r/GraphQLSwift","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/GraphQLSwift/GraphQL/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}