mapbox / mapbox/MapboxGeocoder.swift

Read API base URL from Info.plist

Open
#107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
133
Forks
46
PR merge metrics
No merged PRs in 30d

Description

If no host is passed into Geocoder(accessToken:host:), the fallback hostname should be either api.mapbox.com or api.mapbox.cn depending on the value of MGLMapboxAPIBaseURL in Info.plist:

https://github.com/mapbox/MapboxGeocoder.swift/blob/faa288dcf09f9dbcab1a54e61e741932f3945239/MapboxGeocoder/MBGeocoder.swift#L154

This would be consistent with how we read the access token out of Info.plist:

https://github.com/mapbox/MapboxGeocoder.swift/blob/faa288dcf09f9dbcab1a54e61e741932f3945239/MapboxGeocoder/MBGeocoder.swift#L147

This will make it easier for developers to keep their map and geocoder usage in sync, since Geocoder.shared would automatically pick up the API endpoint specified in Info.plist. Developers who need a different value for the geocoder can still override the API base URL when creating a separate Geocoder instance.

/cc @pdgoodman

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MapboxGeocoder/MBGeocoder.swift around lines 147-154, comparing the existing access-token lookup in Info.plist with the fallback host logic. The change is done when an omitted host selects api.mapbox.com or api.mapbox.cn from MGLMapboxAPIBaseURL while an explicitly supplied host remains an override.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.