Skip to content

A helper tool to get the state and locality for a given zip code.

License

Notifications You must be signed in to change notification settings

klein-thibault/AddressGeocoder

Repository files navigation

AddressGeocoder

Travis build status Cocoapods Compatible Platform Docs

Description

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.

Requirements

  • iOS 9+
  • Xcode 8
  • Swift 3+

Installation

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

Usage

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
    }
  }
)

Contributing to AddressGeocoder

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.

About

A helper tool to get the state and locality for a given zip code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •