Latest 0.2.0
Homepage https://github.com/bsmith11/MapSnap
License MIT
Platforms ios 8.0, requires ARC
Dependencies PINCache
Frameworks UIKit, MapKit, CoreLocation
Authors

[![CI Status](http://img.shields.io/travis/Brad Smith/MapSnap.svg?style=flat)](https://travis-ci.org/Brad Smith/MapSnap)
Version
License
Platform

Requirements

MapSnap requires at least iOS 8 and Swift 3.0

Installation

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

pod "MapSnap"

Usage

UIImageView extensions to generate, cache, and set a map image based on a CLLocationCoordinate2D

let mapImageView = UIImageView(frame: .zero)
let latitude = 42.3601
let longitude = 71.0589
let coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
mapImageView.setMapImage(with: coordinate)

Optionally specify:

  • image size
  • placeholder image to use while the map image is asynchronously generated
let size = CGSizeMake(width: UIScreen.main.bounds.width, height: 200.0)
let placeholderImage = UIImage(named: "my_placeholder_image")
mapImageView.setMapImage(with: coordinate, size: size, placeholderImage: placeholderImage)

MapSnapManager may be used directly to generate and cache map images. The default image size is customizable and has a default value of:

public var defaultImageSize = CGSize(width: UIScreen.main.bounds.width, height: 150.0)

The default cache used is PINCache, but you can subsitute it with anything that conforms to the MapSnapCache protocol:

public protocol MapSnapCache {
    func object(for key: String) -> Any?
    func set(object: NSCoding, for key: String)
}

Author

Brad Smith, @bsmithers11

License

MapSnap is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MapSnap",
    "version": "0.2.0",
    "summary": "A library to easily create map snapshots",
    "description": "MapSnap lets you easily create map snapshots, cache them, and display them in UIImageViews",
    "homepage": "https://github.com/bsmith11/MapSnap",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Brad Smith": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bsmith11/MapSnap.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "MapSnap/Classes/**/*",
    "requires_arc": true,
    "frameworks": [
        "UIKit",
        "MapKit",
        "CoreLocation"
    ],
    "dependencies": {
        "PINCache": [
            "~> 2.3"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This