File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,7 @@ public class MBGeocoder: NSObject {
2323 - param host: An optional hostname to the server API. The Mapbox Geocoding API endpoint is used by default.
2424 */
2525 public init ( accessToken: String , host: String ? = nil ) {
26- let baseURLComponents = NSURLComponents ( )
27- baseURLComponents. scheme = " https "
28- baseURLComponents. host = host
29- configuration = MBGeocoderConfiguration ( accessToken, apiEndpoint: baseURLComponents. string)
26+ configuration = MBGeocoderConfiguration ( accessToken, host: host)
3027 }
3128
3229 private var task : NSURLSessionDataTask ?
Original file line number Diff line number Diff line change @@ -5,8 +5,13 @@ internal struct MBGeocoderConfiguration: Configuration {
55 internal var apiEndpoint : String = " https://api.mapbox.com "
66 internal var accessToken : String ?
77
8- internal init ( _ accessToken: String , apiEndpoint : String ? = nil ) {
8+ internal init ( _ accessToken: String , host : String ? = nil ) {
99 self . accessToken = accessToken
10- self . apiEndpoint = apiEndpoint ?? self . apiEndpoint
10+ if let host = host {
11+ let baseURLComponents = NSURLComponents ( )
12+ baseURLComponents. scheme = " https "
13+ baseURLComponents. host = host
14+ apiEndpoint = baseURLComponents. string ?? apiEndpoint
15+ }
1116 }
1217}
You can’t perform that action at this time.
0 commit comments