1

I have an existing project using an old Apollo build(0.4.0) w/cocoapods and am trying to upgrade to 1.0.7. I followed all the steps here:

https://www.apollographql.com/docs/ios/migrations/1.0/#breaking-changes

using the 'SPM With Xcode project' set up that is outlined in Step 2.

When installing the package via SPM (i selected, Apollo, apollo-ios-cli, Apollo-Websocket) in the list of options available.

I was able to then run the command:

./apollo-ios-cli init --schema-name Schemas --module-type embeddedInTarget --target-name MyAppName

which gave me the apollo-codegen-config.json file with the following contents:

{
  "schemaName" : "Schemas",
  "input" : {
    "operationSearchPaths" : [
      "**/*.graphql"
    ],
    "schemaSearchPaths" : [
      "MyAppName/schema.json"
    ]
  },
  "output" : {
    "testMocks" : {
      "none" : {
      }
    },
    "schemaTypes" : {
      "path" : "./Schemas",
      "moduleType" : {
        "embeddedInTarget" : {
          "name" : "MyAppName"
        }
      }
    },
    "operations" : {
      "inSchemaModule" : {
      }
    }
  }
}

where schema.json is the already built schema file that was already in the project.

Next up is the command:

/apollo-ios-cli generate

which now creates for me my new Schemas directory with all my new queries, mutations, etc in it. Meanwhile i had to remove the old project Apollo folders, which are now obsolete. (please see screenshot for Project directory).

I am getting a lot of errors related to ApolloCodeGenLib (but I know that is supposed to only work for the Mac). I am not sure why it was part of the Apollo SPM package, when i didn't select it in Xcode, when installing it).

Has anyone successfully upgraded to Apollo 1.0.7 within the iOS/Xcode environment? All the videos and tutorials online re: this subject is using an older Apollo version. enter image description here

cspam
  • 2,911
  • 2
  • 23
  • 41

0 Answers0