Skip to content

Commit

Permalink
Convert to @resultBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGorman committed May 13, 2021
1 parent d17134a commit f829b4f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Chester.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "Chester"
s.version = "0.15.0"
s.version = "0.16.0"
s.summary = "Chester is a Swift GraphQL query builder."
s.description = <<-DESC
Work in progress: Simplify building GraphQL queries with Chester.
Expand Down
2 changes: 1 addition & 1 deletion Chester/GraphQLBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public protocol Component {
var arguments: [Argument]? { get }
}

@_functionBuilder
@resultBuilder
public struct GraphQLBuilder {

public static func buildBlock(_ components: Component...) -> String {
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
[![License](https://img.shields.io/cocoapods/l/Chester.svg?style=flat)](http://cocoapods.org/pods/Chester)
[![Platform](https://img.shields.io/cocoapods/p/Chester.svg?style=flat)](http://cocoapods.org/pods/Chester)

## Experimental: @functionBuilder support
## Sort of Experimental: @resultBuilder Support

`@functionBuilder` seems like a natural match for this kind of task. There's a separate `GraphQLBuilderTests` test suite that shows the supported cases. In it's basic form you can construct a query like this:
`@resultBuilder` seems like a natural match for this kind of task. There's a separate `GraphQLBuilderTests` test suite that shows the supported cases. In it's basic form you can construct a query like this:

```swift
import Chester
Expand Down Expand Up @@ -39,6 +39,7 @@ let query = GraphQLQuery {
```

### Known Issues

- Queries with multiple root fields and arguments produce a compiler error (e.g. `'Int' is not convertible to 'Any'`)

## Usage
Expand Down Expand Up @@ -93,20 +94,24 @@ Check the included unit tests for further examples.

## Requirements

* Swift 5
* Xcode 10.2+
* iOS 8
- Swift 5
- Xcode 12.5+
- iOS 8

## Installation

Chester is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

pod "Chester"
```ruby
pod "Chester"
```

Or [Carthage](https://github.com/Carthage/Carthage). Add Chester to your Cartfile:

github "JanGorman/Chester"
```ogdl
github "JanGorman/Chester"
```

Or [Swift Package Manager](https://swift.org/package-manager/). To install it,
simply go to File > Swift Package > Add Swift Package Dependency and add "https://github.com/JanGorman/Chester.git" as Swift Package URL.
Expand Down

0 comments on commit f829b4f

Please sign in to comment.