Pretty address from coordinates in iOS using RubyMotion

by Luke, Founder

For a recent project, I needed to generate a nice address from lat/long coordinates. I've done this many times on web-based applications. It turns out it's even easier in iOS.

  cllocation = CLLocation.alloc.initWithLatitude(52.107631, longitude:0.040305)
  onReverseGeocode = Proc.new do |placemarks, error|
    unless error
      placemark = placemarks.lastObject
      address.text = ABCreateStringWithAddressDictionary(placemark.addressDictionary, false) 
    end
  end
  CLGeocoder.new.reverseGeocodeLocation(cllocation, completionHandler: onReverseGeocode)

You can also create your own string by using the placemark properties rather than the standard format ABCreateStringWithAddressDictionary.

More articles

The Quotation Bank App — Bringing daily English Literature insights to students

We’re excited to share that **The Quotation Bank App** — developed in partnership with *The Quotation Bank* — is now live on the **App Store and Google Play**.

Read more

Enabling Apple Pay within Stripe Connect accounts

We've been working on a SaaS product for one of our clients and decided to use Stripe Connect to manage platform payments. Stripe Connect enables organizations onboarded into the…

Read more

Ready when you are

Let’s build something together

Whether you’re starting fresh or looking to improve things, we’re ready to talk.