Unit converter in Swift

Overview

Scale

❤️ Support my app ❤️

❤️ ❤️ 😇 😍 🤘 ❤️ ❤️

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
  • 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
  • Length
let length = 5.yard + 2.meter
  • 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.

You might also like...
Swift-ndi - Swift wrapper around NewTek's NDI SDK

swift-ndi Swift wrapper around NewTek's NDI SDK. Make sure you extracted latest

__.swift is a port of Underscore.js to Swift.

__.swift Now, __.swift is version 0.2.0! With the chain of methods, __.swift became more flexible and extensible. Documentation: http://lotz84.github.

SNTabBarDemo-Swift - Cool TabBar With Swift
SNTabBarDemo-Swift - Cool TabBar With Swift

SNTabBarDemo-Swift Cool TabBar How To Use // MARK: - setup private func setu

Swift-when - Expression switch support in Swift

Swift When - supporting switch expressions in Swift! What is it? Basically, it a

Swift-compute-runtime - Swift runtime for Fastly Compute@Edge

swift-compute-runtime Swift runtime for Fastly Compute@Edge Getting Started Crea

Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

swift-highlight a pure-Swift data structure library designed for server applications that need to store a lot of styled text

swift-highlight is a pure-Swift data structure library designed for server applications that need to store a lot of styled text. The Highlight module is memory-efficient and uses slab allocations and small-string optimizations to pack large amounts of styled text into a small amount of memory, while still supporting efficient traversal through the Sequence protocol.

Sovran-Swift: Small, efficient, easy. State Management for Swift

Sovran-Swift: Small, efficient, easy. State Management for Swift

Approximate is a Swift package that provides implementations of floating point comparisons for the Swift ecosystem

Approximate Approximate floating point equality comparisons for the Swift Programming Language. Introduction Approximate is a Swift package that provi

Comments
  • WWDC 2016 Measurements and Units

    WWDC 2016 Measurements and Units

    • Apple now supports measurements and units https://developer.apple.com/videos/play/wwdc2016/238/
    • http://oleb.net/blog/2016/07/measurements-and-units/
    opened by onmyway133 0
Releases(1.1.0)
Owner
Khoa
Check my apps https://onmyway133.com/apps
Khoa
Unit converter in Swift

Unit converter in Swift

Khoa 324 Jun 29, 2022
Converter for your Rigol Oscilloscope .CSV files to LtSpice

rigol2spice A program to convert Rigol oscilloscope's .CSV files to a format readable by LTspice. Your Rigol oscilloscope can output .CSV files that c

Rui Carneiro 4 Aug 31, 2022
Unit conversion library for Swift.

MKUnits MKUnits is extremely precise unit conversion library for Swift. It provides units of measurement of physical quantities and simplifies manipul

Michal Konturek 343 Sep 21, 2022
Project shows how to unit test asynchronous API calls in Swift using Mocking without using any 3rd party software

UnitTestingNetworkCalls-Swift Project shows how to unit test asynchronous API ca

Gary M 0 May 6, 2022
Testable Combine Publishers - An easy, declarative way to unit test Combine Publishers in Swift

Testable Combine Publishers An easy, declarative way to unit test Combine Publishers in Swift About Combine Publishers are notoriously verbose to unit

Albert Bori 6 Sep 26, 2022
BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Blockchain Commons, LLC — A “not-for-profit” benefit corporation 4 Oct 6, 2022
Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Apple 2k Dec 28, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)

SwiftFoundation Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. Goals Provide a cross-platform in

null 620 Oct 11, 2022
Swift - ✏️Swift 공부 저장소✏️

Swift 스위프트의 기초 1. Swift의 기본 2. 변수와 상수 [3. 데이터 타입 기본] [4. 데이터 타입 고급] 5. 연산자 6. 흐름 제어 7. 함수 8. 옵셔널 객체지향 프로그래밍과 스위프트 9. 구조체와 클래스 10. 프로퍼티와 메서드 11. 인스턴스 생

Jiwon 0 Mar 9, 2022