How to Install Google Maps SDK for iOS with Swift Package Manager
The first step in adding Google Maps Platform functionality to your iOS app is adding SDKs. Google are thrilled to announce that the iOS Maps, Places, and Navigation SDKs now support Swift Package Manager dependency management. Maintaining dependencies with Google Maps Platform SDKs for iOS is easier. Swift Package Manager in X code, the main way to add packages to iOS projects, makes this feasible.
One of the most requested improvements by developers is Swift Package Manager support for Google Maps Platform SDK dependencies. In the X code integrated development environment (IDE), developers can add package dependencies to iOS apps by entering the URL for the SDK’s GitHub repository. Swift Package Manager in X code lets you define package versions that match SDK versions.
Before Google were able to implement Swift Package Manager for the Google Maps Platform SDKs for iOS, Google needed Swift Package Manager to enable binary targets in the form of XC Frameworks and the capability to add resources such as images and strings within a Swift package. This needed to be accomplished before Google could support Swift Package Manager.
Both of these were made accessible to Swift packages with the release of Swift tools version 5.3 for Swift. As an additional step, Google changed their build and release infrastructure in order to make it possible to release Swift packages concurrently with the publishing workflows for Cocoa Pods and XC Frameworks. This was accomplished without adding any additional latency to the release process.
The first begin
Since version 8.3.1 of the Maps SDK for iOS, version 8.3.0 of the Places SDK, and version 5.3.1 of the Navigation SDK, Swift Package Manager is supported. The Maps, Places, and Navigation Software Development Kits for iOS documentation provides Swift package installation instructions and URLs. For existing applications switching from another dependency manager to Swift Package Manager, the documentation contains steps for uninstalling binaries deployed by other package managers. Developers can manually add SDK requirements or use Cocoa Pods.