{"id":1378,"url":"https://github.com/poulpix/PXGoogleDirections","last_synced_at":"2025-08-06T13:32:35.474Z","repository":{"id":28005138,"uuid":"31499556","full_name":"poulpix/PXGoogleDirections","owner":"poulpix","description":"Google Directions API helper for iOS, written in Swift","archived":false,"fork":false,"pushed_at":"2019-03-04T07:50:27.000Z","size":253271,"stargazers_count":268,"open_issues_count":6,"forks_count":56,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-17T17:37:39.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/poulpix.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":"2015-03-01T14:54:47.000Z","updated_at":"2024-09-10T15:01:47.000Z","dependencies_parsed_at":"2022-09-02T10:51:00.042Z","dependency_job_id":null,"html_url":"https://github.com/poulpix/PXGoogleDirections","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poulpix%2FPXGoogleDirections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poulpix%2FPXGoogleDirections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poulpix%2FPXGoogleDirections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poulpix%2FPXGoogleDirections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poulpix","download_url":"https://codeload.github.com/poulpix/PXGoogleDirections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228905463,"owners_count":17989772,"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":"2024-01-05T20:15:45.082Z","updated_at":"2024-12-09T14:30:51.465Z","avatar_url":"https://github.com/poulpix.png","language":"Swift","funding_links":[],"categories":["Maps","Libs","Networking","API [🔝](#readme)"],"sub_categories":["Other Hardware","API","Other free courses"],"readme":"# PXGoogleDirections\nGoogle Directions API SDK for iOS, entirely written in Swift.\n\n[![Cocoapods](https://img.shields.io/cocoapods/p/PXGoogleDirections.svg?style=plastic)](https://img.shields.io/cocoapods/p/PXGoogleDirections.svg)\n[![Cocoapods](https://img.shields.io/cocoapods/l/PXGoogleDirections.svg?style=plastic)](https://img.shields.io/cocoapods/l/PXGoogleDirections.svg)\n![Swift](https://img.shields.io/badge/%20in-swift%204.2-orange.svg?style=plastic)\n\n[![Cocoapods compatible](https://img.shields.io/badge/Cocoapods-compatible-4BC51D.svg?style=plastic)](https://cocoapods.org)\n[![Cocoapods](https://img.shields.io/cocoapods/v/PXGoogleDirections.svg?style=plastic)](https://img.shields.io/cocoapods/v/PXGoogleDirections.svg)\n[![CocoaPods](https://img.shields.io/cocoapods/metrics/doc-percent/PXGoogleDirections.svg?style=plastic)]()\n[![CocoaPods](https://img.shields.io/cocoapods/dt/PXGoogleDirections.svg?style=plastic)]()\n[![CocoaPods](https://img.shields.io/cocoapods/at/PXGoogleDirections.svg?style=plastic)]()\n[![CocoaPods](https://img.shields.io/cocoapods/aw/PXGoogleDirections.svg?style=plastic)]()\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=plastic)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager incompabible](https://img.shields.io/badge/Swift%20Package%20Manager-incompatible-red.svg?style=plastic)](https://swift.org/package-manager/)\n\n[![GitHub stars](https://img.shields.io/github/stars/poulpix/PXGoogleDirections.svg?style=social\u0026label=Star\u0026style=plastic)]()\n[![GitHub forks](https://img.shields.io/github/forks/poulpix/PXGoogleDirections.svg?style=social\u0026label=Fork\u0026style=plastic)]()\n[![GitHub watchers](https://img.shields.io/github/watchers/poulpix/PXGoogleDirections.svg?style=social\u0026label=Watch\u0026style=plastic)]()\n[![Twitter Follow](https://img.shields.io/twitter/follow/_RomainL.svg?style=social\u0026label=Follow\u0026style=plastic)]()\n\n## 🗺 Features\n- Supports all features from the Google Directions API as of August 2018 (see here for a full list: https://developers.google.com/maps/documentation/directions)\n- Supports \"open in Google Maps app\", both for specific locations and directions request\n  * also supports the callback feature to get the user back to your app when he's done in Google Maps\n  * in case the Google Maps app is not installed, also supports fallback to the built-in Apple Maps app\n- Available both with modern, Swift-style completion blocks, or Objective-C-style delegation patterns\n- Queries are made over HTTPS\n- JSON is used behind the scenes to help reduce the size of the responses\n- Available through CocoaPods and Carthage\n\n## 🆕 New in V1.6\n- Compatibility with Google Places IDs (usage: `PXLocation.googlePlaceId(\"gplaceid\")`, or `PXLocation.googlePlaceId(gmsPlace.placeID)` if you're already using Google's Places SDK for iOS)\n- Compatibility with Swift 4.2\n- Updated to Google Maps iOS SDK 2.7\n- ~~Availability through Swift Package Manager~~ (cancelled for V1.6)\n\n## 🆕 New in V1.5.1\n- Updated to Google Maps iOS SDK 2.5\n- The PXGoogleDirections Pod is now released as a static library (requires Cocoapods 1.4.0) \n- Other bug fixes\n\n## 🆕 New in V1.4\n- Compatibility with Swift 4\n- Availability through Carthage\n- Slight improvements to projects mixing this pod with Google Maps and/or Google Places pods (but mixing Google Maps iOS SDK with other Pods is still terrible...)\n\n## 🆕 New in V1.3\n- Full Swift 3 support\n- Full Google Maps iOS SDK 2.0+ support\n- Added a `trafficModel` property on the `PXGoogleDirections` class to match Google's one in the API (recently added); it works only for driving routes, and when a departure date is specified\n- Fixed a bug where drawing a route would only draw a basic, rough representation of it taken from the route object; now there is an option for drawing a detailed route in the `drawOnMap` method of the `PXGoogleDirectionsRoute` class\n- Other small bug fixes\n\n## ⚠️ Requirements\n- Runs on iOS 9.3 and later.\n- Compatible with Swift 4 / Xcode 9 and later.\n  - Please use v1.3 if you are on Swift 3 and/or Xcode 8.\n  - Please use v1.2.3 if you need compatibility with a previous version of Swift.\n- The SDK depends on the official Google Maps SDK for iOS (more information here: [Google Maps iOS SDK](https://developers.google.com/maps/documentation/ios/))\n\n## 💻 Installation\n### From Carthage\nTo use PXGoogleDirections in your project add the following line to your `Cartfile`:\n\n```\ngithub \"Poulpix/PXGoogleDirections\"\n```\n\n___\n\u003e Alternatively, if you wish to target a specific version of the library, simply append it at the end of the line in the `Carttfile`, e.g.: `github \"Poulpix/PXGoogleDirections\" ~\u003e 1.5`.\n\n___\n\nThen run the following command from the Terminal:\n\n```bash\ncarthage update\n```\n\nFinally, back to Xcode, drag \u0026 drop the generated framework in the \"Embedded Binaries\" section of your target's General tab. The framework should be located in the `Carthage/Build/iOS` subfolder of your Xcode project.\n\n![Dropping a Carthage-generated framework in Xcode](CarthageXcode.png)\n\n___\n\u003e **Important**: Carthage is only supported starting from version 1.4 of this library. Previous versions of this library will not work.\n\n___\n\n### From Cocoapods\nTo use PXGoogleDirections in your project add the following `Podfile` to your project:\n\n```\nsource 'https://github.com/CocoaPods/Specs.git'\n\nplatform :ios, '9.3'\nuse_frameworks!\n\npod 'PXGoogleDirections'\n```\n\nThen run the following command from the Terminal:\n\n```bash\npod install\n```\n\n___\n\u003e **Important**: If your project needs both PXGoogleDirections and Google Maps and/or Google Places iOS SDK, you **_will_** run into problems. Please see the \"Compatibility with Google pods\" paragraph below, and do not hesitate to contact me and describe your issue if you require assistance!\n\n___\n\n### From source\nBuilding from raw source code is the preferred method if you wish to avoid known issues with the Google Maps iOS SDK conflicts with the library. However, you'll be lacking the automation and version updates the Cocoapods and Carthage frameworks provide.\n\nTo build from source, follow these simple steps:\n\n- Clone the repository\n- Add the whole `PXGoogleDirections` project to your own Xcode project\n- Add a dependency between the two projects and build\n- Do not forget to add the output of the `PXGoogleDirections` project (`PXGoogleDirections.framework`) to the \"Embedded Binaries\" section of your Xcode project's main target\n\n![Adding the PXGoogleDirections framework as an embedded binary in Xcode](EmbeddedBinariesXcode.png)\n\n## ⌨️ Usage\nQuick-start in two lines of Swift code:\n\n1) Reference the library like this:\n\n```swift\nimport PXGoogleDirections\n```\n\n2) Create an API object:\n```swift\nlet directionsAPI = PXGoogleDirections(apiKey: \"\u003cinsert your Google API key here\u003e\",\n    from: PXLocation.coordinateLocation(CLLocationCoordinate2DMake(37.331690, -122.030762)),\n    to: PXLocation.specificLocation(\"Googleplex\", \"Mountain View\", \"United States\"))\n```\n3) Run the Directions request:\n```swift\ndirectionsAPI.calculateDirections({ response in\n switch response {\n  case let .error(_, error):\n   // Oops, something bad happened, see the error object for more information\n   break\n  case let .success(request, routes):\n   // Do your work with the routes object array here\n   break\n }\n})\n```\n___\n\u003e **Important**: You normally don't need to call `GMSServices.provideAPIKey()` yourself: it will be called by PXGoogleDirections when initializing the SDK.\n\n___\n\nSee \"Documentation\" below for more information on the available properties and response data.\n\n## 📚 Documentation\nThe SDK provides an integrated documentation within Xcode, with full autocomplete support.\n\nTo help getting you started, a sample project is also available in the \"Sample\" subfolder of this repository.\n\nIt is designed to demo the main features of both the API and the SDK.\n\n![Sample app screenshot 1](Mockup1.png) ![Sample app screenshot 2](Mockup2.png)\n\n## 😱 Compatibility with Google pods\nSince V1.3, PXGoogleDirections uses Google's latest branch of Google Maps iOS SDK, which has now been split into smaller, more modular frameworks. PXGoogleDirections has a dependency with three of them:\n- `GoogleMapsCore`\n- `GoogleMapsBase`\n- `GoogleMaps`\n\n\u003e The Google Places iOS SDK is not required.\n\nIf your app also requires the Google Maps iOS SDK (for drawing on a map, for example), you **_will_** run into troubles because of conflicts with the bundled Google Maps iOS SDK in the pod. This is because of Google's way of releasing its pods as static frameworks, and not dynamic ones.\n\nHere is the only workaround known to date:\n\n1. Remove PXGoogleDirections from your Podfile and issue a `pod update`.\n2. Add all the Google dependencies to your Podfile (e.g.: `pod GoogleMaps`, `pod GooglePlaces`) and issue a `pod update`.\n3. Open a Terminal in your folder's root folder, and reference PXGoogleDirections as a git submodule, like this:\n```\ngit submodule add https://github.com/poulpix/PXGoogleDirections.git Frameworks/External/PXGoogleDirections\n```\n   This will download all of the PXGoogleDirections project in a subfolder of your own project (`Frameworks/External/PXGoogleDirections`). Of course you can change this path if you like.\n   \n___\n\u003e **Important**: You may also request a specific version of the framework by adding the `-b \u003cbranch\u003e` switch to the `git submodule` command, like this:\n\u003e \n\u003e `git submodule add -b \u003cbranch\u003e https://github.com/poulpix/PXGoogleDirections.git Frameworks/External/PXGoogleDirections`\n\u003e \n\u003e To find out the appropriate branch name, check out all the available branches on [Github](https://github.com/poulpix/PXGoogleDirections/branches/all)\n\n___\n\n4. Update your Podfile to give instructions on how to build both your project and the PXGoogleDirections submodule:\n\n   ```\n   source 'https://github.com/CocoaPods/Specs.git'\n   \n   workspace 'test.xcworkspace' # Your project's workspace\n   project 'test.xcodeproj' # Your project's Xcode project\n   project 'Frameworks/External/PXGoogleDirections/PXGoogleDirections.xcodeproj' # Update folder structure if needed\n   \n   target 'test' do\n      project 'test.xcodeproj'\n      platform :ios, '10.0' # Update for your needs\n   \n      use_frameworks!\n   \n      # Update these lines depending on which Google pods you need\n      pod 'GoogleMaps'\n      pod 'GooglePlaces'\n      # Other pods...\n   end\n   \n   # This tells Cocoapods how to build the subproject\n   target 'PXGoogleDirections' do\n      project 'Frameworks/External/PXGoogleDirections/PXGoogleDirections.xcodeproj'\n      platform :ios, '9.3'\n   \n      pod 'GoogleMaps'\n   end\n   ```\n5. Now you need to do a `pod install` in two locations:\n  * your project's root directory,\n  * the PXGoogleDirections submodule's root directory (e.g. `Frameworks/External/PXGoogleDirections`).\n6. Open Xcode with your project.xcworkspace and build the PXGoogleDirections target, then your app's target. Everything should build properly.\n\n## 💣 Known issues\nDepending on your setup, you might see one or several of these known issues:\n\n- Lots of messages like these at runtime (usually application startup): `Class GMSxxx_whatever is implemented in both (name of your app) and (reference to PXGoogleDirections framework). One of the two will be used. Which one is undefined.`\n  This is because with Carthage or Cocoapods you usually have two versions of the Google Maps iOS SDK : the one that has been linked with the PXGoogleDirections library, and the one you will be forced to link against in your own application if you wish to use it explicitly. From what I've seen, there is no real impact to these warnings as long as both versions are equivalent. They only pollute your output console at runtime.\n  \n- Messages like these at runtime (usually when showing a Google Maps view): `Main Thread Checker: UI API called on a background thread: -[UIApplication setNetworkActivityIndicatorVisible:]`\n  This behavior is new to Xcode 9, and it seems like the culprit is the Google Maps iOS SDK itself, not the sample app provided with the library. These messages are not really harmful, but they are not sane either. If you find a solution, please PM me!\n  \n- The framework is not yet ready for Swift Package Manager since it requires static linking to Google Maps iOS SDKs and inclusion of a Google Maps resources bundle; both of those tasks can't be done with Swift Package Manager at this time.\n\n## 🙏🏻 Credit\n- Some portions of code inspired by [OpenInGoogleMaps-iOS](https://github.com/googlemaps/OpenInGoogleMaps-iOS), from the Google Maps team.\n- Kudos to [@embasssem](https://github.com/embassem) for providing a workaround with Google SDKs ([#28](https://github.com/poulpix/PXGoogleDirections/issues/28)).\n\n## 📜 License\nThe PXGoogleDirections SDK is licensed under the New BSD license. (see LICENSE for more information.)\n\n## 📮 Contact\nDon't hesitate to drop me a line on Github, Twitter, Stack Overflow, or by email:\n- https://github.com/poulpix\n- https://twitter.com/_RomainL\n- http://stackoverflow.com/users/145997/romain\n- dev (dot) romain (at) me.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoulpix%2FPXGoogleDirections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoulpix%2FPXGoogleDirections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoulpix%2FPXGoogleDirections/lists"}