A Swift based types for expressing/converting physical values in various units.
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
}
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
- Angle
- Length
- Time
- Volume
- TODO