GoogleStaticMapsKit


Version Carthage compatible Platform

Swift 4

License

GoogleStaticMapsKit 提供了一个完整且轻量级的 Swift API,用于处理 Google Static Maps API。

预览

record

缩放

zoom-world
缩放:.world (世界)
zoom-continant
缩放:.continent (洲)
zoom-city
缩放:.city (城市)
zoom-street
缩放:.street (街道)
zoom-building
缩放:.building (建筑物)

样式

style-retro
样式:[Retro] (复古)
style-assasins
样式:[Assassin's Creed IV] (刺客信条 IV)
style-lost-in-the-desert
样式:[Lost in the desert] (迷失在沙漠中)
style-wy
样式:[WY]

开始使用

示例

// Setting up the API Key (probably in AppDelegate)
GoogleStaticMaps.setAPIKey(apiKey: "your_api_key")


let parameters = Parameters(size: ImageSize(width: 600, height: 400))
let location = Location(center: .geo(latitude: 45.7772, longitude: 3.0870), zoom: .city)
let gsm = GoogleStaticMaps(location: location, parameters: parameters)

let url = gsm.toURL

print("Result : \(url)")

样式

GoogleStaticMapKit 被设计为支持像 SnazzyMaps 这样的 JSON 样式

[...]
let path = jsonFilePath
let styles = StylesImporter.fromJson(path: path).styles
let feature = Feature(styles: styles)
let gsm = GoogleStaticMaps(location: location, parameters: parameters, feature: feature)

有关 Google Maps 样式的更多信息,您可以查看官方 Google 文档

支持

安装

GoogleStaticMapsKit 可通过 CocoaPods 获得。 要安装它,只需将以下行添加到您的 Podfile

CocoaPods

use_frameworks!
pod "GoogleStaticMapsKit"

Carthage

github 'PoissonBallon/GoogleStaticMapsKit'

Swift Package Manager

let package = Package(
    name: "MyPackage",
    dependencies: [
        .Package(url: "https://github.com/PoissonBallon/GoogleStaticMapsKit", majorVersion: 1),
    ]
)

作者

许可证

GoogleStaticMapsKit 在 MIT 许可证下可用。 有关更多信息,请参见 LICENSE 文件。