Skip to content

SwiftGraphQL 2.0.0

Choose a tag to compare

@maticzav maticzav released this 16 Feb 10:21
· 122 commits to main since this release

Hi there 👋🏿 ,

We've finally reached version 2.0.0! After several immensely successful beta releases of the next major SwiftGraphQL version, I think we are ready to ship. This version includes additions that profoundly change how the first version worked. To name a few, we've implemented subscriptions support, improved code-generation, built a CLI utility and more!

I hope you find this package as useful as I've seen it fun.

Before diving into all the changes, I'd like to thank @Amzd who helped me shape this library by implementing the subscription layer and adding some fantastic suggestions that make working with SwiftGraphQL more enjoyable. @Amzd thank you! ❤️

Our mission remains the same with every version - We want to build the most approachable Swift GraphQL client, that solves few things but solves them well.

Features

  • We've added support for subscriptions. To make a subscription selection, use the same pattern as before and create a socket, using the listen method.
  • We've added a CLI that you may use to generate the SwiftGraphQL code. You may download it using brew, mint or build it yourself using make.
  • Every structure in the schema that may be selected has type alias for better XCode IDE support. If, for example, you had a User type in the database and wanted to select a name out of it, you no longer have to make a phantom-type using Selection<User, String>. Instead, you can write Selection.User. Swift should infer the return type itself.

Internal changes

I've changed the code structure so that we expose another child-library - GraphQLAST. I haven't documented it, but it should be simple to use by following function annotations and inline docs.

Breaking Changes

  • When making a selection, field decoding might throw. That's why every assignment should be marked with try.
  • SwiftGraphQLCodegen no longer accepts an Options structure. Instead, you should forward scalars. Additionally SwiftGraphQLCodegen no longer writes to a file. Instead, it would be best if you used swift-graphql CLI tool as an alternative to build-phase script in version 1.x.x and 2.x.y-beta.z.
  • I've removed SG and SwiftGraphQL namespaces in favour of modules.

Future plans

I've started working on the documentation page. I think it's important that we promote the library more and hopefully land on some sponsors that would encourage this library's maintenance.