Add dynamic library product to Package.swift #1483
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have two products that depend upon Apollo for iOS:
We recently migrated to use Swift Package Manager in both the core app and in the framework and are in the process of integrating the framework into the core app. This causes an error to occur:
This is a known issue when integrating Swift packages in Xcode. The Swift Package Manager documentation states that:
However, Xcode links Swift packages as static libraries unless they are specified as dynamic libraries in their respective
Package.swift
files. (Reference 1, Reference 2, Reference 3.)This PR proposes a way to work around this issue: It provides an additional
Apollo-Dynamic
product that is simply theApollo
library with the.dynamic
type specifier. This is similar approach toPaper
/PaperStatic
/PaperDynamic
sample code provided in the Swift Package Manager documentation.This PR allows our core app and framework (and any others encountering this issue) to include the
Apollo-Dynamic
library and resolve the compiler/linker error. TheApollo
product continues to act as a statically linked library.