mapbox/mapbox-search-ios
- [Overview](#overview)
Documentation
You can find more documentation at docs.mapbox.com:
Requirements
- iOS 12.0 and newer
- Xcode 16.0 and newer
- Swift 5.9 and newer
- Objective-C is not supported
- macOS/tvOS/watchOS platforms currently are not supported
Main features
- Easy-to-use pre-tuned search options to integrate search into your app quickly.
- Local search for a specific address or POI
- Pre-configured and customizable category search for popular categories like cafes, ATMs, hotels, and gas stations.
- On-device user search history
- On-device favorites
- Import/export customer data with your own protocols
- Provide you own persistent providers for customer data like History or Favorites
Getting Started
You can install MapboxSearch and/or MapboxSearchUI packages with Swift Package Manager and Cocoapods. Swift Package Manage is our preferred distribution system.
Installation
Private token configuration
To download the SDK you will need to configure a private token. This token is required for every supported distribution system.
- Go to your Mapbox account dashboard and create an access token that has the
DOWNLOADS:READscope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. - Create a file named
.netrcin your home directory ($HOME/.netrc, e.g./Users/username/.netrc) if it doesn’t already exist, then add the following lines to the end of the file:
`` machine api.mapbox.com login mapbox password PRIVATE_MAPBOX_API_TOKEN ` where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the DOWNLOADS:READ` scope.
Swift Package Manager
Add the MapboxSearch dependency to your Package.swift or use the Xcode > Project settings > Package Dependencies tab.
dependencies: [
.package(url: "https://github.com/mapbox/mapbox-search-ios.git")
]Cocoapods
MapboxSearch
To integrate latest pre-release version of MapboxSearch into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'MapboxSearch', ">= 2.23.0-rc.1", "< 3.0"MapboxSearchUI
To integrate latest pre-release version of MapboxSearchUI into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'MapboxSearchUI', ">= 2.23.0-rc.1", "< 3.0"Contributing
We welcome feedback and code contributions!
If you found a bug or want to request a feature open a github issue. Please use the appropriate issue template.
Development
- Check that Homebrew is installed by running
brew -v. If you don't have Homebrew, install before proceeding. - Update Homebrew data to install latest tools versions:
- brew update && brew bundle install
- Set up .netrc file for sdk registry access
1. Create .netrc file in user home directory ($HOME/.netrc, e.g. /Users/victorprivalov/.netrc) 2. File content: `` machine api.mapbox.com login mapbox password sk.ey_Your_Access_Token_With_Read_permission ``
- Set up commit hooks with
./scripts/install_git_hooks
- Build dependencies:
make dependencies
- Mapbox APIs require a Mapbox account and access token. Get an access token from the Mapbox account page. To run a Demo you can provide a token in different ways:
1. Create a new file named mapbox or .mapbox in your home directory with content of your access token. We also support .mapbox file in the repository root folder. MapboxSearchDemoApplication will automatically handle this key and insert it in corresponding place. 1. Open the Workspace, choose MapboxSearchDemoApplication project and select "Info" tab for "MapboxSearchDemoApplication" target. Here you may set your accessToken for MBXAccessToken key in "Custom iOS Target Properties" section.
- Alternatively, you could provide your accessToken as a parameter to
SearchEngine.initand other initializers that accept anaccessTokenparameter. Use this approach to deliver your key dynamically and implement a key rotation schedule.
Code of Conduct
Our Standards
Examples of behavior that contributes to creating a positive environment include:
- Using welcoming and inclusive language.
- Being respectful of differing viewpoints and experiences.
- Gracefully accepting constructive criticism.
- Focusing on what is best for the community.
- Showing empathy towards other community members.
We recommend reading this blog post from Github on writing great PRs..
Versioning
We use SemVer for versioning. For the versions available, see the tags on repository.
Package Metadata
Repository: mapbox/mapbox-search-ios
Default branch: main
README: README.md