AddressGeocoder is a helper tool to get the state and locality for a given zip code.
For example, providing 95014
will return Cupertino
as the city and CA
as the state.
AddressGeocoder relies on the CoreLocation APIs to get the address information, and parses the generated formatted address for better and more accurate results.
- iOS 9+
- Xcode 8
- Swift 3+
To use in your projects, simply add the following line to your Podfile:
pod 'AddressGeocoder'
You can then use AddressGeocoder by importing it into your files:
import AddressGeocoder
struct Geocoder: Geocodable { }
let geocoder = Geocoder()
geocoder.geocodeAddress(
using: "11201",
forCountry: "US",
completion: { (result: Result<GeocodedAddress, GeocodingError>) -> () in
if let address = result.value {
self.addressLabel.text = address.locality + ", " + address.state
}
}
)
To report a bug or enhancement request, feel free to file an issue under the respective heading.
If you wish to contribute to the project, fork this repo and submit a pull request.