Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 3.04 KB

README.md

File metadata and controls

81 lines (53 loc) · 3.04 KB

MapyKit - Native Mapy.cz Swift SDK

MapyKit is native Mapy.cz SDK written in Swift. MapyKit uses native MKMapView under the hood, so it's compatible with all your current map code. Out of the box.

This project is currently in early development stage, framework APIs may change over time.

MapyKit example preview

Installation

Carthage

Add following line to your Cartfile:

github "josefdolezal/MapyKit" ~> 0.1.0

Follow the installation guide to correctly link library with your project.

CocoaPods

Add following line to yor Podfile:

pod 'MapyKit', :git => 'https://github.com/josefdolezal/MapyKit.git', '~> 0.1.0'

Once you updated the Podfile, run:

$ pod install

Usage

Once you have downloaded project source, all you have to do is to insert the map view into view hierarchy. The Mapy.cz maps are rendered using MapyView, subclass of MKMapView:

let mapView = MapyView()

view.addSubview(mapView)
mapView.setExtendedMapType(mapType: .touristic)

Since the view is subclass of MKMapView, you can use all API provided by standard map view (e.g. set delegate or use map annotations).

Map types

MapyKit supports multiple map types. The default map type is ExtendedMapType.standard. You can change map type manually using setExtendedMapType(mapType:) method:

mapView.setExtendedMapType(mapType: .touristic)

Supported map types are listed below.

Type Description Preview Number of layers
.standard Standard map view (default) preview 1
.touristic Standard map with highlighted hiking trails preview 1
.winter Map of winter resorts preview 1
.satelite Satelite map (without labels) preview 1
.hybrid Satelite map (with labels) preview 2
.hybridNative Satelite map (with MapKit native labels) N/A 1
.geography Geography map preview 1
.historical Historical map from 19th century preview 1
.textMap Text-only map preview 2
.in100Years Czech Republic in 100 years preview 2

Note that maps with multiple layers may download significant amount of data. Thus, map rendering takes more time and may waste user's mobile data plan. Whenever you can, use map types with single layer. If you need to display satelite map with street labels, use .hybridNative instead of .hybrid.

Example

See working example of MapyKit with customizable map type in Example directory.

License

This repository is licensed under MIT.