iOS SDK Overview | 2GIS Documentation

iOS SDK

iOS SDK allows you to add a 2GIS map to your iOS application. It can be used to display the map in your layout, add custom markers to it, draw geometric shapes, calculate and display routes, get information about map objects, control the camera movement, and so on.

You can find usage examples in the Examples section. For a detailed description of all classes and methods, see API Reference.

Geodata complies with OGC standards.

To work with MobileSDK, you need to get the key file dgissdk.key with the obligatory indication of the appId of the application for which this key is created. This key will be used to connect to 2GIS servers and retrieve the geographical data, as well as to use offline and the navigator. This key is unique to the SDK and cannot be used with other 2GIS SDKs.

To obtain this key file, fill in the form at dev.2gis.com.

When the key is activated, you can sign in to the Platform Manager and check statistics of request distribution.

  • Xcode 12+
  • iOS 13.0+ / iPadOS 13.0+ (this SDK uses SwiftUI)

You can also use xcframework to build your project for iOS 12.

iOS SDK is distributed in two versions: full and lite. The lite version does not include the routes and navigation functionality.

To install this SDK, you need to add a package dependency to your project. See the official documentation for more information on using Swift packages.

Specify one of the following URLs when adding a dependency to install the SDK:

  • https://github.com/2gis/mobile-sdk-map-swift-package - to get the lite version.
  • https://github.com/2gis/mobile-sdk-full-swift-package - to get the full version.

To connect through Cocoapods, you need to add DGisMobileSDK to your dependencies.

Versioning corresponds to what is used in Swift PM, but it is necessary to add the postfix -map or -full depending on the required version of the SDK.

The pod specification can be viewed at one of the following URLs:

  • https://github.com/2gis/mobile-sdk-full-swift-package/blob/master/DGisMobileSDK.podspec - full version.
  • https://github.com/2gis/mobile-sdk-map-swift-package/blob/master/DGisMobileSDK.podspec - light version.

Frameworks can be downloaded directly, bypassing package managers. To do this, you need to refer to a repository that contains package specifications for CocoaPods or Swift Package Manager:

  • https://github.com/2gis/mobile-sdk-map-swift-package - full version.
  • https://github.com/2gis/mobile-sdk-full-swift-package - light version.

The Package.swift file will specify the URL leading to the archive with the SDK download link. To navigate through versions, use git tags.

You can find a demo app with the source code in our GitHub repository.