GraphQL + Apollo Course Updates - Swift 5

Currently, the GraphQL Using the Apollo Framework: Getting Started course fails to run and operate correctly upon download. The following steps fix the issue:

  1. To make the included Apollo pod play nice with Swift 5, we need to remove and reinstall the dependencies by navigating into the project and typing the following command into the terminal:
rm -rf Podfile.lock && pod install
  1. Since the project now has an updated Apollo dependency, we need to update the run script with the following:
SCRIPT_PATH="${PODS_ROOT}/Apollo/scripts"
cd "${SRCROOT}/${TARGET_NAME}"
"${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile="./GraphQL/schema.json" "./GraphQL/Generated/GraphQLAPI.swift"

And that should be all that needs doing to update this tutorial for Swift 5 and Apollo pod version 0.25.0!

Edit: This is my first post on these forums, and I couldn’t seem to find an appropriate category. If a more appropriate one exists, please let me know and I will update the post!

@poland.tyler Thank you for sharing your solution - much appreciated!

@poland.tyler Please check out the updated version of the tutorial when you get a chance:

https://www.raywenderlich.com/10886648-graphql-using-the-apollo-framework-getting-started

I hope it helps!