diff --git a/Sources/CustomDump/Conformances/Photos.swift b/Sources/CustomDump/Conformances/Photos.swift new file mode 100644 index 0000000..8c465bd --- /dev/null +++ b/Sources/CustomDump/Conformances/Photos.swift @@ -0,0 +1,38 @@ +#if canImport(Photos) + import Photos + + @available(iOS 14, macCatalyst 14, macOS 11, tvOS 14, *) + extension PHAccessLevel: CustomDumpStringConvertible { + public var customDumpDescription: String { + switch self { + case .addOnly: + return "PHAccessLevel.addOnly" + case .readWrite: + return "PHAccessLevel.readWrite" + @unknown default: + return "PHAccessLevel.(@unknown default, rawValue: \(self.rawValue))" + } + } + } + + @available(iOS 8, macCatalyst 13, macOS 10.13, tvOS 10, *) + extension PHAuthorizationStatus: CustomDumpStringConvertible { + public var customDumpDescription: String { + switch self { + case .authorized: + return "PHAuthorizationStatus.authorized" + case .denied: + return "PHAuthorizationStatus.denied" + case .notDetermined: + return "PHAuthorizationStatus.notDetermined" + case .restricted: + return "PHAuthorizationStatus.restricted" + case .limited: + return "PHAuthorizationStatus.limited" + @unknown default: + return "PHAuthorizationStatus.(@unknown default, rawValue: \(self.rawValue))" + } + } + } + +#endif diff --git a/Sources/CustomDump/Conformances/StoreKit.swift b/Sources/CustomDump/Conformances/StoreKit.swift new file mode 100644 index 0000000..95f620b --- /dev/null +++ b/Sources/CustomDump/Conformances/StoreKit.swift @@ -0,0 +1,41 @@ +#if canImport(StoreKit) + import StoreKit + + @available(iOS 3, macCatalyst 13, macOS 10.7, tvOS 9, watchOS 6.2, *) + extension SKPaymentTransactionState: CustomDumpStringConvertible { + public var customDumpDescription: String { + switch self { + case .purchasing: + return "SKPaymentTransactionState.purchasing" + case .purchased: + return "SKPaymentTransactionState.purchased" + case .failed: + return "SKPaymentTransactionState.failed" + case .restored: + return "SKPaymentTransactionState.restored" + case .deferred: + return "SKPaymentTransactionState.deferred" + @unknown default: + return "SKPaymentTransactionState.(@unknown default, rawValue: \(self.rawValue))" + } + } + } + + @available(iOS 11.2, macCatalyst 13, macOS 10.13.2, tvOS 11.2, watchOS 6.2, *) + extension SKProduct.PeriodUnit: CustomDumpStringConvertible { + public var customDumpDescription: String { + switch self { + case .day: + return "SKProduct.PeriodUnit.day" + case .week: + return "SKProduct.PeriodUnit.week" + case .month: + return "SKProduct.PeriodUnit.month" + case .year: + return "SKProduct.PeriodUnit.year" + @unknown default: + return "SKProduct.PeriodUnit.(@unknown default, rawValue: \(self.rawValue))" + } + } + } +#endif \ No newline at end of file diff --git a/Sources/CustomDump/Conformances/UIKit.swift b/Sources/CustomDump/Conformances/UIKit.swift index 83cd030..458a3a5 100644 --- a/Sources/CustomDump/Conformances/UIKit.swift +++ b/Sources/CustomDump/Conformances/UIKit.swift @@ -24,5 +24,24 @@ } } } + + @available(iOS 11, macCatalyst 13, tvOS 11, *) + @available(watchOS, unavailable) + extension UIScrollView.ContentInsetAdjustmentBehavior: CustomDumpStringConvertible { + public var customDumpDescription: String { + switch self { + case .always: + return "UIScrollView.ContentInsetAdjustmentBehavior.always" + case .automatic: + return "UIScrollView.ContentInsetAdjustmentBehavior.automatic" + case .never: + return "UIScrollView.ContentInsetAdjustmentBehavior.never" + case .scrollableAxes: + return "UIScrollView.ContentInsetAdjustmentBehavior.scrollableAxes" + @unknown default: + return "UIScrollView.ContentInsetAdjustmentBehavior.(@unknown default, rawValue: \(self.rawValue))" + } + } + } #endif #endif