You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MapboxGeocoder/MBPlacemark.swift
+23-14Lines changed: 23 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -488,21 +488,14 @@ open class GeocodedPlacemark: Placemark {
488
488
}
489
489
490
490
@objcopenvarformattedName:String{
491
-
lettext= super.name
492
-
// For address features, `text` is just the street name. Look through the fully-qualified address to determine whether to put the house number before or after the street name.
493
-
iflet houseNumber = address, scope ==.address {
494
-
letstreetName= text
495
-
letreversedAddress="\(streetName)\(houseNumber)"
496
-
if qualifiedNameComponents.contains(reversedAddress){
// For intersection features, `text` is just the first street name. The first line of the fully qualified address contains the cross street too.
503
-
return qualifiedNameComponents.first ?? text
491
+
guard scope ==.address else{
492
+
return name
493
+
}
494
+
if precision ==.intersection {
495
+
// For intersection features, `name` is just the first street name. The first line of the fully qualified address contains the cross street too.
496
+
return qualifiedNameComponents.first ?? name
504
497
}else{
505
-
returntext
498
+
returnstreetAddress ?? name
506
499
}
507
500
}
508
501
@@ -540,6 +533,22 @@ open class GeocodedPlacemark: Placemark {
540
533
return clippedAddressLines
541
534
}
542
535
536
+
@objcopenvarstreetAddress:String?{
537
+
guard scope ==.address else{
538
+
return properties?.address ?? address
539
+
}
540
+
guardlet address = address else{
541
+
return name
542
+
}
543
+
// For address features, `address` is a house number and `name` is just a street name. Look through the fully-qualified address to determine whether to put the house number after or before the street name (i.e. Chinese addresses).
544
+
letstreetAddress="\(name)\(address)"
545
+
if qualifiedNameComponents.contains(streetAddress){
0 commit comments