@@ -405,6 +405,7 @@ open class GeocodedPlacemark: Placemark {
405405
406406 private enum CodingKeys : String , CodingKey {
407407 case routableLocations = " routable_points "
408+ case relevance
408409 }
409410
410411 private enum PointsCodingKeys : String , CodingKey {
@@ -421,8 +422,6 @@ open class GeocodedPlacemark: Placemark {
421422 @objc open var routableLocations : [ CLLocation ] ?
422423
423424 public required init ( from decoder: Decoder ) throws {
424- try super. init ( from: decoder)
425-
426425 let container = try decoder. container ( keyedBy: CodingKeys . self)
427426
428427 if let pointsContainer = try ? container. nestedContainer ( keyedBy: PointsCodingKeys . self, forKey: . routableLocations) ,
@@ -433,13 +432,17 @@ open class GeocodedPlacemark: Placemark {
433432 routableLocations = [ CLLocation ( coordinate: coordinate) ]
434433 }
435434 }
435+
436+ relevance = try container. decodeIfPresent ( Double . self, forKey: . relevance) ?? - 1
437+
438+ try super. init ( from: decoder)
436439 }
437440
438441 public override func encode( to encoder: Encoder ) throws {
439- try super. encode ( to: encoder)
440-
441442 var container = encoder. container ( keyedBy: CodingKeys . self)
442443
444+ try container. encodeIfPresent ( relevance, forKey: . relevance)
445+
443446 if let routableLocations = routableLocations,
444447 !routableLocations. isEmpty {
445448 var pointsContainer = container. nestedContainer ( keyedBy: PointsCodingKeys . self, forKey: . routableLocations)
@@ -448,6 +451,8 @@ open class GeocodedPlacemark: Placemark {
448451 routableLocations [ 0 ] . coordinate. latitude] )
449452 try coordinatesContainer. encode ( routableLocation)
450453 }
454+
455+ try super. encode ( to: encoder)
451456 }
452457
453458 @objc open override var debugDescription : String {
@@ -486,6 +491,13 @@ open class GeocodedPlacemark: Placemark {
486491 return properties? . maki
487492 }
488493
494+ /**
495+ A numerical score from 0 (least relevant) to 0.99 (most relevant) measuring
496+ how well each returned feature matches the query. Use this property to
497+ remove results that don’t fully match the query.
498+ */
499+ @objc open var relevance : Double
500+
489501 private var clippedAddressLines : [ String ] {
490502 let lines = qualifiedNameComponents
491503 if scope == . address {
0 commit comments