You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Breaking
encode, adjacent and neighbors now return optionals and yield nil for invalid input instead of crashing or returning garbage, matching decode:
encode(latitude:longitude:length:) and encode(latitude:longitude:precision:) return String? (nil for a negative length, or a NaN, infinite or out-of-range coordinate).
CLLocationCoordinate2D.geohash(length:) and geohash(precision:) return String?.
adjacent(geohash:direction:) returns String? and neighbors(geohash:) returns [String]? (nil for an empty hash or a character outside the base32 alphabet).
adjacent returns nil instead of wrapping around when going north from the top row or south from the bottom row, and neighbors returns nil for cells that touch a pole. East and west still wrap around the antimeridian.
Renamed Precision.twoHundredFourtyCentimeters to twoHundredFortyCentimeters.
Fixes
decode returned a bogus box for some invalid input (for example "aaaaa" or an uppercase hash) instead of nil (#12).
encode is now linear in the hash length instead of quadratic (#15).
Other
Geohash.Direction and Geohash.Precision are Sendable.
Tests migrated to Swift Testing; removed the obsolete LinuxMain.swift and manifests (#14).
Removed dead code and a duplicated base32 alphabet (#16).