Uber's H3 wrapper for Swift

Uber's H3 wrapper for Swift
Photo by James Hon / Unsplash

I’m excited to share that I’ve successfully compiled the project in Xcode and built a static library for all Apple platforms.

For those unfamiliar with H3, it’s worth checking out. H3 is a spatial indexing system similar to GeoHash or quadtree, designed for managing geospatial data.

  • Clone the repository
    [email protected]:uber/h3.git
  • Make build directory in the folder
  • Next, run the following "special" command to generate the .xcodeproj file with the specified target platforms. In my setup, I've chosen to compile for arm64 and x86, but you can include additional ARM architectures if needed. I'm targeting iOS 17.0, but you can adjust the version target according to your requirements.
cmake -S .. -B _builds \
      -GXcode \
      -DCMAKE_SYSTEM_NAME=iOS \
      -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
      -DCMAKE_OSX_DEPLOYMENT_TARGET=17.0 \
      -DCMAKE_INSTALL_PREFIX=`pwd`/_install \
      -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \
      -DCMAKE_IOS_INSTALL_COMBINED=YES
  • That's it
  • When you open the project just make sure the create schemes automatically
  • Now time to build the project after setting the below conditions

Now you don't need to rely on any 3rd party package... Just you this in swift project though I wonder who would use this on client side...