antonvmironov / PhysicalValue

A Swift based types for expressing/converting physical values in various units.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhysicalValue for Swift

License Platform Swift

A Swift based types for expressing/converting physical values in various units.

What is the Point?

code before:

struct Shape {
    var points: [Point]
    var rotation: Float // is it radians or degrees? What if somebody will not guess?
}

code after:

struct Shape {
    var points: [Point]
    var rotation: Angle
}

How to Use?

let angle1 = Angle(amount: 90.0, unit: .degree)
// or
let angle2 = Angle(degrees: 90.0)
// or
let angle3: Angle = 90.0.of(.degree)
// or
let angle4: Angle = 90.0 * .degree

More units

  • Angle
  • Length
  • Time
  • Volume
  • TODO

About

A Swift based types for expressing/converting physical values in various units.

License:MIT License


Languages

Language:Swift 100.0%