杨锴
2025-06-04 ac84f81ca2311300b431c1bfb9f71253b59073f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// MeasurementExtensions.swift - Copyright 2023 SwifterSwift
 
#if canImport(Foundation)
import Foundation
 
// MARK: - Methods
 
public extension Measurement where UnitType == UnitAngle {
    /// SwifterSwift:  Create a `Measurement` for an angle with a specified value in degrees.
    /// - Parameter value: The quantity of the angle in degree.
    /// - Returns: Measurement for an angle with unit degrees.
    static func degrees(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .degrees)
    }
 
    /// SwifterSwift:  Create a Measurement for an angle with a specified value in arc minutes.
    /// - Parameter value: The quantity of the angle in arc minutes.
    /// - Returns: Measurement for an angle with unit arc minutes.
    static func arcMinutes(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .arcMinutes)
    }
 
    /// SwifterSwift:  Create a Measurement for an angle with a specified value in arc seconds.
    /// - Parameter value: The quantity of the angle in arc seconds.
    /// - Returns: Measurement for an angle with unit arc seconds.
    static func arcSeconds(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .arcSeconds)
    }
 
    /// SwifterSwift:  Create a Measurement for an angle with a specified value in radians.
    /// - Parameter value: The quantity of the angle in radians.
    /// - Returns: Measurement for an angle with unit radians.
    static func radians(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .radians)
    }
 
    /// SwifterSwift:  Create a Measurement for an angle with a specified value in gradians.
    /// - Parameter value: The quantity of the angle in gradians.
    /// - Returns: Measurement for an angle with unit gradians.
    static func gradians(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .gradians)
    }
 
    /// SwifterSwift:  Create a Measurement for an angle with a specified value in revolutions.
    /// - Parameter value: The quantity of the angle in revolutions.
    /// - Returns: Measurement for an angle with unit revolutions.
    static func revolutions(_ value: Double) -> Measurement {
        return Measurement(value: value, unit: .revolutions)
    }
}
 
#endif