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: Sources/MapboxGeocoder/MBPlacemark.swift
+23-14
Original file line number
Diff line number
Diff line change
@@ -494,21 +494,14 @@ open class GeocodedPlacemark: Placemark {
494
494
}
495
495
496
496
@objcopenvarformattedName:String{
497
-
lettext= super.name
498
-
// 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.
499
-
iflet houseNumber = address, scope ==.address {
500
-
letstreetName= text
501
-
letreversedAddress="\(streetName)\(houseNumber)"
502
-
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.
509
-
return qualifiedNameComponents.first ?? text
497
+
guard scope ==.address else{
498
+
return name
499
+
}
500
+
if precision ==.intersection {
501
+
// For intersection features, `name` is just the first street name. The first line of the fully qualified address contains the cross street too.
502
+
return qualifiedNameComponents.first ?? name
510
503
}else{
511
-
returntext
504
+
returnstreetAddress ?? name
512
505
}
513
506
}
514
507
@@ -546,6 +539,22 @@ open class GeocodedPlacemark: Placemark {
546
539
return clippedAddressLines
547
540
}
548
541
542
+
@objcopenvarstreetAddress:String?{
543
+
guard scope ==.address else{
544
+
return properties?.address ?? address
545
+
}
546
+
guardlet address = address else{
547
+
return name
548
+
}
549
+
// 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).
550
+
letstreetAddress="\(name)\(address)"
551
+
if qualifiedNameComponents.contains(streetAddress){
0 commit comments