We have a macOS and iOS app using Apollo, both communicate to the same backend. We’ve successfully upgraded to Apollo 1.x in the Mac app using the Swift Package Manager approach, but we’ve run up against an issue in trying to do the same thing with the iOS app. Can you help us out? Thanks! This is what we’ve done:
- Add the graphqls file from Apollo Studio and the operations file (the files are the exact same for both apps for now)
- Add the Apollo dependency to the project via SPM (version 1.0.6)
- Install the CLI by control-clicking the project in Xcode
- Run ./apollo-ios-cli init --schema-name MyAppAPI --module-type swiftPackageManager
- Run ./apollo-ios-cli generate to create a MyAppAPI folder containing a Package.swift file and Sources folder
- Choose File > Add Packages > Add Local and select MyAppAPI then select the project in the Add to project dropdown
At this point, the macOS project shows MyAppAPI with a brown package icon in the sidebar. But in the iOS project, MyAppAPI has a blue folder icon. - Add the module to each target via Frameworks, Libraries, and Embedded Content (we have two app targets because this is a white-labeled app)
The macOS project shows the MyAppAPI brown package in the list within Workspace and it has a MyAppAPI library within it and we were able to add that without issue, but the iOS project does not show MyAppAPI in this list so we cannot add it - the Workspace only contains Pods (we use CocoaPods to install other dependencies that don’t support SPM).