-
Notifications
You must be signed in to change notification settings - Fork 10
Description
First of all, thanks for the library and great work!
This library exports some Double extensions for conveniently converting different units of length to meters.
I use a similar approach in one of my projects except I use Foundation's Measurement type to encode both values and units.
let length = 2.5.miles // Equivalent to Measurement(value: 2.5, unit: UnitLength.miles)
print(length.converted(to: .meters)) // 4023I find passing measurements around (when dealing with user I/O especially) is more convenient as I can deal with conversions easily where I need them (e.g. meters for calculations, miles for display, .etc) without enforcing that every length value is in meters. There are also some convenient methods for parsing strings into measurements with different units.
The problem is that my internal extensions conflict with the ones exported by this library. Since these are generally just convenience methods for writing tests, mocks, or similar hand-coded data, I'd like to propose that these extensions get pulled out into a separate target (e.g. GISToolsConversions) for selective inclusion in these use cases. Also, you can consider if the Measurement approach works better for you as well.
Happy to send over a PR with these changes, but as this is a breaking change, I wanted to discuss its viability first.