Giter Club home page Giter Club logo

scale's Introduction

Scale

Unit converter in Swift

[![CI Status](http://img.shields.io/travis/Khoa Pham/Scale.svg?style=flat)](https://travis-ci.org/Khoa Pham/Scale) Version License Platform Carthage compatible

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Features

Unit

  • Strongly typed unit
  • Division may throw error
  • Operation upon same type, the result is the smaller unit of the two
let length = 5.kilometer + 7.meter  // 5007 meter
let weight = 10.0.kilogram * 5.gram // 50000 gram
  • Convert to any unit of the same type
2.week.to(unit: .hour) // 336 hour

Support

  • Angle
let angle = 5.degree + 2.radian
  • Length
let length = 5.yard + 2.meter
  • Area
let area = 5.acre + 2.hectare
  • Energy
let energy = 5.joule + 2.watthour
  • Metric
let metric = 5.base + 2.kilo
  • Volume
let volume = 5.liter + 2.gallon
  • Temperature
let temperature = 5.fahrenheit + 2.celsius
  • Time
let time = 5.day + 2.hour
  • Weight
let weight = 5.kilogram + 2.pound

Add more

  • Add new definition file with extension .def inside Definitions group
  • Run xcrun swift Script.swift inside Script group
  • Add newly generated files into Output group, target Scale
  • Go into Example and pod install

Notes

Some unit types like Temperature must be converted manually

Installation

Scale is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Scale"

Author

Khoa Pham, [email protected]

License

Scale is available under the MIT license. See the LICENSE file for more info.

scale's People

Contributors

onmyway133 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.