Skip to content

Commit 8655495

Browse files
Extend conformances Photos, StoreKit, UIKit (#1)
* Conform UIScrollView.ContentInsetAdjustmentBehavior * Conform some Photos enums * Conform some StoreKit enums * Update Sources/CustomDump/Conformances/UIKit.swift * Fix availability Co-authored-by: Stephen Celis <[email protected]> Co-authored-by: Stephen Celis <[email protected]>
1 parent 4f743ea commit 8655495

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#if canImport(Photos)
2+
import Photos
3+
4+
@available(iOS 14, macCatalyst 14, macOS 11, tvOS 14, *)
5+
extension PHAccessLevel: CustomDumpStringConvertible {
6+
public var customDumpDescription: String {
7+
switch self {
8+
case .addOnly:
9+
return "PHAccessLevel.addOnly"
10+
case .readWrite:
11+
return "PHAccessLevel.readWrite"
12+
@unknown default:
13+
return "PHAccessLevel.(@unknown default, rawValue: \(self.rawValue))"
14+
}
15+
}
16+
}
17+
18+
@available(iOS 8, macCatalyst 13, macOS 10.13, tvOS 10, *)
19+
extension PHAuthorizationStatus: CustomDumpStringConvertible {
20+
public var customDumpDescription: String {
21+
switch self {
22+
case .authorized:
23+
return "PHAuthorizationStatus.authorized"
24+
case .denied:
25+
return "PHAuthorizationStatus.denied"
26+
case .notDetermined:
27+
return "PHAuthorizationStatus.notDetermined"
28+
case .restricted:
29+
return "PHAuthorizationStatus.restricted"
30+
case .limited:
31+
return "PHAuthorizationStatus.limited"
32+
@unknown default:
33+
return "PHAuthorizationStatus.(@unknown default, rawValue: \(self.rawValue))"
34+
}
35+
}
36+
}
37+
38+
#endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#if canImport(StoreKit)
2+
import StoreKit
3+
4+
@available(iOS 3, macCatalyst 13, macOS 10.7, tvOS 9, watchOS 6.2, *)
5+
extension SKPaymentTransactionState: CustomDumpStringConvertible {
6+
public var customDumpDescription: String {
7+
switch self {
8+
case .purchasing:
9+
return "SKPaymentTransactionState.purchasing"
10+
case .purchased:
11+
return "SKPaymentTransactionState.purchased"
12+
case .failed:
13+
return "SKPaymentTransactionState.failed"
14+
case .restored:
15+
return "SKPaymentTransactionState.restored"
16+
case .deferred:
17+
return "SKPaymentTransactionState.deferred"
18+
@unknown default:
19+
return "SKPaymentTransactionState.(@unknown default, rawValue: \(self.rawValue))"
20+
}
21+
}
22+
}
23+
24+
@available(iOS 11.2, macCatalyst 13, macOS 10.13.2, tvOS 11.2, watchOS 6.2, *)
25+
extension SKProduct.PeriodUnit: CustomDumpStringConvertible {
26+
public var customDumpDescription: String {
27+
switch self {
28+
case .day:
29+
return "SKProduct.PeriodUnit.day"
30+
case .week:
31+
return "SKProduct.PeriodUnit.week"
32+
case .month:
33+
return "SKProduct.PeriodUnit.month"
34+
case .year:
35+
return "SKProduct.PeriodUnit.year"
36+
@unknown default:
37+
return "SKProduct.PeriodUnit.(@unknown default, rawValue: \(self.rawValue))"
38+
}
39+
}
40+
}
41+
#endif

Sources/CustomDump/Conformances/UIKit.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,24 @@
2424
}
2525
}
2626
}
27+
28+
@available(iOS 11, macCatalyst 13, tvOS 11, *)
29+
@available(watchOS, unavailable)
30+
extension UIScrollView.ContentInsetAdjustmentBehavior: CustomDumpStringConvertible {
31+
public var customDumpDescription: String {
32+
switch self {
33+
case .always:
34+
return "UIScrollView.ContentInsetAdjustmentBehavior.always"
35+
case .automatic:
36+
return "UIScrollView.ContentInsetAdjustmentBehavior.automatic"
37+
case .never:
38+
return "UIScrollView.ContentInsetAdjustmentBehavior.never"
39+
case .scrollableAxes:
40+
return "UIScrollView.ContentInsetAdjustmentBehavior.scrollableAxes"
41+
@unknown default:
42+
return "UIScrollView.ContentInsetAdjustmentBehavior.(@unknown default, rawValue: \(self.rawValue))"
43+
}
44+
}
45+
}
2746
#endif
2847
#endif

0 commit comments

Comments
 (0)