Installation
Before you start developing your application with WemapSDKs, you need to configure your credentials and add the SDK as a dependency.
Adding the Dependency
To add WemapSDKs to your app:
Add Dependencies in the
Podfile
Add the required WemapSDK pods to your app:
use_frameworks! target 'TargetNameOfYourApp' do # Add the dependency for the WemapMapSDK library pod 'WemapMapSDK', '<version>' end
Ensure Minimum iOS Version
Your project must target iOS 12.0 or later:
platform :ios, '12.0'
Install Dependencies and Open the Project
Run the following command to install the pods:
AWS_ACCESS_KEY_ID=*** \ AWS_SECRET_ACCESS_KEY=*** \ AWS_REGION=*** \ bundle exec pod install --repo-update
Then, open your project in Xcode:
open your-project.xcworkspace
Add a map
Open the view controller where you want to add a map and use the code below.
To make it work, you need to provide a mapID
and token
in the mapData
request.
import UIKit
import WemapMapSDK
import RxSwift
class ViewController: UIViewController {
private let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
WemapMap.shared
.getMapData(mapID: 19158, token: "GUHTU6TYAWWQHUSR5Z5JZNMXX")
.subscribe(onSuccess: { [self] mapData in
let mapView = MapView(frame: view.bounds)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mapView.mapData = mapData
view.addSubview(mapView)
}, onFailure: {
debugPrint("Failed to get map data with error - \($0)")
})
.disposed(by: disposeBag)
}
}
Examples
For additional examples and sample implementations of WemapSDKs, visit the official GitHub repository.
Clone the repository and follow the README instructions to run the sample application.