A strongly typed unit conversion library for Swift with support for length, weight, time, temperature, and more.
Scale is a Swift library for performing unit conversions with strong typing and support for a wide range of physical quantities. It solves the problem of error-prone unit handling by providing a type-safe API that ensures operations are only performed on compatible units, automatically converting between them as needed.
iOS and macOS developers building apps that require precise unit conversions, such as scientific calculators, fitness trackers, engineering tools, or utility applications.
Developers choose Scale for its type-safe design, which prevents common unit conversion errors, and its expressive API that simplifies working with complex physical quantities in Swift.
:flags: Unit converter in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Units are strongly typed, preventing invalid operations between different types, as shown in examples where adding kilometers and meters results in a compile-time safe conversion.
Offers a clean, Swifty syntax with extensions like .kilometer and .meter, making code readable and intuitive for unit manipulations.
Supports a wide range of units including angle, area, energy, volume, temperature, time, length, and weight, covering many scientific and utility needs.
Allows addition, subtraction, multiplication, and division on compatible units, with automatic conversion to the smaller unit, simplifying calculations.
As noted in the README, temperature conversions require manual implementation, which can be error-prone and adds extra development overhead.
Adding new units involves creating .def files, running scripts, and manually including generated files, making it less agile for rapid prototyping or frequent updates.
Tied to the Swift ecosystem, so it's not suitable for projects using other languages or requiring cross-platform compatibility without additional bridging.