Apollo-tooling: Swift codegen errors on version 0.18.6

Created on 22 Feb 2018  路  3Comments  路  Source: apollographql/apollo-tooling

After upgrading to apollo 0.8.0 and apollo-codegen 0.18.6, my API.swift file isn't compiling correctly (Swift 4.0) due to the new (more explicit) map format.

Old API.swift:

public var pollTriggers: [PollTrigger]? {
      get {
        return (snapshot["pollTriggers"] as? [Snapshot]).flatMap { $0.map { PollTrigger(snapshot: $0) } }
      }
      set {
        snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "pollTriggers")
      }
    }

New API.swift:

public var pollTriggers: [PollTrigger]? {
      get {
        return (snapshot["pollTriggers"] as? [Snapshot]).flatMap { (value: [Snapshot]) -> [PollTrigger] in value.map { PollTrigger(snapshot: (value: Snapshot) -> PollTrigger **in** value) } }
      }
      set {
        snapshot.updateValue(newValue.flatMap { (value: [PollTrigger]) -> [Snapshot] in value.map { (value: PollTrigger) -> Snapshot in value.snapshot } }, forKey: "pollTriggers")
      }
    }

The relevant Swift errors:

Expected ',' separator
Expected expression in list of expressions

Both errors are occurring at the **in** in the getter for pollTriggers

Most helpful comment

This should be fixed in 0.18.7!

All 3 comments

I am having exact same issue.

This should be fixed in 0.18.7!

thank you @martijnwalraven , this actually solved all of my issues

Was this page helpful?
0 / 5 - 0 ratings