Code Monkey home page Code Monkey logo

humanmeasurementswift's Introduction

HumanMeasurement

2022 © Weizhong Yang a.k.a zonble

Syntax sugar for NSMeasurement of Foundation.

NSMeasurement and NSUnit compose a great tool to let you do unit conversion easily when you are coding with Swift. You can use them to convert length, temperature, mass, speed and so on. However, you want the API design to be easier.

For example, if you want to convert a temperature from Celsius to Fahrenheit, your code using NSMeasurement looks like:

let celsius = 25.0
let fahrenheit = Measurement<UnitTemperature>(value: celsius, unit: .celsius).converted(to: .fahrenheit).value

The package helps you to code like:

let celsius = 25.0
let fahrenheit = Temperature(celsius: celsius).fahrenheit

Installation

You can install the package using Swift package manager. Add the following lines to your Packages.swift file:

dependencies: [
    .package(url: "https://github.com/zonble/HumanMeasurement.git"),
],

humanmeasurementswift's People

Contributors

zonble avatar

Stargazers

ebigram avatar AlexHu_tw avatar Liang, Kai-Chih avatar Ethan Huang avatar Nick Lin avatar Guan-Jhen (Terry) avatar Superbil avatar

Watchers

 avatar  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.