The Mapbox Search SDK is a developer toolkit to add location search on mobile devices. With the same speed and scale of the Mapbox Search API, the SDK is built specifically for on-demand and local search use cases, like ride-share, food delivery, and store finders apps. Whether your users are trying to find a place among the vast amount of data on a global map, or to find the exact location of a venue a few miles down the road, the Search SDK provides location search for countries all over the globe, in many different languages.
Previously, implementing search into your application required custom tuning with every API request to set a language, location biasing, and result types. There was no pre-built UI and no option for a user to see their search history, or save favorites.
The Mapbox Search SDK allows you to drop pre-tuned search into your application, removing the complexity of API configuration, while still giving you control to customize. It ships with an optional UI framework, or you can build a completely custom implementation with your own UI elements by using the core library. The Search SDK is pre-configured for autocomplete, local search biasing, and includes new features like category search, search history, and search favorites.
The SDK requires Carthage which you can install using Homebrew.
brew -v
. If you don't have Homebrew, install before proceeding.brew update
brew install carthage
or brew upgrade carthage
$HOME/.netrc
, e.g. /Users/victorprivalov/.netrc
)machine api.mapbox.com
login mapbox
password sk.ey_your_access_token_wit_Read_permission
make dependencies
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.
Note: Run pbpaste > ~/.mapbox
in Terminal.app to insert you Pastebord (Command+C buffer) into .mapbox
in Home directory.
Open the Workspace, choose MapboxSearchDemoApplication
project and select "Info" tab for "MapboxSearchDemoApplication" target. Here you can set your accessToken for MGLMapboxAccessToken
key in "Custom iOS Target Properties" section.
Provide your accessToken directly in argument named accessToken
in SearchDrawer.make(:)
method
Once you've installed the prerequisites, no additional steps are needed: Open the Workspace and use any available scheme. The SDK includes a demo app that you can run on your iOS device or simulator by choosing MapboxSearchDemoApplication.
The link to iOS documentation will be added soon (instruction on how to build, usage the API, ready-to-use examples).
MapboxSearch project consist of five targets:
search-native.a written in C++ and MapboxCoreSearch.framework is generated by bindgen using Objective-C++ language. Both targets live in submodule and get compiled by scripts in this submodule.
While search-native.a implements most of the shared logic, MapboxSearch.framework contains all the platform business logic for Search.
MapboxSearchUI.framework provides a default UI implementation with customization points to meet the most common customer needs. The UI elements include a search bar with result list, category search icons, history and favorites management, and a combined search/category search UI. (Screenshots coming soon)
MapboxSearchDemoApplication provides a Demo app wih MapboxSearchUI.framework presentation over the basic MapView. To get access to nightly builds in TestFlight, make a request to Search iOS developers.
To integrate latest preview version of MapboxSearch
into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'MapboxSearch', ">= 1.0.0-beta", "< 2.0"
To integrate latest preview version of MapboxSearchUI
into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'MapboxSearchUI', ">= 1.0.0-beta", "< 2.0"
dependencies: [
.package(url: "https://github.com/mapbox/mapbox-search-ios.git")
]
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.
Examples of behavior that contributes to creating a positive environment include:
We recommend reading this blog post from Github on writing great PRs..
We use SemVer for versioning. For the versions available, see the tags on repository.
link |
Stars: 11 |
Last commit: 2 weeks ago |
formattedAddress
function to perform default address formatting.countryISO1
and countryISO2
properties to the result's address.Address
type of the Result
to the AddressComponents
.Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics