Skip to content

Commit f748e00

Browse files
authored
Merge pull request #84 from mapbox/fix-allowed-region
fix crash in allowedRegion use & add test
2 parents fc2364f + c2d7e8e commit f748e00

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

MapboxGeocoder/MBRectangularRegion.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public class RectangularRegion: CLRegion {
4747
&& northEast.latitude == object.northEast.latitude && northEast.longitude == object.northEast.longitude)
4848
}
4949

50+
public override var description: String {
51+
return "\(southWest.longitude),\(southWest.latitude),\(northEast.longitude),\(northEast.latitude)"
52+
}
53+
5054
/**
5155
Returns a Boolean value indicating whether the bounding box contains the specified coordinate.
5256
*/

MapboxGeocoderTests/ForwardGeocodingTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ForwardGeocodingTests: XCTestCase {
2323
var addressPlacemark: GeocodedPlacemark! = nil
2424
let options = ForwardGeocodeOptions(query: "1600 pennsylvania ave")
2525
options.allowedISOCountryCodes = ["CA"]
26+
options.allowedRegion = RectangularRegion(southWest: CLLocationCoordinate2D(latitude: -85, longitude: -179), northEast: CLLocationCoordinate2D(latitude: 85, longitude: 179))
2627
let task = geocoder.geocode(options: options) { (placemarks, attribution, error) in
2728
XCTAssertEqual(placemarks?.count, 4, "forward geocode should have 4 results")
2829
addressPlacemark = placemarks![0]

0 commit comments

Comments
 (0)