{"id":24658580,"url":"https://github.com/cedarstudios/cedarmaps-ios-sdk","last_synced_at":"2025-07-01T05:03:40.587Z","repository":{"id":56905743,"uuid":"185330817","full_name":"cedarstudios/cedarmaps-ios-sdk","owner":"cedarstudios","description":"CedarMaps SDK for iOS","archived":true,"fork":false,"pushed_at":"2020-07-28T11:04:17.000Z","size":2590,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T05:03:11.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedarstudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-07T06:00:02.000Z","updated_at":"2025-06-24T19:36:12.000Z","dependencies_parsed_at":"2022-08-20T19:20:26.700Z","dependency_job_id":null,"html_url":"https://github.com/cedarstudios/cedarmaps-ios-sdk","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/cedarstudios/cedarmaps-ios-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedarstudios%2Fcedarmaps-ios-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedarstudios%2Fcedarmaps-ios-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedarstudios%2Fcedarmaps-ios-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedarstudios%2Fcedarmaps-ios-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedarstudios","download_url":"https://codeload.github.com/cedarstudios/cedarmaps-ios-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedarstudios%2Fcedarmaps-ios-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262900087,"owners_count":23381657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-26T01:38:13.737Z","updated_at":"2025-07-01T05:03:40.563Z","avatar_url":"https://github.com/cedarstudios.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CedarMaps iOS SDK\n\nThis guide will take you through the process of integrating CedarMaps into your iOS application.\n\nAll the mentioned methods and tools in this document are tested on Xcode 11.\n\n## Table of Contents\n- [Installation](#installation)\n\t-\t[Required Permissions](#required-permissions)\n\t-\t[Configuring CedarMaps](#configuring-cedarmaps)\n\t\t- [Changing API Base URL](#changing-api-base-url)\n    -   [Mapbox](#mapbox)\n        - [CSMapView](#csmapview)\n- [API Methods](#api-methods)\n\t-\t[Forward Geocoding](#forward-geocoding)\n\t-\t[Reverse Geocoding](#reverse-geocoding)\n\t-\t[Direction](#direction)\n\t-\t[Distance](#distance)\n\t-\t[Static Map Image](#static-map-images)\n- [Sample App](#more-examples-via-the-sample-app)\n\n\n## Installation\n\nCedarMaps is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile and run `pod install`.\n\n```ruby\npod 'CedarMaps'\n```\n\n### Required Permissions\n\nIf your app needs to access location services, add a description usage for `NSLocationWhenInUseUsageDescription` in your app's `Info.plist`:\n\n```xml\n\u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n\u003cstring\u003eTHE REASON OF REQUESTING LOCATION\u003c/string\u003e\n```\n\n### Configuring CedarMaps\n\nTo use CedarMaps tiles and methods, you need a pair of `clientID` and `clientSecret` which is used at the first step of initialising the SDK.\n\n`AppDelegate`'s `applicationDidFinishLaunchingWithOptions:` is a good place to initialize CedarMaps.\n\n```objc\n[[CSMapKit sharedMapKit] setCredentialsWithClientID:@\"CLIENT_ID\" clientSecret:@\"CLIENT_SECRET\"];\n```\n```swift\nCSMapKit.shared.setCredentialsWithClientID(\"CLIENT_ID\", clientSecret: \"CLIENT_SECRET\")\n```\n\n#### Changing API Base URL\n\nIf you've received an API Base URL, you can set it on `CSMapKit` shared object:\n\n```objc\n[[CSMapKit sharedMapKit] setAPIBaseURL:@\"API_BASE_URL\"];\n```\n```swift\nCSMapKit.shared.setAPIBaseURL(\"API_BASE_URL\")\n```\n\n### Mapbox\n\nCedarMaps SDK is based on [Mapbox iOS SDK](https://github.com/mapbox/mapbox-gl-native) and provides extra API methods over Mapbox. \nFor 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/).\n\n#### CSMapView\n\nIf 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.\n\n```objc\n[[CSMapKit sharedMapKit] prepareMapTiles:^(BOOL isReady, NSError * _Nullable error) {\n    \n}];\n```\n```swift\nCSMapKit.shared.prepareMapTiles { isSuccesful, error in\n                \n}\n```\n\n##### Changing Map Style\n\nYou can set various style URLs to instances of `CSMapView`:\n\n```swift\nmapView.styleUrl = \"STYLE_URL\"\n\n// Light Vector (Default): \"CSMapViewStyleURLVectorLight\"\n// Dark Vector: \"CSMapViewStyleURLVectorDark\"\n// Raster: \"CSMapViewStyleURLRasterLight\"\n```\nMake sure to use the expanded version with your own base URL if you have one.\n\n\n## API Methods\n\nIn addition to using MapView, you can use CedarMaps API to retrieve location based data and street search.\n\nAll API calls are asynchronous; they don't block the Main Queue. The completion handlers are all called on the Main Queue.\n\nYou 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.\n\n### Forward Geocoding\n\nFor finding a street or some limited POIs, you can easily call ```geocode``` methods.\n\n```objc\n- (void)geocodeAddressString:(nonnull NSString *)addressString\n               inBoundingBox:(nonnull CSBoundingBox *)boundingBox\n                    withType:(CSPlacemarkType)type\n                       limit:(NSInteger)limit\n           completionHandler:(nonnull CSForwardGeocodeCompletionHandler)completionHandler;\n```\n```swift\nopen func geocodeAddressString(_ addressString: String, in boundingBox: CSBoundingBox, with type: CSPlacemarkType, limit: Int, completionHandler: @escaping CSForwardGeocodeCompletionHandler)\n```\n\nMore advanced street searches are available in the sample app.\n\n### Reverse Geocoding\n\nYou can retrieve data about a location by using Reverse Geocode API.\n\n```objc\n- (void)reverseGeocodeLocation:(nonnull CLLocation *)location\n             completionHandler:(nonnull CSReverseGeocodeCompletionHandler)completionHandler;\n\n```\n```swift\nopen func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CSReverseGeocodeCompletionHandler)\n```\n\n### Direction\n     \nThis method calculates the direction between points. It can be called with up to 50 different pairs in a single request.\n\n```objc\n- (void)calculateDirectionsFromSource:(nonnull CLLocation *)source toDestinations:(nonnull NSArray\u003cCLLocation *\u003e *)destinations withCompletionHandler:(nonnull CSDirectionCompletionHandler)completionHandler;\n```\n```swift\nopen func calculateDirections(fromSource: CLLocation, destinations: [CLLocation], withCompletionHandler completionHandler: @escaping CSDirectionCompletionHandler)\n```\n\n### Distance\n\nThis method calculates the distance between points in meters. It can be called with up to 15 different points in a single request.\n\n```objc\n- (void)calculateDistance:(nonnull NSArray\u003cCSRoutePair *\u003e *)routePairs withCompletionHandler:(nonnull CSDirectionCompletionHandler)completionHandler;\n```\n```swift\nopen func calculateDistance(_ routePairs: [CSRoutePair], withCompletionHandler completionHandler: @escaping CSDirectionCompletionHandler)\n```\n\n### Static Map Images\nYou can request an ```UIImage``` of a desired map view with the following code snippet. You should create a ```CSMapSnapshotOptions``` beforehand to set custom properties.\n\n```objc\nCSMapSnapshotOptions *options = [[CSMapSnapshotOptions alloc] init];\noptions.center = [[CLLocation alloc] initWithLatitude:LATITUDE longitude:LONGITUDE];\noptions.zoomLevel = ZOOM_LEVEL;\noptions.size = CGSizeMake(WIDTH, HEIGHT);\n\n[CSMapKit.sharedMapKit createMapSnapshotWithOptions:options withCompletionHandler:^(CSMapSnapshot * _Nullable snapshot, NSError * _Nullable error) {\n    \n}];\n```\n```swift\nlet options = CSMapSnapshotOptions()\noptions.center = CLLocation(latitude: LATITUDE, longitude: LONGITUDE)\noptions.zoomLevel = ZOOM_LEVEL\noptions.size = CGSize(width: WIDTH, height: HEIGHT)\n\nCSMapKit.shared.createMapSnapshot(with: options) { (snapshot, error) in\n\n}\n```\nOptionally, you can specify markeres to be drawn on the map by setting ```markers``` property on ```CSMapSnapshotOptions``` instance.\n\n## More Examples via the Sample App\n\nTo run the example project, clone the repo, and run `pod install` from the **Example** directory first.\nThen, in ```CSAppDelegate.m``` file, set your own `clientID` and `clientSecret`.\n\nThe example project is a mix of Swift and Objective-C.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedarstudios%2Fcedarmaps-ios-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedarstudios%2Fcedarmaps-ios-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedarstudios%2Fcedarmaps-ios-sdk/lists"}