This SDK helps you access the full range of geospatial APIs from Stadia Maps using Swift. Using Xcode, you'll get all the goodies like autocomplete, type definitions, and documentation as you type. All API methods leverage the async features introduced in Swift 5.5, which make it easier than ever to write correct asynchronous code.
The Xcode UI changes frequently, but you can usually add packages to your project using an option in the File menu. Then, you'll need to paste in the repository URL to search: https://github.com/stadiamaps/stadiamaps-api-swift. See https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app for the latest detailed instructions from Apple.
You will need an API key to use the Swift SDK.
You can create an API key for free here (no credit card required).
You can configure your API key like so:
StadiaMapsAPI.customHeaders = ["Authorization": "Stadia-Auth YOUR-API-KEY"]
If you want to use our EU endpoints to keep traffic within the EU, you can set the basePath
property.
StadiaMapsAPI.basePath = "https://api-eu.stadiamaps.com"
You can find examples of how to call all of our API methods in the integration tests.
Official documentation lives at docs.stadiamaps.com, where we have both long-form prose explanations of each endpoint and an interactive API reference.