Skip to content

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

License

Notifications You must be signed in to change notification settings

antonvmironov/PhysicalValue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages