Get Swift Package version numbers at runtime on iOS

Question: How can I access the package version numbers included in the Package.resolved file?

Possible Solutions:

  • Parse the Package.resolved file with a build script and store the package version numbers
  • Access the package version numbers directly

Answer: Access the package version numbers directly. They are listed in the Package.resolved file under each package’s version key.