adding convenience streetAddress property
Hi
I would like to add a convenience streetAddress property for MBPlacemark.
I have noticed that for .address features name property contains only a street name and the house number is contained in address property.
The formattedName property already does it correctly (as it is defined as a street address for .address features), and also handles house number correctly putting it before or after a street name. So I have just extracted this logic into a separate method.
For non-address features I use the logic from addressDictionary which looks for an address first in properties?.address and then address property.
Thank you for your contributions. I added @1ec5 as a reviewer as I believe he has more context.
Any chance to start a review?
I'd love to see this get reviewed and merged. As it stands now, if I want to create an address with custom formatting, I have 2 options (neither are great):
- Parse
MBPlacemark.qualifiedName - Use the
addressandnameproperties for street address and dig intopostalAddressto get city, state, zip info. It doesn't make sense to have to use bits of data from both objects to build an address.
This PR solves this problem in one way. Another option would be to add the address number to MBPlacemark.postalAddress.street. Then, an address could be pieced together using the postalAddress (CNPostalAddress) property alone.
@1ec5 This look ok to me although we need new tests to cover this functionality
I've rebased the PR and added, in existing tests, a simple check for street address. Let me know if you have more sample data to test against.