Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keisukeyamagishi/direction
Swift iOS GoogleMap
https://github.com/keisukeyamagishi/direction
google google-maps google-maps-api swift
Last synced: about 2 months ago
JSON representation
Swift iOS GoogleMap
- Host: GitHub
- URL: https://github.com/keisukeyamagishi/direction
- Owner: keisukeYamagishi
- License: mit
- Created: 2017-12-20T14:49:24.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-09-08T08:12:14.000Z (over 1 year ago)
- Last Synced: 2024-10-11T18:32:00.040Z (3 months ago)
- Topics: google, google-maps, google-maps-api, swift
- Language: Swift
- Homepage:
- Size: 147 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Direction
[![](https://img.shields.io/badge/lang-Swift-fc3158)](https://swift.org/)
## OverView
Direction for Google Map for iOS SDK
It is a library that makes it easy to conduct route search with the Google map SDK for iOS.
When creating an instance, you can display the route by passing the latitude and longitude of the departure point, the latitude and longitude of the arrival point as an argument, and calling the instance method.## Use it
|CI|build|
|:----|:----|
|github actions|[![build](https://github.com/keisukeYamagishi/Direction/actions/workflows/swift.yml/badge.svg)](https://github.com/keisukeYamagishi/Direction/actions/workflows/swift.yml)|***Via SSH***: For those who plan on regularly making direct commits, cloning over SSH may provide a better experience (which requires uploading SSH keys to GitHub):
```
$ git clone [email protected]:keisukeYamagishi/Direction.git
```
***Via https***: For those checking out sources as read-only, HTTPS works best:```
$ git clone https://github.com/keisukeYamagishi/Direction.git
```
## Easy startdefault map line width 0.6f
default map color blue### recommended Color library
A library that can convert recommended hexadecimal numbers to colors
[SHColor](https://cocoapods.org/pods/SHColor)
get route!!!!
## Installation
### Cocoapods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```
To integrate GMSDirection into your Xcode project using CocoaPods, specify it in your `Podfile`:```
vi ./Podfile
```If you do not have the google map SDK for iOS
```
target 'Target Name' do
use_frameworks!
pod 'Direction'
# google map SDK for iOS
pod 'GoogleMaps'
pod 'GooglePlaces'
end
```
Then, run the following command:```bash
$ pod setup
$ pod install
```### parameter
|params|result|type|
|:---|:----|:----|
|from| start location|String or CLLocationCoordinate2D|
|to | end location|String or CLLocationCoordinate2D|
|alternative| multiple route| Bool default false |
|mode|route type|DirectionType walking driving bicycling|### Sample Code
```swift
let direction = Direction(from:"35.6775602107869,139.692658446729",to: "35.707848364433,139.701456092298",mode: .walking)
direction.detectRoute(completion: { [unowned self] route in
guard let routes = route.routes as? [Routes] else {
return
}
self.mapView.addDirection(routes: routes, color: .blue)
}, failure: { error in
print(error)
})
```
*too easy!!*Please pass the first position and the goal of the position as parameter
get route
### Error
10058:
When the status code is 200 and data can be acquired, but there is API key or parameter problem and route can not be acquired
10059:
If a status code other than 200 returns, it will give an HTTPURLResponse Http response code and return an error.
10060:
Unknow Error