apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 717 forks source link

Add support for SPM `Package.resolved` version `3` #3355

Closed calvincestari closed 6 months ago

calvincestari commented 6 months ago

Bug

It looks like Xcode 15.3 and swift-tools-version: 5.10 brings with it a new version of the Package.resolved file. Below is an example from a test project:

{
  "originHash" : "438020303660f915142c6f2f9052482de7f6a2f2b84a04cffea17e3bd09b9e12",
  "pins" : [
    {
      "identity" : "apollo-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apollographql/apollo-ios",
      "state" : {
        "revision" : "72aaf039a417a2e3c98c490bb1c43a025758556e",
        "version" : "1.9.2"
      }
    },
    {
      "identity" : "sqlite.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/stephencelis/SQLite.swift.git",
      "state" : {
        "revision" : "e78ae0220e17525a15ac68c697a155eb7a672a8e",
        "version" : "0.15.0"
      }
    }
  ],
  "version" : 3
}

This results in being unable to do code generation with Apollo iOS because we throw an error for unknown versions:

Error: Package.resolve file version unsupported!
Please create an issue at: https://github.com/apollographql/apollo-ios

Workaround

  1. Delete the Package.resolved file.
  2. Downgrade swift-tools-version from 5.10 to 5.9.