MapirServices 1.0.0

MapirServices 1.0.0

Map.ir 维护。



MapirServices Logo

Swift 5.2 Version Platform Carthage Compatible SPM

MapirServices

ℹ️MapirServices 框架,为您提供方便访问 Map.ir API 和服务的途径。

示例

示例应用程序是查看MapirServices工作状态的最佳方式。只需打开MapirServices.xcodeproj,并运行MapirServices Swift 示例方案即可。

安装

CocoaPods

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

pod 'MapirServices'

Carthage

Carthage 是一个去中心化的依赖管理工具,用于构建您的依赖项并提供二进制框架。

要将 MapirServices 集成到您的 Xcode 项目中使用 Carthage,请在您的 Cartfile 中指定它

github "map-ir/mapir-ios-sdk-services"

运行 carthage update 以构建框架,并将生成的 MapirServices.framework 拖拽到您的 Xcode 项目中。

在您的应用程序目标的“构建阶段”设置标签页中,点击加号图标,选择“新运行脚本阶段”并添加 Carthage 获取开始步骤 4、5 和 6 中提到的框架路径Carthage Getting started Step 4, 5 and 6

Swift 包管理器

要使用 Apple 的 Swift 包管理器 进行集成,请将以下内容作为依赖项添加到您的 Package.swift

dependencies: [
    .package(url: "https://github.com/map-ir/mapir-ios-sdk-services", from: "1.0.0")
]

手动

如果您不想使用上述任何依赖管理器,可以手动将MapirServices集成到您的项目中。只需将源文件文件夹拖动到您的Xcode项目即可。(不推荐)

使用

  1. App注册网站获取访问令牌。
  2. 将访问令牌作为键值对添加到项目的info.plist文件中。键必须是"MapirAPIKey",并将访问令牌设置为其值。
  3. 首先使用以下命令导入SDK:
    import MapirServices
  4. 创建所需类的实例。
    // It's used for geocoding addresses (not available at this moment) and reverse-geocoding coordintes.
    let geocoder = Geocoder()
    
    // Can be used to search over Map.ir data of places and any other geographical place.
    let search = Search()
    
    // `Directions` brings routing features to you. 
    // Using `Directions` you can find multiple routes between multiple waypoints, considering restrictions and traffic situation. 
    let directions = Directions()
    
    // Use `Geofence` to manipulate fences that are associated with you API Key on Map.ir. 
    let geofence = Geofence()
    
    // `MapSnapshotter` is used to create static image of piece of the map. 
    let snapshotter = MapSnapshotter()
    
    // It's used to calculate the distance and duration between multiple origins and multiple destinations.
    let distanceMatrix = DistanceMatrix()
    

许可协议

查看 LICENSE 文件。