Swift Package Manager dependency resolution failure using amplify-swift and aws-mobile-appsync-sdk-ios

0

We are currently migrating to v2.x of the amplify-swift library in order to use some new authentication features that are only available in Amplify 2.x. However, our current AppSync schema and model generation process requires us to use aws-mobile-appsync-sdk-ios, since the Amplify CLI's amplify codegen command generates models that import AWSAppSync and uses the Apollo GraphQL-style API (e.g. GraphQLMapConvertible, GraphQLMap etc).

When I attempt to create a package dependency on amplify-swift v2.6.0 alongside aws-mobile-appsync-sdk-ios v.3.6.2, I get a large number of errors during package resolution. These are all of the form:

multiple products named 'AWSPolly' in: 'aws-sdk-ios-spm', 'aws-sdk-swift'

and

multiple targets named 'AWSPolly' in: 'aws-sdk-ios-spm', 'aws-sdk-swift'; consider using the `moduleAliases` parameter in manifest to provide unique names

There are a total of 33 such pairs of messages, with each of a number of AWS libraries appearing twice - once with each message.

To reproduce this issue:

  1. Create a new blank Xcode project using the 'App' template
  2. Add a package dependency to https://github.com/aws-amplify/amplify-swift, using 'exact version' 2.6.0
  3. Observe that package resolution completes successfully
  4. Add a package dependency to https://github.com/awslabs/aws-mobile-appsync-sdk-ios, using 'exact version' 3.6.2
  5. Observe that package resolution fails with the errors described above

Note: Reversing steps 2 and 4 (adding the dependencies in the opposite order) has no effect - the same dependency resolution issues are seen.

How can I use these two libraries together? Due to various project constraints we're not currently able to migrate fully over to using the API module of Amplify 2.x for our GraphQL APIs, so still need to use aws-mobile-appsync-sdk-ios for this.

asked a year ago106 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions