yandex / mapsapi-ios

Allows to easily add Yandex.Maps to your existing iOS project using Yandex.Maps JavaScript API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attention! This module is no longer supported. You can't run this project in the latest version of XCode.

MapsAPI

Allows to easily add Yandex.Maps to your existing iOS project using Yandex.Maps JavaScript API.

Installation

MapsAPI is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MapsAPI'

Start instantly

  1. Create class MyMapViewController inherited from MapsAPIViewController and add it to any place you want to put the map (screenshot 1).

  2. Copy myMap.js to your target resources and use JavaScript API to modify it and operate with the map (screenshot 2).

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

Controls

Default preset uses controls from mapsapi-round-controls package.

Native Connector

Is used to send and receive data in Swift/ObjC <-> JavaScript code. Coming soon.

Additional parameters

You can overwrite params as follows:

class MyMapViewController: MapsAPIViewController {
    override func viewDidLoad() {
        // Default: "ru_RU".
        self.apiParams["lang"] = "en_US"
        
        // Default: "release".
        self.apiParams["mode"] = "debug"

        // Default: "2.1".
        self.apiVersion = "2.1-dev"

        // Default: false. See https://tech.yandex.com/maps/doc/jsapi/2.1/commercial/index-docpage/
        self.apiEnterprise = true
        self.apiParams["apikey"] = "your_key"
        
        // By default is taken from view controller name. I.e. "myMap" for MyMapViewController.
        self.jsFileName = "anotherFile"
    
        super.viewDidLoad()
    }
}

Multiple maps

You can add other view controllers and .js files keeping convention of matching names for each pair.

Offline

Tile cache coming soon.

Author

Alexander Zinchuk, zinchuk@yandex-team.ru

About

Allows to easily add Yandex.Maps to your existing iOS project using Yandex.Maps JavaScript API

License:Mozilla Public License 2.0


Languages

Language:Objective-C 64.2%Language:Swift 25.7%Language:JavaScript 6.1%Language:Shell 2.7%Language:CSS 0.5%Language:HTML 0.4%Language:Ruby 0.2%Language:C 0.1%