@@ -25,7 +62,14 @@ If your project has its own base URL which is not the one SDK provides, you can
...
@@ -25,7 +62,14 @@ If your project has its own base URL which is not the one SDK provides, you can
CSMapKit.shared.setAPIBaseURL("API_BASE_URL")
CSMapKit.shared.setAPIBaseURL("API_BASE_URL")
```
```
If you want to use CedarMaps tiles, there's one extra step to do. After doing this you can use an instance of ```CSMapView``` which is a subclass of Mapbox ```MGLMapView``` to show CedarMaps tiles.
### Mapbox
CedarMaps SDK is based on [Mapbox iOS SDK v4.0](https://github.com/mapbox/mapbox-gl-native) and provides extra API methods over Mapbox.
For more information about how to use Mapbox components and methods such as **Adding Markers**, **Showing Current Location**, etc., please see [Mapbox Getting Started](https://www.mapbox.com/help/first-steps-ios-sdk/).
#### CSMapView
If you want to use CedarMaps tiles, there's one extra step to do. After doing the following snippet, you can use an instance of ```CSMapView```, which is a subclass of Mapbox ```MGLMapView```, in either Storyboard or code; they shall not be used interchangeably.
@@ -38,20 +82,19 @@ CSMapKit.shared.prepareMapTiles { isSuccesful, error in
...
@@ -38,20 +82,19 @@ CSMapKit.shared.prepareMapTiles { isSuccesful, error in
}
}
```
```
### Geocoding Methods
## API Methods
There are a couple of methods related to reverse and forward geocoding points and addresses. These methods are all asynchronous and their completion handlers are called on the main queue.
In addition to using MapView, you can use CedarMaps API to retrieve location based data and street search.
Some of these methods are as follows. Check ```CSMapKit``` header fore more information.
All API calls are asynchronous; they don't block the Main Queue. The completion handlers are all called on the Main Queue.
```objc
You can also consult [CSMapKit.h](http://gitlab.cedar.ir/cedar.studios/cedarmaps-sdk-ios-public/blob/master/CedarMaps/Classes/CSMapKit.h) for detailed info on all of our methods. Some of the main methods are mentioned below.
You can request an ```UIImage``` of a desired map view with the following code snippet. You should create a ```CSMapSnapshotOptions``` beforehand to set custom properties.
You can request an ```UIImage``` of a desired map view with the following code snippet. You should create a ```CSMapSnapshotOptions``` beforehand to set custom properties.
```objc
```objc
...
@@ -102,32 +167,9 @@ CSMapKit.shared.createMapSnapshot(with: options) { (snapshot, error) in
...
@@ -102,32 +167,9 @@ CSMapKit.shared.createMapSnapshot(with: options) { (snapshot, error) in
```
```
Optionally, you can specify markeres to be drawn on the map by setting ```markers``` property on ```CSMapSnapshotOptions``` instance.
Optionally, you can specify markeres to be drawn on the map by setting ```markers``` property on ```CSMapSnapshotOptions``` instance.
## Example
## More Examples via the Sample App
To run the example project, clone the repo, and run `pod install` from the Example directory first.
To run the example project, clone the repo, and run `pod install` from the **Example** directory first.
Then, in ```CSAppDelegate.m``` file, set your own Client ID and Client Secret.
Then, in ```CSAppDelegate.m``` file, set your own `clientID` and `clientSecret`.
The example project is a mix of Swift and Objective-C.
The example project is a mix of Swift and Objective-C.
Since CedarMaps is using ```Mapbox``` for rendering map tiles, you can consult their [documentation](https://www.mapbox.com/ios-sdk/)
## Requirements
- Mapbox-iOS-SDK
## Installation
CedarMaps is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod'CedarMaps'
```
## Author
CedarStudio ®, info@cedarmaps.com
## License
CedarMaps is available under the MIT license. See the LICENSE file for more info.