ole / Ampere

Adding multiplication and division to the units of measurement types in Foundation.
https://oleb.net/blog/2016/07/unitproduct/
MIT License
171 stars 17 forks source link

Introduce a typealias UnitMapping #4

Closed ole closed 8 years ago

ole commented 8 years ago
public protocol UnitProduct {
    associatedtype Factor1: Dimension
    associatedtype Factor2: Dimension
    associatedtype Product: Dimension

    typealias UnitMapping = (Factor1, Factor2, Product)

    static func defaultUnitMapping() -> UnitMapping
    static func preferredUnitMappings() -> [UnitMapping]
}

This capability is described in SE-0092, which has been implemented a few days ago, but it is not available in Xcode 8 beta 4 yet.