Swiftpack.co -  hlemai/SwiftReverseGeoCode as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Local reverse geocoding with swift
.package(url: "https://github.com/hlemai/SwiftReverseGeoCode.git", from: "1.0.0")


Offline GeoCoding class based on GeoNames data. This package provide a fast and efficient way for translating GPS Coordinate in textual location.

Adapted from Lucas Spiller offline-geocoder project. Thanks to him for the clean documentation and explanations.


As explain Lucas Spiller, " This uses data from the GeoNames project, which is free to use under the Creative Commons Attribution 3.0 license. To enable this to work offline, the data is imported into a SQLite database which is roughly 12 MB, so easily embeddable within an application. "

Database Setup

First you should build a sqlite database that contains all the relevant point of interest.

cd Data

This script download data on geonames web site, and fill the sql database. In comment you can choose to get only important cities or a full coverage of worldwide location. It's easy to adapt the script to download only one country.


The librairy is available within swift package manager. the url of the package is

.package(url: "https://github.com/hlemai/SwiftReverseGeoCode.git", from : "1.0.0"),

The name of the librairy is SwiftReverseGeoCode.

The result are provided in a LocationDescription Struct. The nearest point of interest in the database is returned.

let reverseService = ReverseGeoCodeService(database: "path/to/geocitydb.sqlite")

let location = try reverseService.ReverseGeoCode(latitude: 37.78772166666667, longitude: -122.40679166666666)

// location.countryCode == "US"
// location.name == "Chinatown"


This library is licensed under the MIT license.

You don't need to give this library attribution, but you must do so for GeoNames if you use their data!


Stars: 0
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics