forked from pointfreeco/swift-custom-dump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoreMotion.swift
89 lines (84 loc) · 2.92 KB
/
CoreMotion.swift
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#if canImport(CoreMotion)
import CoreMotion
@available(iOS 11, watchOS 4, *)
extension CMAuthorizationStatus: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .authorized:
return "CMAuthorizationStatus.authorized"
case .denied:
return "CMAuthorizationStatus.denied"
case .notDetermined:
return "CMAuthorizationStatus.notDetermined"
case .restricted:
return "CMAuthorizationStatus.restricted"
@unknown default:
return "CMAuthorizationStatus.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
#if compiler(>=5.4)
extension CMDeviceMotion.SensorLocation: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .default:
return "CMDeviceMotion.SensorLocation.default"
case .headphoneLeft:
return "CMDeviceMotion.SensorLocation.headphoneLeft"
case .headphoneRight:
return "CMDeviceMotion.SensorLocation.headphoneRight"
@unknown default:
return "CMDeviceMotion.SensorLocation.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
// @available(iOS, unavailable)
// @available(macOS, unavailable)
// @available(tvOS, unavailable)
// @available(watchOS 7.2, *)
// extension CMFallDetectionEvent.UserResolution: CustomDumpStringConvertible {
// public var customDumpDescription: String {
// switch self {
// case .confirmed:
// return "CMFallDetectionEvent.UserResolution.confirmed"
// case .dismissed:
// return "CMFallDetectionEvent.UserResolution.dismissed"
// case .rejected:
// return "CMFallDetectionEvent.UserResolution.rejected"
// case .unresponsive:
// return "CMFallDetectionEvent.UserResolution.unresponsive"
// @unknown default:
// return
// "CMFallDetectionEvent.UserResolution.(@unknown default, rawValue: \(self.rawValue))"
// }
// }
// }
#endif
extension CMMotionActivityConfidence: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .high:
return "CMMotionActivityConfidence.high"
case .low:
return "CMMotionActivityConfidence.low"
case .medium:
return "CMMotionActivityConfidence.medium"
@unknown default:
return "CMMotionActivityConfidence.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
@available(iOS 10, watchOS 3, *)
extension CMPedometerEventType: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .pause:
return "CMPedometerEventType.pause"
case .resume:
return "CMPedometerEventType.resume"
@unknown default:
return "CMPedometerEventType.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
#endif