Example application showing usage of Mapbox Vision SDK.
brew install SwiftGen(6.0 or later)brew install carthage(0.36.0 or later)
In order to fetch and use Vision SDK, you will need to obtain two tokens at tokens page in your Mapbox account:
- Public token: create a token that includes the
vision:readscope - Secret token: create another one with the
vision:downloadanddownloads:readscopes
In order to use your secret token, you will need to store it a .netrc file in your home directory. Depending on your environment, you may have this file already, so check first before creating a new one.
To set up the credentials required to download the SDK, add the following entry to your .netrc file:
machine api.mapbox.com
login mapbox
password <INSERT API TOKEN>
You'll also need your secret token while editing Cartfile during installation.
git clone https://github.com/mapbox/vision-ios-examples.gitcd vision-ios-examples- Open
Cartfileand uncomment two lines concerning Vision:binary "https://api.mapbox.com/downloads/...github "mapbox/mapbox-vision-ios"...
- Put your secret token instead of
<ADD-TOKEN-HERE>inCartfile carthage update --platform ios --use-netrcopen demo.xcodeproj- Put your public token into the value of the
MGLMapboxAccessTokenkey within theInfo.plistfile - Run the application
We use secret-shield tool which runs as a pre-commit hook. In order to enable it you should install it with:
npm install -g @mapbox/secret-shieldThen you have to add a pre-commit git hook. The simplest option is to copy the following script into a vision-ios-examples/.git/hooks/pre-commit:
#!/bin/sh
secret-shield --pre-commit -C verydeep --enable "Mapbox Public Key" --disable "High-entropy base64 string" "Short high-entropy string" "Long high-entropy string"Don't forget to make it executable:
chmod +x .git/hooks/pre-commitAs an option you can Integrate hook via git hooks manager (like Husky or Komondor). More information about installation is available here.