diff --git a/iOS/ARKit/ARConfiguration.swift b/iOS/ARKit/ARConfiguration.swift index b3df1f8..9c09787 100644 --- a/iOS/ARKit/ARConfiguration.swift +++ b/iOS/ARKit/ARConfiguration.swift @@ -145,5 +145,7 @@ class ARGeoTrackingConfiguration : ARConfiguration { var maximumNumberOfTrackedImages: Int var detectionObjects: Set class func checkAvailability(completionHandler: @escaping (Bool, Error?) -> Void) + class func checkAvailability() async throws -> Bool class func checkAvailability(at coordinate: CLLocationCoordinate2D, completionHandler: @escaping (Bool, Error?) -> Void) + class func checkAvailability(at coordinate: CLLocationCoordinate2D) async throws -> Bool } diff --git a/iOS/ARKit/ARReferenceImage.swift b/iOS/ARKit/ARReferenceImage.swift index 90018f5..8279cd5 100644 --- a/iOS/ARKit/ARReferenceImage.swift +++ b/iOS/ARKit/ARReferenceImage.swift @@ -7,6 +7,8 @@ class ARReferenceImage : NSObject { var resourceGroupName: String? { get } @available(iOS 13.0, *) func validate(completionHandler: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func validate() async throws init(_ image: CGImage, orientation: CGImagePropertyOrientation, physicalWidth: CGFloat) init(_ pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation, physicalWidth: CGFloat) class func referenceImages(inGroupNamed name: String, bundle: Bundle?) -> Set? diff --git a/iOS/ARKit/ARSession.swift b/iOS/ARKit/ARSession.swift index 3017f6c..aeda4c9 100644 --- a/iOS/ARKit/ARSession.swift +++ b/iOS/ARKit/ARSession.swift @@ -27,7 +27,11 @@ class ARSession : NSObject { @available(iOS 12.0, *) func getCurrentWorldMap(completionHandler: @escaping (ARWorldMap?, Error?) -> Void) @available(iOS 12.0, *) + func currentWorldMap() async throws -> ARWorldMap + @available(iOS 12.0, *) func createReferenceObject(transform: simd_float4x4, center: simd_float3, extent: simd_float3, completionHandler: @escaping (ARReferenceObject?, Error?) -> Void) + @available(iOS 12.0, *) + func createReferenceObject(transform: simd_float4x4, center: simd_float3, extent: simd_float3) async throws -> ARReferenceObject @available(iOS 13.0, *) func raycast(_ query: ARRaycastQuery) -> [ARRaycastResult] @available(iOS 13.0, *) @@ -36,6 +40,8 @@ class ARSession : NSObject { func update(with collaborationData: ARSession.CollaborationData) @available(iOS 14.0, *) func getGeoLocation(forPoint position: simd_float3, completionHandler: @escaping (CLLocationCoordinate2D, CLLocationDistance, Error?) -> Void) + @available(iOS 14.0, *) + func geoLocation(forPoint position: simd_float3) async throws -> (CLLocationCoordinate2D, CLLocationDistance) } @available(iOS 11.0, *) protocol ARSessionObserver : NSObjectProtocol { diff --git a/iOS/AVFoundation/AVAssetExportSession.swift b/iOS/AVFoundation/AVAssetExportSession.swift index 1735cd7..f624b66 100644 --- a/iOS/AVFoundation/AVAssetExportSession.swift +++ b/iOS/AVFoundation/AVAssetExportSession.swift @@ -55,6 +55,7 @@ class AVAssetExportSession : NSObject { var status: AVAssetExportSession.Status { get } var error: Error? { get } func exportAsynchronously(completionHandler handler: @escaping () -> Void) + func export() async var progress: Float { get } func cancelExport() } @@ -63,11 +64,15 @@ extension AVAssetExportSession { class func exportPresets(compatibleWith asset: AVAsset) -> [String] @available(iOS 6.0, *) class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?, completionHandler handler: @escaping (Bool) -> Void) + @available(iOS 6.0, *) + class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?) async -> Bool } extension AVAssetExportSession { var supportedFileTypes: [AVFileType] { get } @available(iOS 6.0, *) func determineCompatibleFileTypes(completionHandler handler: @escaping ([AVFileType]) -> Void) + @available(iOS 6.0, *) + func determineCompatibleFileTypes() async -> [AVFileType] } extension AVAssetExportSession { var timeRange: CMTimeRange @@ -80,7 +85,11 @@ extension AVAssetExportSession { @available(iOS 13.0, *) func estimateMaximumDuration(completionHandler handler: @escaping (CMTime, Error?) -> Void) @available(iOS 13.0, *) + func estimateMaximumDuration() async throws -> CMTime + @available(iOS 13.0, *) func estimateOutputFileLength(completionHandler handler: @escaping (Int64, Error?) -> Void) + @available(iOS 13.0, *) + func estimateOutputFileLength() async throws -> Int64 } extension AVAssetExportSession { var metadata: [AVMetadataItem]? diff --git a/iOS/AVFoundation/AVAssetImageGenerator.swift b/iOS/AVFoundation/AVAssetImageGenerator.swift index 8f84dbd..9072edb 100644 --- a/iOS/AVFoundation/AVAssetImageGenerator.swift +++ b/iOS/AVFoundation/AVAssetImageGenerator.swift @@ -38,6 +38,7 @@ class AVAssetImageGenerator : NSObject { init(asset: AVAsset) func copyCGImage(at requestedTime: CMTime, actualTime: UnsafeMutablePointer?) throws -> CGImage func generateCGImagesAsynchronously(forTimes requestedTimes: [NSValue], completionHandler handler: @escaping AVAssetImageGeneratorCompletionHandler) + func generateCGImages(forTimes requestedTimes: [NSValue]) async throws -> (CMTime, CGImage, CMTime, AVAssetImageGenerator.Result) func cancelAllCGImageGeneration() } typealias AVAssetImageGeneratorCompletionHandler = (CMTime, CGImage?, CMTime, AVAssetImageGenerator.Result, Error?) -> Void diff --git a/iOS/AVFoundation/AVAssetWriter.swift b/iOS/AVFoundation/AVAssetWriter.swift index a0176ac..062e26c 100644 --- a/iOS/AVFoundation/AVAssetWriter.swift +++ b/iOS/AVFoundation/AVAssetWriter.swift @@ -35,6 +35,8 @@ class AVAssetWriter : NSObject { func cancelWriting() @available(iOS 6.0, *) func finishWriting(completionHandler handler: @escaping () -> Void) + @available(iOS 6.0, *) + func finishWriting() async } extension AVAssetWriter { var movieFragmentInterval: CMTime diff --git a/iOS/AVFoundation/AVAsynchronousKeyValueLoading.swift b/iOS/AVFoundation/AVAsynchronousKeyValueLoading.swift index a340868..22888c5 100644 --- a/iOS/AVFoundation/AVAsynchronousKeyValueLoading.swift +++ b/iOS/AVFoundation/AVAsynchronousKeyValueLoading.swift @@ -11,4 +11,5 @@ enum AVKeyValueStatus : Int { protocol AVAsynchronousKeyValueLoading { func statusOfValue(forKey key: String, error outError: NSErrorPointer) -> AVKeyValueStatus func loadValuesAsynchronously(forKeys keys: [String], completionHandler handler: (() -> Void)? = nil) + func loadValues(forKeys keys: [String]) async } diff --git a/iOS/AVFoundation/AVCaptureDevice.swift b/iOS/AVFoundation/AVCaptureDevice.swift index 78ec12a..2788a89 100644 --- a/iOS/AVFoundation/AVCaptureDevice.swift +++ b/iOS/AVFoundation/AVCaptureDevice.swift @@ -270,6 +270,8 @@ extension AVCaptureDevice { var lensPosition: Float { get } @available(iOS 8.0, *) func setFocusModeLocked(lensPosition: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(iOS 8.0, *) + func setFocusModeLocked(lensPosition: Float) async -> CMTime } extension AVCaptureDevice { func isExposureModeSupported(_ exposureMode: AVCaptureDevice.ExposureMode) -> Bool @@ -288,6 +290,8 @@ extension AVCaptureDevice { @available(iOS 8.0, *) func setExposureModeCustom(duration: CMTime, iso ISO: Float, completionHandler handler: ((CMTime) -> Void)? = nil) @available(iOS 8.0, *) + func setExposureModeCustom(duration: CMTime, iso ISO: Float) async -> CMTime + @available(iOS 8.0, *) var exposureTargetOffset: Float { get } @available(iOS 8.0, *) var exposureTargetBias: Float { get } @@ -297,6 +301,8 @@ extension AVCaptureDevice { var maxExposureTargetBias: Float { get } @available(iOS 8.0, *) func setExposureTargetBias(_ bias: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(iOS 8.0, *) + func setExposureTargetBias(_ bias: Float) async -> CMTime } extension AVCaptureDevice { @available(iOS 13.0, *) @@ -317,6 +323,8 @@ extension AVCaptureDevice { @available(iOS 8.0, *) func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains, completionHandler handler: ((CMTime) -> Void)? = nil) @available(iOS 8.0, *) + func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) async -> CMTime + @available(iOS 8.0, *) func chromaticityValues(for whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) -> AVCaptureDevice.WhiteBalanceChromaticityValues @available(iOS 8.0, *) func deviceWhiteBalanceGains(for chromaticityValues: AVCaptureDevice.WhiteBalanceChromaticityValues) -> AVCaptureDevice.WhiteBalanceGains @@ -363,6 +371,8 @@ extension AVCaptureDevice { class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus @available(iOS 7.0, *) class func requestAccess(for mediaType: AVMediaType, completionHandler handler: @escaping (Bool) -> Void) + @available(iOS 7.0, *) + class func requestAccess(for mediaType: AVMediaType) async -> Bool } extension AVCaptureDevice { } diff --git a/iOS/AVFoundation/AVCapturePhotoOutput.swift b/iOS/AVFoundation/AVCapturePhotoOutput.swift index 086e3d7..33f467a 100644 --- a/iOS/AVFoundation/AVCapturePhotoOutput.swift +++ b/iOS/AVFoundation/AVCapturePhotoOutput.swift @@ -4,6 +4,7 @@ class AVCapturePhotoOutput : AVCaptureOutput { func capturePhoto(with settings: AVCapturePhotoSettings, delegate: AVCapturePhotoCaptureDelegate) var preparedPhotoSettingsArray: [AVCapturePhotoSettings] { get } func setPreparedPhotoSettingsArray(_ preparedPhotoSettingsArray: [AVCapturePhotoSettings], completionHandler: ((Bool, Error?) -> Void)? = nil) + func setPreparedPhotoSettingsArray(_ preparedPhotoSettingsArray: [AVCapturePhotoSettings]) async throws -> Bool var __availablePhotoPixelFormatTypes: [NSNumber] { get } var availablePhotoCodecTypes: [AVVideoCodecType] { get } var __availableRawPhotoPixelFormatTypes: [NSNumber] { get } diff --git a/iOS/AVFoundation/AVCaptureStillImageOutput.swift b/iOS/AVFoundation/AVCaptureStillImageOutput.swift index e9f149b..12a5ef7 100644 --- a/iOS/AVFoundation/AVCaptureStillImageOutput.swift +++ b/iOS/AVFoundation/AVCaptureStillImageOutput.swift @@ -15,6 +15,7 @@ class AVCaptureStillImageOutput : AVCaptureOutput { @available(iOS 5.0, *) var isCapturingStillImage: Bool { get } func captureStillImageAsynchronously(from connection: AVCaptureConnection, completionHandler handler: @escaping (CMSampleBuffer?, Error?) -> Void) + func captureStillImage(from connection: AVCaptureConnection) async throws -> CMSampleBuffer class func jpegStillImageNSDataRepresentation(_ jpegSampleBuffer: CMSampleBuffer) -> Data? } @available(iOS 8.0, *) @@ -40,6 +41,10 @@ extension AVCaptureStillImageOutput { var isLensStabilizationDuringBracketedCaptureEnabled: Bool @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (Bool, Error?) -> Void) + @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") + func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> Bool @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") func captureStillImageBracketAsynchronously(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (CMSampleBuffer?, AVCaptureBracketedStillImageSettings?, Error?) -> Void) + @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") + func captureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> (CMSampleBuffer, AVCaptureBracketedStillImageSettings) } diff --git a/iOS/AVFoundation/AVContentKeySession.swift b/iOS/AVFoundation/AVContentKeySession.swift index babe6d8..457f413 100644 --- a/iOS/AVFoundation/AVContentKeySession.swift +++ b/iOS/AVFoundation/AVContentKeySession.swift @@ -29,10 +29,16 @@ class AVContentKeySession : NSObject { func renewExpiringResponseData(for contentKeyRequest: AVContentKeyRequest) @available(iOS 11.0, *) func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data, completionHandler handler: @escaping (Data?, Error?) -> Void) + @available(iOS 11.0, *) + func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data) async throws -> Data @available(iOS 12.2, *) func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) @available(iOS 12.2, *) + func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data + @available(iOS 12.2, *) func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + @available(iOS 12.2, *) + func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data } struct AVContentKeySessionServerPlaybackContextOption : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(rawValue: String) @@ -106,6 +112,7 @@ class AVContentKeyRequest : NSObject { var options: [String : Any] { get } var canProvidePersistableContentKey: Bool { get } func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil) async throws -> Data func processContentKeyResponse(_ keyResponse: AVContentKeyResponse) func processContentKeyResponseError(_ error: Error) @available(iOS, introduced: 10.3, deprecated: 11.2, message: "Use respondByRequestingPersistableContentKeyRequestAndReturnError: instead.") diff --git a/iOS/AVFoundation/AVPlayer.swift b/iOS/AVFoundation/AVPlayer.swift index 72be28f..0d713f4 100644 --- a/iOS/AVFoundation/AVPlayer.swift +++ b/iOS/AVFoundation/AVPlayer.swift @@ -74,12 +74,18 @@ extension AVPlayer { func seek(to date: Date) @available(iOS 5.0, *) func seek(to date: Date, completionHandler: @escaping (Bool) -> Void) + @available(iOS 5.0, *) + func seek(to date: Date) async -> Bool func seek(to time: CMTime) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) @available(iOS 5.0, *) func seek(to time: CMTime, completionHandler: @escaping (Bool) -> Void) @available(iOS 5.0, *) + func seek(to time: CMTime) async -> Bool + @available(iOS 5.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: @escaping (Bool) -> Void) + @available(iOS 5.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool } extension AVPlayer { @available(iOS 10.0, *) @@ -89,6 +95,8 @@ extension AVPlayer { @available(iOS 6.0, *) func preroll(atRate rate: Float, completionHandler: ((Bool) -> Void)? = nil) @available(iOS 6.0, *) + func preroll(atRate rate: Float) async -> Bool + @available(iOS 6.0, *) func cancelPendingPrerolls() @available(iOS 6.0, *) var masterClock: CMClock? diff --git a/iOS/AVFoundation/AVPlayerItem.swift b/iOS/AVFoundation/AVPlayerItem.swift index 0c9ae6d..177cd90 100644 --- a/iOS/AVFoundation/AVPlayerItem.swift +++ b/iOS/AVFoundation/AVPlayerItem.swift @@ -85,8 +85,12 @@ extension AVPlayerItem { @available(iOS 5.0, *) func seek(to time: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(iOS 5.0, *) + func seek(to time: CMTime) async -> Bool + @available(iOS 5.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(iOS 5.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool + @available(iOS 5.0, *) func cancelPendingSeeks() func currentDate() -> Date? @available(iOS 6.0, *) diff --git a/iOS/AVFoundation/AVSampleBufferAudioRenderer.swift b/iOS/AVFoundation/AVSampleBufferAudioRenderer.swift index 290cce1..a4b4154 100644 --- a/iOS/AVFoundation/AVSampleBufferAudioRenderer.swift +++ b/iOS/AVFoundation/AVSampleBufferAudioRenderer.swift @@ -11,6 +11,7 @@ extension AVSampleBufferAudioRenderer { } extension AVSampleBufferAudioRenderer { func flush(fromSourceTime time: CMTime, completionHandler: @escaping (Bool) -> Void) + func flush(fromSourceTime time: CMTime) async -> Bool } extension NSNotification.Name { @available(iOS 11.0, *) diff --git a/iOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift b/iOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift index 690998a..275ce02 100644 --- a/iOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift +++ b/iOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift @@ -15,6 +15,7 @@ extension AVSampleBufferRenderSynchronizer { var renderers: [AVQueuedSampleBufferRendering] { get } func addRenderer(_ renderer: AVQueuedSampleBufferRendering) func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime, completionHandler: ((Bool) -> Void)? = nil) + func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime) async -> Bool } extension AVSampleBufferRenderSynchronizer { func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any diff --git a/iOS/AVKit/AVPictureInPictureController.swift b/iOS/AVKit/AVPictureInPictureController.swift index 32efd57..817ff41 100644 --- a/iOS/AVKit/AVPictureInPictureController.swift +++ b/iOS/AVKit/AVPictureInPictureController.swift @@ -29,4 +29,5 @@ protocol AVPictureInPictureControllerDelegate : NSObjectProtocol { optional func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController) async -> Bool } diff --git a/iOS/AVKit/AVPlaybackRouteSelecting.swift b/iOS/AVKit/AVPlaybackRouteSelecting.swift index 3adc10e..1d63865 100644 --- a/iOS/AVKit/AVPlaybackRouteSelecting.swift +++ b/iOS/AVKit/AVPlaybackRouteSelecting.swift @@ -12,4 +12,5 @@ extension AVAudioSession { @available(iOS 13.0, *) extension AVAudioSession { func prepareRouteSelectionForPlayback(completionHandler: @escaping (Bool, AVAudioSession.RouteSelection) -> Void) + func prepareRouteSelectionForPlayback() async -> (Bool, AVAudioSession.RouteSelection) } diff --git a/iOS/AVKit/AVPlayerViewController.swift b/iOS/AVKit/AVPlayerViewController.swift index ae85eb4..f212d5d 100644 --- a/iOS/AVKit/AVPlayerViewController.swift +++ b/iOS/AVKit/AVPlayerViewController.swift @@ -45,4 +45,6 @@ protocol AVPlayerViewControllerDelegate : NSObjectProtocol { optional func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_ playerViewController: AVPlayerViewController) -> Bool @available(iOS 8.0, *) optional func playerViewController(_ playerViewController: AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + @available(iOS 8.0, *) + optional func playerViewControllerRestoreUserInterfaceForPictureInPictureStop(_ playerViewController: AVPlayerViewController) async -> Bool } diff --git a/iOS/Accounts/ACAccountStore.swift b/iOS/Accounts/ACAccountStore.swift index aa13404..887debe 100644 --- a/iOS/Accounts/ACAccountStore.swift +++ b/iOS/Accounts/ACAccountStore.swift @@ -17,9 +17,13 @@ class ACAccountStore : NSObject { func accountType(withAccountTypeIdentifier typeIdentifier: String!) -> ACAccountType! func accounts(with accountType: ACAccountType!) -> [Any]! func saveAccount(_ account: ACAccount!, withCompletionHandler completionHandler: ACAccountStoreSaveCompletionHandler!) + func saveAccount(_ account: ACAccount!) async throws -> Bool func requestAccessToAccounts(with accountType: ACAccountType!, options: [AnyHashable : Any]! = [:], completion: ACAccountStoreRequestAccessCompletionHandler!) + func requestAccessToAccounts(with accountType: ACAccountType!, options: [AnyHashable : Any]! = [:]) async throws -> Bool func renewCredentials(for account: ACAccount!, completion completionHandler: ACAccountStoreCredentialRenewalHandler!) + func renewCredentials(for account: ACAccount!) async throws -> ACAccountCredentialRenewResult func removeAccount(_ account: ACAccount!, withCompletionHandler completionHandler: ACAccountStoreRemoveCompletionHandler!) + func removeAccount(_ account: ACAccount!) async throws -> Bool } extension NSNotification.Name { @available(iOS, introduced: 5.0, deprecated: 14.0, message: "Public notification deprecated. Internal clients, see private header for replacement") diff --git a/iOS/AppTrackingTransparency/AppTrackingTransparency.swift b/iOS/AppTrackingTransparency/AppTrackingTransparency.swift index 8f9566c..fd5c191 100644 --- a/iOS/AppTrackingTransparency/AppTrackingTransparency.swift +++ b/iOS/AppTrackingTransparency/AppTrackingTransparency.swift @@ -14,5 +14,6 @@ extension ATTrackingManager { class ATTrackingManager : NSObject { class var trackingAuthorizationStatus: ATTrackingManager.AuthorizationStatus { get } class func requestTrackingAuthorization(completionHandler completion: @escaping (ATTrackingManager.AuthorizationStatus) -> Void) + class func requestTrackingAuthorization() async -> ATTrackingManager.AuthorizationStatus } var AppTrackingTransparencyVersionNumber: Double diff --git a/iOS/AssetsLibrary/ALAsset.swift b/iOS/AssetsLibrary/ALAsset.swift index 62426e4..1172495 100644 --- a/iOS/AssetsLibrary/ALAsset.swift +++ b/iOS/AssetsLibrary/ALAsset.swift @@ -37,8 +37,12 @@ class ALAsset : NSObject { func aspectRatioThumbnail() -> Unmanaged! @available(iOS, introduced: 5, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeModifiedImageData(toSavedPhotosAlbum imageData: Data!, metadata: [AnyHashable : Any]!, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!) + @available(iOS, introduced: 5, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeModifiedImageData(toSavedPhotosAlbum imageData: Data!, metadata: [AnyHashable : Any]!) async throws -> URL? @available(iOS, introduced: 5, deprecated: 9, message: "Use creationRequestForAssetFromVideoAtFileURL: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeModifiedVideoAtPath(toSavedPhotosAlbum videoPathURL: URL!, completionBlock: ALAssetsLibraryWriteVideoCompletionBlock!) + @available(iOS, introduced: 5, deprecated: 9, message: "Use creationRequestForAssetFromVideoAtFileURL: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeModifiedVideoAtPath(toSavedPhotosAlbum videoPathURL: URL!) async throws -> URL? @available(iOS, introduced: 5, deprecated: 9, message: "Use the PHImageRequestOptionsVersionOriginal or PHImageRequestOptionsVersionUnadjusted option in PHImageRequestOptions with the PHImageManager from the Photos framework instead") var original: ALAsset! { get } @available(iOS, introduced: 5, deprecated: 9, message: "Use canPerformEditOperation: on a PHAsset from the Photos framework instead") @@ -46,5 +50,9 @@ class ALAsset : NSObject { @available(iOS, introduced: 5, deprecated: 9, message: "Use contentEditingOutput on a PHAssetChangeRequest from the Photos framework instead") func setImageData(_ imageData: Data!, metadata: [AnyHashable : Any]!, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!) @available(iOS, introduced: 5, deprecated: 9, message: "Use contentEditingOutput on a PHAssetChangeRequest from the Photos framework instead") + func setImageData(_ imageData: Data!, metadata: [AnyHashable : Any]!) async throws -> URL? + @available(iOS, introduced: 5, deprecated: 9, message: "Use contentEditingOutput on a PHAssetChangeRequest from the Photos framework instead") func setVideoAtPath(_ videoPathURL: URL!, completionBlock: ALAssetsLibraryWriteVideoCompletionBlock!) + @available(iOS, introduced: 5, deprecated: 9, message: "Use contentEditingOutput on a PHAssetChangeRequest from the Photos framework instead") + func setVideoAtPath(_ videoPathURL: URL!) async throws -> URL? } diff --git a/iOS/AssetsLibrary/ALAssetsLibrary.swift b/iOS/AssetsLibrary/ALAssetsLibrary.swift index c26da9b..59dd456 100644 --- a/iOS/AssetsLibrary/ALAssetsLibrary.swift +++ b/iOS/AssetsLibrary/ALAssetsLibrary.swift @@ -73,12 +73,20 @@ class ALAssetsLibrary : NSObject { func addAssetsGroupAlbum(withName name: String!, resultBlock: ALAssetsLibraryGroupResultBlock!, failureBlock: ALAssetsLibraryAccessFailureBlock!) @available(iOS, introduced: 4, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeImage(toSavedPhotosAlbum imageRef: CGImage!, orientation: ALAssetOrientation, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!) + @available(iOS, introduced: 4, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeImage(toSavedPhotosAlbum imageRef: CGImage!, orientation: ALAssetOrientation) async throws -> URL? @available(iOS, introduced: 4.1, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeImage(toSavedPhotosAlbum imageRef: CGImage!, metadata: [AnyHashable : Any]!, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!) + @available(iOS, introduced: 4.1, deprecated: 9, message: "Use creationRequestForAssetFromImage: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeImage(toSavedPhotosAlbum imageRef: CGImage!, metadata: [AnyHashable : Any]!) async throws -> URL? @available(iOS, introduced: 4.1, deprecated: 9, message: "Use creationRequestForAssetFromImageData: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeImageData(toSavedPhotosAlbum imageData: Data!, metadata: [AnyHashable : Any]!, completionBlock: ALAssetsLibraryWriteImageCompletionBlock!) + @available(iOS, introduced: 4.1, deprecated: 9, message: "Use creationRequestForAssetFromImageData: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeImageData(toSavedPhotosAlbum imageData: Data!, metadata: [AnyHashable : Any]!) async throws -> URL? @available(iOS, introduced: 4, deprecated: 9, message: "Use creationRequestForAssetFromVideoAtFilePath: on PHAssetChangeRequest from the Photos framework to create a new asset instead") func writeVideoAtPath(toSavedPhotosAlbum videoPathURL: URL!, completionBlock: ALAssetsLibraryWriteVideoCompletionBlock!) + @available(iOS, introduced: 4, deprecated: 9, message: "Use creationRequestForAssetFromVideoAtFilePath: on PHAssetChangeRequest from the Photos framework to create a new asset instead") + func writeVideoAtPath(toSavedPhotosAlbum videoPathURL: URL!) async throws -> URL? @available(iOS, introduced: 5, deprecated: 9, message: "Use isCompatibleWithSavedPhotosAlbum on AVAsset instead") func videoAtPathIs(compatibleWithSavedPhotosAlbum videoPathURL: URL!) -> Bool @available(iOS, introduced: 6, deprecated: 9, message: "Use authorizationStatus on the shared PHPhotoLibrary from the Photos framework instead") diff --git a/iOS/AudioToolbox/AUAudioUnit.swift b/iOS/AudioToolbox/AUAudioUnit.swift index cdac694..d57650b 100644 --- a/iOS/AudioToolbox/AUAudioUnit.swift +++ b/iOS/AudioToolbox/AUAudioUnit.swift @@ -32,6 +32,7 @@ class AUAudioUnit : NSObject { init(componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) throws convenience init(componentDescription: AudioComponentDescription) throws class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = [], completionHandler: @escaping (AUAudioUnit?, Error?) -> Void) + class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) async throws -> AUAudioUnit var componentDescription: AudioComponentDescription { get } var component: AudioComponent { get } var componentName: String? { get } diff --git a/iOS/AuthenticationServices/ASAccountAuthenticationModificationExtensionContext.swift b/iOS/AuthenticationServices/ASAccountAuthenticationModificationExtensionContext.swift index 7ca426c..2e0de61 100644 --- a/iOS/AuthenticationServices/ASAccountAuthenticationModificationExtensionContext.swift +++ b/iOS/AuthenticationServices/ASAccountAuthenticationModificationExtensionContext.swift @@ -2,6 +2,7 @@ @available(iOS 14.0, *) class ASAccountAuthenticationModificationExtensionContext : NSExtensionContext { func getSignInWithAppleUpgradeAuthorization(state: String?, nonce: String?, completionHandler: @escaping (ASAuthorizationAppleIDCredential?, Error?) -> Void) + func getSignInWithAppleUpgradeAuthorization(state: String?, nonce: String?) async throws -> ASAuthorizationAppleIDCredential func completeUpgradeToSignInWithApple(userInfo: [AnyHashable : Any]? = nil) func completeChangePasswordRequest(updatedCredential: ASPasswordCredential, userInfo: [AnyHashable : Any]? = nil) } diff --git a/iOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift b/iOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift index 8feca12..2deb524 100644 --- a/iOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift +++ b/iOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift @@ -16,4 +16,5 @@ extension ASAuthorizationAppleIDProvider { class ASAuthorizationAppleIDProvider : NSObject, ASAuthorizationProvider { func createRequest() -> ASAuthorizationAppleIDRequest func getCredentialState(forUserID userID: String, completion: @escaping (ASAuthorizationAppleIDProvider.CredentialState, Error?) -> Void) + func credentialState(forUserID userID: String) async throws -> ASAuthorizationAppleIDProvider.CredentialState } diff --git a/iOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift b/iOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift index 54475f9..f46b8ae 100644 --- a/iOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift +++ b/iOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift @@ -24,6 +24,7 @@ class ASAuthorizationProviderExtensionAuthorizationRequest : NSObject { func complete(httpResponse: HTTPURLResponse, httpBody: Data?) func complete(error: Error) func presentAuthorizationViewController(completion: @escaping (Bool, Error?) -> Void) + func presentAuthorizationViewController() async throws -> Bool var url: URL { get } var requestedOperation: ASAuthorizationProviderAuthorizationOperation { get } var httpHeaders: [String : String] { get } diff --git a/iOS/AuthenticationServices/ASCredentialIdentityStore.swift b/iOS/AuthenticationServices/ASCredentialIdentityStore.swift index afea9df..055ceca 100644 --- a/iOS/AuthenticationServices/ASCredentialIdentityStore.swift +++ b/iOS/AuthenticationServices/ASCredentialIdentityStore.swift @@ -14,8 +14,13 @@ struct ASCredentialIdentityStoreError : _BridgedStoredNSError { class ASCredentialIdentityStore : NSObject { class var shared: ASCredentialIdentityStore { get } func getState(_ completion: @escaping (ASCredentialIdentityStoreState) -> Void) + func getState() async -> ASCredentialIdentityStoreState func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool func removeCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func removeCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool func removeAllCredentialIdentities(_ completion: ((Bool, Error?) -> Void)? = nil) + func removeAllCredentialIdentities() async throws -> Bool func replaceCredentialIdentities(with newCredentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func replaceCredentialIdentities(with newCredentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool } diff --git a/iOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift b/iOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift index 4ce8dd3..ac01301 100644 --- a/iOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift +++ b/iOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift @@ -2,5 +2,6 @@ @available(iOS 12.0, *) class ASCredentialProviderExtensionContext : NSExtensionContext { func completeRequest(withSelectedCredential credential: ASPasswordCredential, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(withSelectedCredential credential: ASPasswordCredential) async -> Bool func completeExtensionConfigurationRequest() } diff --git a/iOS/BackgroundTasks/BGTaskScheduler.swift b/iOS/BackgroundTasks/BGTaskScheduler.swift index fe4ee5d..fb350ff 100644 --- a/iOS/BackgroundTasks/BGTaskScheduler.swift +++ b/iOS/BackgroundTasks/BGTaskScheduler.swift @@ -20,4 +20,5 @@ class BGTaskScheduler : NSObject { func cancel(taskRequestWithIdentifier identifier: String) func cancelAllTaskRequests() func getPendingTaskRequests(completionHandler: @escaping ([BGTaskRequest]) -> Void) + func pendingTaskRequests() async -> [BGTaskRequest] } diff --git a/iOS/CallKit/CXCallController.swift b/iOS/CallKit/CXCallController.swift index af8c7e3..c48876d 100644 --- a/iOS/CallKit/CXCallController.swift +++ b/iOS/CallKit/CXCallController.swift @@ -4,8 +4,13 @@ class CXCallController : NSObject { init(queue: DispatchQueue) var callObserver: CXCallObserver { get } func request(_ transaction: CXTransaction, completion: @escaping (Error?) -> Void) + func request(_ transaction: CXTransaction) async throws @available(iOS 11.0, *) func requestTransaction(with actions: [CXAction], completion: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func requestTransaction(with actions: [CXAction]) async throws + @available(iOS 11.0, *) func requestTransaction(with action: CXAction, completion: @escaping (Error?) -> Void) + @available(iOS 11.0, *) + func requestTransaction(with action: CXAction) async throws } diff --git a/iOS/CallKit/CXCallDirectoryExtensionContext.swift b/iOS/CallKit/CXCallDirectoryExtensionContext.swift index d7866c7..188ef16 100644 --- a/iOS/CallKit/CXCallDirectoryExtensionContext.swift +++ b/iOS/CallKit/CXCallDirectoryExtensionContext.swift @@ -19,4 +19,5 @@ class CXCallDirectoryExtensionContext : NSExtensionContext { @available(iOS 11.0, *) func removeAllIdentificationEntries() func completeRequest(completionHandler completion: ((Bool) -> Void)? = nil) + func completeRequest() async -> Bool } diff --git a/iOS/CallKit/CXCallDirectoryManager.swift b/iOS/CallKit/CXCallDirectoryManager.swift index 528f7d7..4e26aca 100644 --- a/iOS/CallKit/CXCallDirectoryManager.swift +++ b/iOS/CallKit/CXCallDirectoryManager.swift @@ -13,7 +13,11 @@ extension CXCallDirectoryManager { class CXCallDirectoryManager : NSObject { class var sharedInstance: CXCallDirectoryManager { get } func reloadExtension(withIdentifier identifier: String, completionHandler completion: ((Error?) -> Void)? = nil) + func reloadExtension(withIdentifier identifier: String) async throws func getEnabledStatusForExtension(withIdentifier identifier: String, completionHandler completion: @escaping (CXCallDirectoryManager.EnabledStatus, Error?) -> Void) + func enabledStatusForExtension(withIdentifier identifier: String) async throws -> CXCallDirectoryManager.EnabledStatus @available(iOS 13.4, *) func openSettings(completionHandler completion: ((Error?) -> Void)? = nil) + @available(iOS 13.4, *) + func openSettings() async throws } diff --git a/iOS/CallKit/CXProvider.swift b/iOS/CallKit/CXProvider.swift index c6e07da..361f93d 100644 --- a/iOS/CallKit/CXProvider.swift +++ b/iOS/CallKit/CXProvider.swift @@ -28,6 +28,7 @@ class CXProvider : NSObject { init(configuration: CXProviderConfiguration) func setDelegate(_ delegate: CXProviderDelegate?, queue: DispatchQueue?) func reportNewIncomingCall(with UUID: UUID, update: CXCallUpdate, completion: @escaping (Error?) -> Void) + func reportNewIncomingCall(with UUID: UUID, update: CXCallUpdate) async throws func reportCall(with UUID: UUID, updated update: CXCallUpdate) func reportCall(with UUID: UUID, endedAt dateEnded: Date?, reason endedReason: CXCallEndedReason) func reportOutgoingCall(with UUID: UUID, startedConnectingAt dateStartedConnecting: Date?) diff --git a/iOS/CarPlay/CPEntity.swift b/iOS/CarPlay/CPEntity.swift new file mode 100644 index 0000000..c278921 --- /dev/null +++ b/iOS/CarPlay/CPEntity.swift @@ -0,0 +1,4 @@ + +@available(iOS 14.0, *) +class CPEntity : NSObject, NSSecureCoding { +} diff --git a/iOS/CarPlay/CPInterfaceController.swift b/iOS/CarPlay/CPInterfaceController.swift index 348ba0b..f968ad0 100644 --- a/iOS/CarPlay/CPInterfaceController.swift +++ b/iOS/CarPlay/CPInterfaceController.swift @@ -8,17 +8,31 @@ class CPInterfaceController : NSObject { @available(iOS 14.0, *) func setRootTemplate(_ rootTemplate: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func setRootTemplate(_ rootTemplate: CPTemplate, animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func pushTemplate(_ templateToPush: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func pushTemplate(_ templateToPush: CPTemplate, animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func popTemplate(animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func popTemplate(animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func popToRootTemplate(animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func popToRootTemplate(animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func pop(to targetTemplate: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func pop(to targetTemplate: CPTemplate, animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func presentTemplate(_ templateToPresent: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func presentTemplate(_ templateToPresent: CPTemplate, animated: Bool) async throws -> Bool + @available(iOS 14.0, *) func dismissTemplate(animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) + @available(iOS 14.0, *) + func dismissTemplate(animated: Bool) async throws -> Bool var presentedTemplate: CPTemplate? { get } var rootTemplate: CPTemplate { get } var topTemplate: CPTemplate? { get } diff --git a/iOS/CarPlay/CPListTemplate.swift b/iOS/CarPlay/CPListTemplate.swift index 713daaa..3283785 100644 --- a/iOS/CarPlay/CPListTemplate.swift +++ b/iOS/CarPlay/CPListTemplate.swift @@ -26,4 +26,6 @@ class CPListTemplate : CPTemplate, CPBarButtonProviding { protocol CPListTemplateDelegate : NSObjectProtocol { @available(iOS, introduced: 12.0, deprecated: 14.0) func listTemplate(_ listTemplate: CPListTemplate, didSelect item: CPListItem, completionHandler: @escaping () -> Void) + @available(iOS, introduced: 12.0, deprecated: 14.0) + func listTemplate(_ listTemplate: CPListTemplate, didSelect item: CPListItem) async } diff --git a/iOS/CarPlay/CPMapTemplate.swift b/iOS/CarPlay/CPMapTemplate.swift index f34aa76..ee62a61 100644 --- a/iOS/CarPlay/CPMapTemplate.swift +++ b/iOS/CarPlay/CPMapTemplate.swift @@ -57,6 +57,7 @@ class CPMapTemplate : CPTemplate, CPBarButtonProviding { var currentNavigationAlert: CPNavigationAlert? { get } func present(navigationAlert: CPNavigationAlert, animated: Bool) func dismissNavigationAlert(animated: Bool, completion: @escaping (Bool) -> Void) + func dismissNavigationAlert(animated: Bool) async -> Bool } @available(iOS 12.0, *) protocol CPMapTemplateDelegate : NSObjectProtocol { diff --git a/iOS/CarPlay/CPSearchTemplate.swift b/iOS/CarPlay/CPSearchTemplate.swift index ab20cd7..510e6cc 100644 --- a/iOS/CarPlay/CPSearchTemplate.swift +++ b/iOS/CarPlay/CPSearchTemplate.swift @@ -6,6 +6,8 @@ class CPSearchTemplate : CPTemplate { @available(iOS 12.0, *) protocol CPSearchTemplateDelegate : NSObjectProtocol { func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String, completionHandler: @escaping ([CPListItem]) -> Void) + func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String) async -> [CPListItem] func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem, completionHandler: @escaping () -> Void) + func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem) async optional func searchTemplateSearchButtonPressed(_ searchTemplate: CPSearchTemplate) } diff --git a/iOS/ClassKit/CLSContext.swift b/iOS/ClassKit/CLSContext.swift index 436063f..85dac78 100644 --- a/iOS/ClassKit/CLSContext.swift +++ b/iOS/ClassKit/CLSContext.swift @@ -89,4 +89,5 @@ extension CLSContext { func removeFromParent() func addChildContext(_ child: CLSContext) func descendant(matchingIdentifierPath identifierPath: [String], completion: @escaping (CLSContext?, Error?) -> Void) + func descendant(matchingIdentifierPath identifierPath: [String]) async throws -> CLSContext } diff --git a/iOS/ClassKit/CLSContextProvider.swift b/iOS/ClassKit/CLSContextProvider.swift index 12a190e..c2ff932 100644 --- a/iOS/ClassKit/CLSContextProvider.swift +++ b/iOS/ClassKit/CLSContextProvider.swift @@ -2,4 +2,5 @@ @available(iOS 12.2, *) protocol CLSContextProvider { func updateDescendants(of context: CLSContext, completion: @escaping (Error?) -> Void) + func updateDescendants(of context: CLSContext) async throws } diff --git a/iOS/ClassKit/CLSDataStore.swift b/iOS/ClassKit/CLSDataStore.swift index b475be3..e626453 100644 --- a/iOS/ClassKit/CLSDataStore.swift +++ b/iOS/ClassKit/CLSDataStore.swift @@ -11,12 +11,15 @@ class CLSDataStore : NSObject { var runningActivity: CLSActivity? { get } weak var delegate: @sil_weak CLSDataStoreDelegate? func save(completion: ((Error?) -> Void)? = nil) + func save() async throws @available(iOS 12.2, *) func completeAllAssignedActivities(matching contextPath: [String]) } @available(iOS 11.3, *) extension CLSDataStore { func contexts(matching predicate: NSPredicate, completion: @escaping ([CLSContext], Error?) -> Void) + func contexts(matching predicate: NSPredicate) async throws -> [CLSContext] func contexts(matchingIdentifierPath identifierPath: [String], completion: @escaping ([CLSContext], Error?) -> Void) + func contexts(matchingIdentifierPath identifierPath: [String]) async throws -> [CLSContext] func remove(_ context: CLSContext) } diff --git a/iOS/ClockKit/CLKWatchFaceLibrary.swift b/iOS/ClockKit/CLKWatchFaceLibrary.swift index a5893c8..ea5a12d 100644 --- a/iOS/ClockKit/CLKWatchFaceLibrary.swift +++ b/iOS/ClockKit/CLKWatchFaceLibrary.swift @@ -15,4 +15,5 @@ extension CLKWatchFaceLibrary { @available(iOS 14.0, *) class CLKWatchFaceLibrary : NSObject { func addWatchFace(at fileURL: URL, completionHandler handler: @escaping (Error?) -> Void) + func addWatchFace(at fileURL: URL) async throws } diff --git a/iOS/CloudKit/CKContainer.swift b/iOS/CloudKit/CKContainer.swift index d564da8..aec6a00 100644 --- a/iOS/CloudKit/CKContainer.swift +++ b/iOS/CloudKit/CKContainer.swift @@ -51,6 +51,7 @@ extension NSNotification.Name { } extension CKContainer { func accountStatus(completionHandler: @escaping (CKAccountStatus, Error?) -> Void) + func accountStatus() async throws -> CKAccountStatus } @available(iOS 8.0, *) struct CKContainer_Application_Permissions : OptionSet { @@ -70,34 +71,59 @@ enum CKContainer_Application_PermissionStatus : Int { typealias CKContainer_Application_PermissionBlock = (CKContainer_Application_PermissionStatus, Error?) -> Void extension CKContainer { func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus } extension CKContainer { func fetchUserRecordID(completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func fetchUserRecordID() async throws -> CKRecord.ID @available(iOS 10.0, *) func discoverAllIdentities(completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Void) @available(iOS 10.0, *) + func discoverAllIdentities() async throws -> [CKUserIdentity] + @available(iOS 10.0, *) func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(iOS 10.0, *) + func discoverUserIdentity(withEmailAddress email: String) async throws -> CKUserIdentity + @available(iOS 10.0, *) func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(iOS 10.0, *) + func discoverUserIdentity(withPhoneNumber phoneNumber: String) async throws -> CKUserIdentity + @available(iOS 10.0, *) func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) + @available(iOS 10.0, *) + func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity } extension CKContainer { @available(iOS 10.0, *) func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(iOS 10.0, *) + func fetchShareParticipant(withEmailAddress emailAddress: String) async throws -> CKShare.Participant + @available(iOS 10.0, *) func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(iOS 10.0, *) + func fetchShareParticipant(withPhoneNumber phoneNumber: String) async throws -> CKShare.Participant + @available(iOS 10.0, *) func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(iOS 10.0, *) + func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant + @available(iOS 10.0, *) func fetchShareMetadata(with url: URL, completionHandler: @escaping (CKShare.Metadata?, Error?) -> Void) @available(iOS 10.0, *) + func fetchShareMetadata(with url: URL) async throws -> CKShare.Metadata + @available(iOS 10.0, *) func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping (CKShare?, Error?) -> Void) + @available(iOS 10.0, *) + func accept(_ metadata: CKShare.Metadata) async throws -> CKShare } extension CKContainer { @available(iOS 9.3, *) func __fetchAllLongLivedOperationIDs(completionHandler: @escaping ([String]?, Error?) -> Void) @available(iOS 9.3, *) + func __fetchAllLongLivedOperationIDs() async throws -> [String] + @available(iOS 9.3, *) func __fetchLongLivedOperation(withID operationID: String, completionHandler: @escaping (CKOperation?, Error?) -> Void) + @available(iOS 9.3, *) + func __fetchLongLivedOperation(withID operationID: String) async throws -> CKOperation } diff --git a/iOS/CloudKit/CKDatabase.swift b/iOS/CloudKit/CKDatabase.swift index 3aba93c..811cadf 100644 --- a/iOS/CloudKit/CKDatabase.swift +++ b/iOS/CloudKit/CKDatabase.swift @@ -25,19 +25,35 @@ class CKDatabase : NSObject { } extension CKDatabase { func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func fetch(withRecordID recordID: CKRecord.ID) async throws -> CKRecord func save(_ record: CKRecord, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func save(_ record: CKRecord) async throws -> CKRecord func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func delete(withRecordID recordID: CKRecord.ID) async throws -> CKRecord.ID func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?, completionHandler: @escaping ([CKRecord]?, Error?) -> Void) + func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?) async throws -> [CKRecord] func fetchAllRecordZones(completionHandler: @escaping ([CKRecordZone]?, Error?) -> Void) + func fetchAllRecordZones() async throws -> [CKRecordZone] func fetch(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func fetch(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone func save(_ zone: CKRecordZone, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func save(_ zone: CKRecordZone) async throws -> CKRecordZone func delete(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone.ID?, Error?) -> Void) + func delete(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone.ID @available(iOS 8.0, *) func __fetch(withSubscriptionID subscriptionID: String, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(iOS 8.0, *) + func __fetch(withSubscriptionID subscriptionID: String) async throws -> CKSubscription + @available(iOS 8.0, *) func fetchAllSubscriptions(completionHandler: @escaping ([CKSubscription]?, Error?) -> Void) @available(iOS 8.0, *) + func fetchAllSubscriptions() async throws -> [CKSubscription] + @available(iOS 8.0, *) func save(_ subscription: CKSubscription, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(iOS 8.0, *) + func save(_ subscription: CKSubscription) async throws -> CKSubscription + @available(iOS 8.0, *) func __delete(withSubscriptionID subscriptionID: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(iOS 8.0, *) + func __delete(withSubscriptionID subscriptionID: String) async throws -> String } diff --git a/iOS/Contacts/CNContactStore.swift b/iOS/Contacts/CNContactStore.swift index 34eac4a..8d190a2 100644 --- a/iOS/Contacts/CNContactStore.swift +++ b/iOS/Contacts/CNContactStore.swift @@ -18,6 +18,7 @@ enum CNAuthorizationStatus : Int { class CNContactStore : NSObject { class func authorizationStatus(for entityType: CNEntityType) -> CNAuthorizationStatus func requestAccess(for entityType: CNEntityType, completionHandler: @escaping (Bool, Error?) -> Void) + func requestAccess(for entityType: CNEntityType) async throws -> Bool func unifiedContacts(matching predicate: NSPredicate, keysToFetch keys: [CNKeyDescriptor]) throws -> [CNContact] func unifiedContact(withIdentifier identifier: String, keysToFetch keys: [CNKeyDescriptor]) throws -> CNContact func enumerateContacts(with fetchRequest: CNContactFetchRequest, usingBlock block: @escaping (CNContact, UnsafeMutablePointer) -> Void) throws diff --git a/iOS/CoreAudioKit/AUViewController.swift b/iOS/CoreAudioKit/AUViewController.swift index 27b1667..41091d9 100644 --- a/iOS/CoreAudioKit/AUViewController.swift +++ b/iOS/CoreAudioKit/AUViewController.swift @@ -12,6 +12,7 @@ class AUAudioUnitViewConfiguration : NSObject, NSSecureCoding { @available(iOS 9.0, *) extension AUAudioUnit { func requestViewController(completionHandler: @escaping (UIViewController?) -> Void) + func requestViewController() async -> UIViewController? @available(iOS 11.0, *) func supportedViewConfigurations(_ availableViewConfigurations: [AUAudioUnitViewConfiguration]) -> IndexSet @available(iOS 11.0, *) diff --git a/iOS/CoreData/NSPersistentContainer.swift b/iOS/CoreData/NSPersistentContainer.swift index 5ca9480..3036085 100644 --- a/iOS/CoreData/NSPersistentContainer.swift +++ b/iOS/CoreData/NSPersistentContainer.swift @@ -10,6 +10,7 @@ class NSPersistentContainer : NSObject { convenience init(name: String) init(name: String, managedObjectModel model: NSManagedObjectModel) func loadPersistentStores(completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + func loadPersistentStores() async throws -> NSPersistentStoreDescription func newBackgroundContext() -> NSManagedObjectContext func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void) } diff --git a/iOS/CoreData/NSPersistentStoreCoordinator.swift b/iOS/CoreData/NSPersistentStoreCoordinator.swift index 73adbab..2875986 100644 --- a/iOS/CoreData/NSPersistentStoreCoordinator.swift +++ b/iOS/CoreData/NSPersistentStoreCoordinator.swift @@ -83,6 +83,8 @@ class NSPersistentStoreCoordinator : NSObject, NSLocking { func addPersistentStore(ofType storeType: String, configurationName configuration: String?, at storeURL: URL?, options: [AnyHashable : Any]? = nil) throws -> NSPersistentStore @available(iOS 10.0, *) func addPersistentStore(with storeDescription: NSPersistentStoreDescription, completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + @available(iOS 10.0, *) + func addPersistentStore(with storeDescription: NSPersistentStoreDescription) async throws -> NSPersistentStoreDescription func remove(_ store: NSPersistentStore) throws func setMetadata(_ metadata: [String : Any]?, for store: NSPersistentStore) func metadata(for store: NSPersistentStore) -> [String : Any] diff --git a/iOS/CoreFoundation/CFError.swift b/iOS/CoreFoundation/CFError.swift index e47d0f9..2510dc8 100644 --- a/iOS/CoreFoundation/CFError.swift +++ b/iOS/CoreFoundation/CFError.swift @@ -2,9 +2,6 @@ typealias CFErrorDomain = CFString class CFError : _CFObject { } - -extension CFError : Error { -} @available(iOS 2.0, *) func CFErrorGetTypeID() -> CFTypeID @available(iOS 2.0, *) diff --git a/iOS/CoreGraphics/CGAffineTransform.swift b/iOS/CoreGraphics/CGAffineTransform.swift index 0cd7eee..55f8c69 100644 --- a/iOS/CoreGraphics/CGAffineTransform.swift +++ b/iOS/CoreGraphics/CGAffineTransform.swift @@ -19,9 +19,6 @@ extension CGAffineTransform { extension CGAffineTransform : Codable { } - -extension CGAffineTransform : _ObjectiveCBridgeable { -} extension CGAffineTransform { @available(iOS 2.0, *) /*not inherited*/ init(translationX tx: CGFloat, y ty: CGFloat) diff --git a/iOS/CoreGraphics/CGGeometry.swift b/iOS/CoreGraphics/CGGeometry.swift index 315e756..8c766c8 100644 --- a/iOS/CoreGraphics/CGGeometry.swift +++ b/iOS/CoreGraphics/CGGeometry.swift @@ -27,9 +27,6 @@ extension CGPoint : Equatable { extension CGPoint : Codable { } - -extension CGPoint : _ObjectiveCBridgeable { -} struct CGSize { var width: CGFloat var height: CGFloat @@ -58,9 +55,6 @@ extension CGSize : Equatable { extension CGSize : Codable { } - -extension CGSize : _ObjectiveCBridgeable { -} struct CGVector { var dx: CGFloat var dy: CGFloat @@ -82,9 +76,6 @@ extension CGVector : CustomDebugStringConvertible { extension CGVector : Codable { } - -extension CGVector : _ObjectiveCBridgeable { -} struct CGRect { var origin: CGPoint var size: CGSize @@ -115,9 +106,6 @@ extension CGRect : Equatable { extension CGRect : Codable { } - -extension CGRect : _ObjectiveCBridgeable { -} @frozen enum CGRectEdge : UInt32 { init?(rawValue: UInt32) var rawValue: UInt32 { get } diff --git a/iOS/CoreGraphics/CoreGraphics.swift b/iOS/CoreGraphics/CoreGraphics.swift index f7de2ee..46e021d 100644 --- a/iOS/CoreGraphics/CoreGraphics.swift +++ b/iOS/CoreGraphics/CoreGraphics.swift @@ -39,13 +39,6 @@ extension CGFloat : _CVarArgPassedAsDouble, _CVarArgAligned { extension CGFloat : Codable { } -extension CGFloat : _ObjectiveCBridgeable { - @available(swift, deprecated: 4, renamed: "init(truncating:)") - init(_ number: __shared NSNumber) - init(truncating number: __shared NSNumber) - init?(exactly number: __shared NSNumber) -} - enum CGPathFillRule : Int { case winding case evenOdd diff --git a/iOS/CoreHaptics/CHHapticEngine.swift b/iOS/CoreHaptics/CHHapticEngine.swift index f683144..6d80bb7 100644 --- a/iOS/CoreHaptics/CHHapticEngine.swift +++ b/iOS/CoreHaptics/CHHapticEngine.swift @@ -35,8 +35,10 @@ class CHHapticEngine : NSObject { var isAutoShutdownEnabled: Bool init() throws func start(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func start() async throws func start() throws func stop(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func stop() async throws func notifyWhenPlayersFinished(finishedHandler: @escaping CHHapticEngine.FinishedHandler) func makePlayer(with pattern: CHHapticPattern) throws -> CHHapticPatternPlayer func makeAdvancedPlayer(with pattern: CHHapticPattern) throws -> CHHapticAdvancedPatternPlayer diff --git a/iOS/CoreLocation/CLGeocoder.swift b/iOS/CoreLocation/CLGeocoder.swift index 2d5502f..0e5f298 100644 --- a/iOS/CoreLocation/CLGeocoder.swift +++ b/iOS/CoreLocation/CLGeocoder.swift @@ -4,14 +4,23 @@ typealias CLGeocodeCompletionHandler = ([CLPlacemark]?, Error?) -> Void class CLGeocoder : NSObject { var isGeocoding: Bool { get } func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CLGeocodeCompletionHandler) + func reverseGeocodeLocation(_ location: CLLocation) async throws -> [CLPlacemark] @available(iOS 11.0, *) func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(iOS 11.0, *) + func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?) async throws -> [CLPlacemark] @available(iOS, introduced: 5.0, deprecated: 11.0, message: "Use -geocodePostalAddress:completionHandler:") func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: @escaping CLGeocodeCompletionHandler) + @available(iOS, introduced: 5.0, deprecated: 11.0, message: "Use -geocodePostalAddress:completionHandler:") + func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any]) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, in region: CLRegion?, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String, in region: CLRegion?) async throws -> [CLPlacemark] @available(iOS 11.0, *) func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(iOS 11.0, *) + func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?) async throws -> [CLPlacemark] func cancelGeocode() } extension CLGeocoder { diff --git a/iOS/CoreLocation/CLLocationManager.swift b/iOS/CoreLocation/CLLocationManager.swift index d5bea7b..516d1a7 100644 --- a/iOS/CoreLocation/CLLocationManager.swift +++ b/iOS/CoreLocation/CLLocationManager.swift @@ -92,6 +92,8 @@ class CLLocationManager : NSObject { @available(iOS 14.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil) @available(iOS 14.0, *) + func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) async throws + @available(iOS 14.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) func startUpdatingLocation() func stopUpdatingLocation() diff --git a/iOS/CoreML/MLModel.swift b/iOS/CoreML/MLModel.swift index 4e3b614..50e2e6b 100644 --- a/iOS/CoreML/MLModel.swift +++ b/iOS/CoreML/MLModel.swift @@ -9,6 +9,8 @@ class MLModel : NSObject { convenience init(contentsOf url: URL, configuration: MLModelConfiguration) throws @available(iOS 14.0, *) class func __loadContents(of url: URL, configuration: MLModelConfiguration, completionHandler handler: @escaping (MLModel?, Error?) -> Void) + @available(iOS 14.0, *) + class func __loadContents(of url: URL, configuration: MLModelConfiguration) async throws -> MLModel func prediction(from input: MLFeatureProvider) throws -> MLFeatureProvider func prediction(from input: MLFeatureProvider, options: MLPredictionOptions) throws -> MLFeatureProvider @available(iOS 12.0, *) diff --git a/iOS/CoreML/MLModelCollection.swift b/iOS/CoreML/MLModelCollection.swift index f16cd50..f72113b 100644 --- a/iOS/CoreML/MLModelCollection.swift +++ b/iOS/CoreML/MLModelCollection.swift @@ -6,6 +6,7 @@ class MLModelCollection : NSObject { var deploymentID: String { get } class func __beginAccessingModelCollection(withIdentifier identifier: String, completionHandler: @escaping (MLModelCollection?, Error?) -> Void) -> Progress class func __endAccessingModelCollection(withIdentifier identifier: String, completionHandler: @escaping (Bool, Error?) -> Void) + class func __endAccessingModelCollection(withIdentifier identifier: String) async throws -> Bool } @available(macOS 11.0, iOS 14.0, *) diff --git a/iOS/CoreNFC/CoreNFC.swift b/iOS/CoreNFC/CoreNFC.swift index d5a4137..d052e75 100644 --- a/iOS/CoreNFC/CoreNFC.swift +++ b/iOS/CoreNFC/CoreNFC.swift @@ -142,6 +142,8 @@ class NFCTagReaderSession : NFCReaderSession { func restartPolling() @available(iOS 13.0, *) func __connect(to tag: __NFCTag, completionHandler: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func __connect(to tag: __NFCTag) async throws } @available(iOS 13.0, *) @@ -184,6 +186,8 @@ class NFCNDEFReaderSession : NFCReaderSession { func restartPolling() @available(iOS 13.0, *) func connect(to tag: NFCNDEFTag, completionHandler: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func connect(to tag: NFCNDEFTag) async throws } extension NSUserActivity { @available(iOS 12.0, *) @@ -276,67 +280,131 @@ protocol NFCISO15693Tag : NFCNDEFTag, __NFCTag { @available(iOS 11.0, *) func sendCustomCommand(commandConfiguration: NFCISO15693CustomCommandConfiguration, completionHandler: @escaping (Data, Error?) -> Void) @available(iOS 11.0, *) + func sendCustomCommand(commandConfiguration: NFCISO15693CustomCommandConfiguration) async throws -> Data + @available(iOS 11.0, *) func readMultipleBlock(readConfiguration: NFCISO15693ReadMultipleBlocksConfiguration, completionHandler: @escaping (Data, Error?) -> Void) + @available(iOS 11.0, *) + func readMultipleBlock(readConfiguration: NFCISO15693ReadMultipleBlocksConfiguration) async throws -> Data @available(iOS 13.0, *) func stayQuiet(completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func stayQuiet() async throws + @available(iOS 13.0, *) func readSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8, completionHandler: @escaping (Data, Error?) -> Void) @available(iOS 13.0, *) + func readSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8) async throws -> Data + @available(iOS 13.0, *) func writeSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8, dataBlock: Data, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func writeSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8, dataBlock: Data) async throws + @available(iOS 13.0, *) func lockBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func lockBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: UInt8) async throws + @available(iOS 13.0, *) func readMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([Data], Error?) -> Void) @available(iOS 13.0, *) + func readMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [Data] + @available(iOS 13.0, *) func writeMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, dataBlocks: [Data], completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func writeMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, dataBlocks: [Data]) async throws + @available(iOS 13.0, *) func select(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func select(requestFlags flags: NFCISO15693RequestFlag) async throws + @available(iOS 13.0, *) func resetToReady(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func resetToReady(requestFlags flags: NFCISO15693RequestFlag) async throws + @available(iOS 13.0, *) func writeAFI(requestFlags flags: NFCISO15693RequestFlag, afi: UInt8, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func writeAFI(requestFlags flags: NFCISO15693RequestFlag, afi: UInt8) async throws + @available(iOS 13.0, *) func lockAFI(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func lockAFI(requestFlags flags: NFCISO15693RequestFlag) async throws + @available(iOS 13.0, *) func writeDSFID(requestFlags flags: NFCISO15693RequestFlag, dsfid: UInt8, completionHandler: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func writeDSFID(requestFlags flags: NFCISO15693RequestFlag, dsfid: UInt8) async throws @available(iOS, introduced: 13.0, deprecated: 14.0) func lockDFSID(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Error?) -> Void) + @available(iOS, introduced: 13.0, deprecated: 14.0) + func lockDFSID(requestFlags flags: NFCISO15693RequestFlag) async throws @available(iOS 14.0, *) func lockDSFID(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Error?) -> Void) + @available(iOS 14.0, *) + func lockDSFID(requestFlags flags: NFCISO15693RequestFlag) async throws @available(iOS, introduced: 13.0, deprecated: 14.0) func getSystemInfo(requestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (Int, Int, Int, Int, Int, Error?) -> Void) + @available(iOS, introduced: 13.0, deprecated: 14.0) + func getSystemInfo(requestFlags flags: NFCISO15693RequestFlag) async throws -> (Int, Int, Int, Int, Int) @available(iOS 14.0, *) func __getSystemInfoAndUID(with flags: NFCISO15693RequestFlag, completionHandler: @escaping (Data?, Int, Int, Int, Int, Int, Error?) -> Void) + @available(iOS 14.0, *) + func __systemInfoAndUID(with flags: NFCISO15693RequestFlag) async throws -> (Data, Int, Int, Int, Int, Int) @available(iOS 13.0, *) func getMultipleBlockSecurityStatus(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([NSNumber], Error?) -> Void) + @available(iOS 13.0, *) + func getMultipleBlockSecurityStatus(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [NSNumber] @available(iOS 14.0, *) func __fastReadMultipleBlocks(with flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([Data], Error?) -> Void) + @available(iOS 14.0, *) + func __fastReadMultipleBlocks(with flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [Data] @available(iOS 13.0, *) func customCommand(requestFlags flags: NFCISO15693RequestFlag, customCommandCode: Int, customRequestParameters: Data, completionHandler: @escaping (Data, Error?) -> Void) @available(iOS 13.0, *) + func customCommand(requestFlags flags: NFCISO15693RequestFlag, customCommandCode: Int, customRequestParameters: Data) async throws -> Data + @available(iOS 13.0, *) func extendedReadSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int, completionHandler: @escaping (Data, Error?) -> Void) @available(iOS 13.0, *) + func extendedReadSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int) async throws -> Data + @available(iOS 13.0, *) func extendedWriteSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int, dataBlock: Data, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func extendedWriteSingleBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int, dataBlock: Data) async throws + @available(iOS 13.0, *) func extendedLockBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func extendedLockBlock(requestFlags flags: NFCISO15693RequestFlag, blockNumber: Int) async throws + @available(iOS 13.0, *) func extendedReadMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([Data], Error?) -> Void) + @available(iOS 13.0, *) + func extendedReadMultipleBlocks(requestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [Data] @available(iOS 14.0, *) func __extendedWriteMultipleBlocks(withRequestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, dataBlocks: [Data], completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func __extendedWriteMultipleBlocks(withRequestFlags flags: NFCISO15693RequestFlag, blockRange: NSRange, dataBlocks: [Data]) async throws + @available(iOS 14.0, *) func __authenticate(withRequestFlags flags: NFCISO15693RequestFlag, cryptoSuiteIdentifier: Int, message: Data, completionHandler: @escaping (NFCISO15693ResponseFlag, Data, Error?) -> Void) @available(iOS 14.0, *) + func __authenticate(withRequestFlags flags: NFCISO15693RequestFlag, cryptoSuiteIdentifier: Int, message: Data) async throws -> (NFCISO15693ResponseFlag, Data) + @available(iOS 14.0, *) func __keyUpdate(withRequestFlags flags: NFCISO15693RequestFlag, keyIdentifier: Int, message: Data, completionHandler: @escaping (NFCISO15693ResponseFlag, Data, Error?) -> Void) @available(iOS 14.0, *) + func __keyUpdate(withRequestFlags flags: NFCISO15693RequestFlag, keyIdentifier: Int, message: Data) async throws -> (NFCISO15693ResponseFlag, Data) + @available(iOS 14.0, *) func __challenge(withRequestFlags flags: NFCISO15693RequestFlag, cryptoSuiteIdentifier: Int, message: Data, completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func __challenge(withRequestFlags flags: NFCISO15693RequestFlag, cryptoSuiteIdentifier: Int, message: Data) async throws + @available(iOS 14.0, *) func __readBuffer(withRequestFlags flags: NFCISO15693RequestFlag, completionHandler: @escaping (NFCISO15693ResponseFlag, Data, Error?) -> Void) @available(iOS 14.0, *) + func __readBuffer(withRequestFlags flags: NFCISO15693RequestFlag) async throws -> (NFCISO15693ResponseFlag, Data) + @available(iOS 14.0, *) func __extendedGetMultipleBlockSecurityStatus(with flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([NSNumber], Error?) -> Void) @available(iOS 14.0, *) + func __extendedGetMultipleBlockSecurityStatus(with flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [NSNumber] + @available(iOS 14.0, *) func __extendedFastReadMultipleBlocks(with flags: NFCISO15693RequestFlag, blockRange: NSRange, completionHandler: @escaping ([Data], Error?) -> Void) @available(iOS 14.0, *) + func __extendedFastReadMultipleBlocks(with flags: NFCISO15693RequestFlag, blockRange: NSRange) async throws -> [Data] + @available(iOS 14.0, *) func __sendRequest(withFlag flags: Int, commandCode: Int, data: Data?, completionHandler: @escaping (NFCISO15693ResponseFlag, Data?, Error?) -> Void) + @available(iOS 14.0, *) + func __sendRequest(withFlag flags: Int, commandCode: Int, data: Data?) async throws -> (NFCISO15693ResponseFlag, Data) } @available(iOS 11.0, *) @@ -393,11 +461,19 @@ protocol NFCNDEFTag : NSCopying, NSSecureCoding, NSObjectProtocol { @available(iOS 13.0, *) func queryNDEFStatus(completionHandler: @escaping (NFCNDEFStatus, Int, Error?) -> Void) @available(iOS 13.0, *) + func queryNDEFStatus() async throws -> (NFCNDEFStatus, Int) + @available(iOS 13.0, *) func readNDEF(completionHandler: @escaping (NFCNDEFMessage?, Error?) -> Void) @available(iOS 13.0, *) + func readNDEF() async throws -> NFCNDEFMessage + @available(iOS 13.0, *) func writeNDEF(_ ndefMessage: NFCNDEFMessage, completionHandler: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func writeNDEF(_ ndefMessage: NFCNDEFMessage) async throws + @available(iOS 13.0, *) func writeLock(completionHandler: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func writeLock() async throws } @available(iOS 14.0, *) enum NFCFeliCaPollingRequestCode : Int { @@ -468,23 +544,43 @@ protocol NFCFeliCaTag : NFCNDEFTag, __NFCTag { @available(iOS 13.0, *) func polling(systemCode: Data, requestCode: NFCFeliCaPollingRequestCode, timeSlot: NFCFeliCaPollingTimeSlot, completionHandler: @escaping (Data, Data, Error?) -> Void) @available(iOS 13.0, *) + func polling(systemCode: Data, requestCode: NFCFeliCaPollingRequestCode, timeSlot: NFCFeliCaPollingTimeSlot) async throws -> (Data, Data) + @available(iOS 13.0, *) func requestService(nodeCodeList: [Data], completionHandler: @escaping ([Data], Error?) -> Void) @available(iOS 13.0, *) + func requestService(nodeCodeList: [Data]) async throws -> [Data] + @available(iOS 13.0, *) func requestResponse(completionHandler: @escaping (Int, Error?) -> Void) @available(iOS 13.0, *) + func requestResponse() async throws -> Int + @available(iOS 13.0, *) func readWithoutEncryption(serviceCodeList: [Data], blockList: [Data], completionHandler: @escaping (Int, Int, [Data], Error?) -> Void) @available(iOS 13.0, *) + func readWithoutEncryption(serviceCodeList: [Data], blockList: [Data]) async throws -> (Int, Int, [Data]) + @available(iOS 13.0, *) func writeWithoutEncryption(serviceCodeList: [Data], blockList: [Data], blockData: [Data], completionHandler: @escaping (Int, Int, Error?) -> Void) @available(iOS 13.0, *) + func writeWithoutEncryption(serviceCodeList: [Data], blockList: [Data], blockData: [Data]) async throws -> (Int, Int) + @available(iOS 13.0, *) func requestSystemCode(completionHandler: @escaping ([Data], Error?) -> Void) @available(iOS 13.0, *) + func requestSystemCode() async throws -> [Data] + @available(iOS 13.0, *) func requestServiceV2(nodeCodeList: [Data], completionHandler: @escaping (Int, Int, NFCFeliCaEncryptionId, [Data], [Data], Error?) -> Void) @available(iOS 13.0, *) + func requestServiceV2(nodeCodeList: [Data]) async throws -> (Int, Int, NFCFeliCaEncryptionId, [Data], [Data]) + @available(iOS 13.0, *) func requestSpecificationVersion(completionHandler: @escaping (Int, Int, Data, Data, Error?) -> Void) @available(iOS 13.0, *) + func requestSpecificationVersion() async throws -> (Int, Int, Data, Data) + @available(iOS 13.0, *) func resetMode(completionHandler: @escaping (Int, Int, Error?) -> Void) @available(iOS 13.0, *) + func resetMode() async throws -> (Int, Int) + @available(iOS 13.0, *) func sendFeliCaCommand(commandPacket: Data, completionHandler: @escaping (Data, Error?) -> Void) + @available(iOS 13.0, *) + func sendFeliCaCommand(commandPacket: Data) async throws -> Data } @available(iOS 14.0, *) @@ -543,6 +639,8 @@ protocol NFCISO7816Tag : NFCNDEFTag, __NFCTag { var proprietaryApplicationDataCoding: Bool { get } @available(iOS 13.0, *) func sendCommand(apdu: NFCISO7816APDU, completionHandler: @escaping (Data, UInt8, UInt8, Error?) -> Void) + @available(iOS 13.0, *) + func sendCommand(apdu: NFCISO7816APDU) async throws -> (Data, UInt8, UInt8) } @available(iOS 14.0, *) @@ -574,7 +672,11 @@ protocol NFCMiFareTag : NFCNDEFTag, __NFCTag { @available(iOS 13.0, *) func sendMiFareCommand(commandPacket command: Data, completionHandler: @escaping (Data, Error?) -> Void) @available(iOS 13.0, *) + func sendMiFareCommand(commandPacket command: Data) async throws -> Data + @available(iOS 13.0, *) func sendMiFareISO7816Command(_ apdu: NFCISO7816APDU, completionHandler: @escaping (Data, UInt8, UInt8, Error?) -> Void) + @available(iOS 13.0, *) + func sendMiFareISO7816Command(_ apdu: NFCISO7816APDU) async throws -> (Data, UInt8, UInt8) } @available(iOS 14.0, *) diff --git a/iOS/CoreSpotlight/CSSearchableIndex.swift b/iOS/CoreSpotlight/CSSearchableIndex.swift index 9d77131..ff5ec6a 100644 --- a/iOS/CoreSpotlight/CSSearchableIndex.swift +++ b/iOS/CoreSpotlight/CSSearchableIndex.swift @@ -22,14 +22,20 @@ class CSSearchableIndex : NSObject { init(name: String) init(name: String, protectionClass: FileProtectionType?) func indexSearchableItems(_ items: [CSSearchableItem], completionHandler: ((Error?) -> Void)? = nil) + func indexSearchableItems(_ items: [CSSearchableItem]) async throws func deleteSearchableItems(withIdentifiers identifiers: [String], completionHandler: ((Error?) -> Void)? = nil) + func deleteSearchableItems(withIdentifiers identifiers: [String]) async throws func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String], completionHandler: ((Error?) -> Void)? = nil) + func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String]) async throws func deleteAllSearchableItems(completionHandler: ((Error?) -> Void)? = nil) + func deleteAllSearchableItems() async throws } extension CSSearchableIndex { func beginBatch() func endBatch(withClientState clientState: Data, completionHandler: ((Error?) -> Void)? = nil) + func endBatch(withClientState clientState: Data) async throws func fetchLastClientState(completionHandler: @escaping (Data?, Error?) -> Void) + func fetchLastClientState() async throws -> Data } @available(iOS 9.0, *) protocol CSSearchableIndexDelegate : NSObjectProtocol { diff --git a/iOS/CoreTelephony/CTCellularPlanProvisioning.swift b/iOS/CoreTelephony/CTCellularPlanProvisioning.swift index 42c1e72..1400119 100644 --- a/iOS/CoreTelephony/CTCellularPlanProvisioning.swift +++ b/iOS/CoreTelephony/CTCellularPlanProvisioning.swift @@ -5,4 +5,6 @@ class CTCellularPlanProvisioning : NSObject { func supportsCellularPlan() -> Bool @available(iOS 12.0, *) func addPlan(with request: CTCellularPlanProvisioningRequest, completionHandler: @escaping (CTCellularPlanProvisioningAddPlanResult) -> Void) + @available(iOS 12.0, *) + func addPlan(with request: CTCellularPlanProvisioningRequest) async -> CTCellularPlanProvisioningAddPlanResult } diff --git a/iOS/CryptoTokenKit/TKSmartCard.swift b/iOS/CryptoTokenKit/TKSmartCard.swift index 1195782..8ef9e1b 100644 --- a/iOS/CryptoTokenKit/TKSmartCard.swift +++ b/iOS/CryptoTokenKit/TKSmartCard.swift @@ -3,6 +3,7 @@ class TKSmartCardSlotManager : NSObject { class var `default`: TKSmartCardSlotManager? { get } var slotNames: [String] { get } func getSlot(withName name: String, reply: @escaping (TKSmartCardSlot?) -> Void) + func getSlot(withName name: String) async -> TKSmartCardSlot? func slotNamed(_ name: String) -> TKSmartCardSlot? } extension TKSmartCardSlot { @@ -80,6 +81,7 @@ class TKSmartCardUserInteraction : NSObject { var initialTimeout: TimeInterval var interactionTimeout: TimeInterval func run(reply: @escaping (Bool, Error?) -> Void) + func run() async throws -> Bool func cancel() -> Bool } class TKSmartCardUserInteractionForPINOperation : TKSmartCardUserInteraction { @@ -110,7 +112,9 @@ class TKSmartCard : NSObject { var isSensitive: Bool var context: Any? func beginSession(reply: @escaping (Bool, Error?) -> Void) + func beginSession() async throws -> Bool func transmit(_ request: Data, reply: @escaping (Data?, Error?) -> Void) + func transmit(_ request: Data) async throws -> Data func endSession() @available(iOS 9.0, *) func userInteractionForSecurePINVerification(_ PINFormat: TKSmartCardPINFormat, apdu APDU: Data, pinByteOffset PINByteOffset: Int) -> TKSmartCardUserInteractionForSecurePINVerification? @@ -131,6 +135,7 @@ extension TKSmartCard { var useExtendedLength: Bool var useCommandChaining: Bool func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?, reply: @escaping (Data?, UInt16, Error?) -> Void) + func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?) async throws -> (Data, UInt16) func __inSession(executeBlock block: @escaping (NSErrorPointer) -> Bool) throws func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?, sw: UnsafeMutablePointer) throws -> Data } diff --git a/iOS/DeveloperToolsSupport/DeveloperToolsSupport.swift b/iOS/DeveloperToolsSupport/DeveloperToolsSupport.swift index e434a46..83f4ea3 100644 --- a/iOS/DeveloperToolsSupport/DeveloperToolsSupport.swift +++ b/iOS/DeveloperToolsSupport/DeveloperToolsSupport.swift @@ -1,6 +1,6 @@ @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct LibraryContentBuilder { +@resultBuilder struct LibraryContentBuilder { static func buildBlock(_ segments: [LibraryItem]...) -> [LibraryItem] static func buildExpression(_ item: LibraryItem) -> [LibraryItem] static func buildExpression(_ items: [LibraryItem]) -> [LibraryItem] diff --git a/iOS/DeviceCheck/DCAppAttestService.swift b/iOS/DeviceCheck/DCAppAttestService.swift index bdda139..83a7c64 100644 --- a/iOS/DeviceCheck/DCAppAttestService.swift +++ b/iOS/DeviceCheck/DCAppAttestService.swift @@ -4,6 +4,9 @@ class DCAppAttestService : NSObject { class var shared: DCAppAttestService { get } var isSupported: Bool { get } func generateKey(completionHandler: @escaping (String?, Error?) -> Void) + func generateKey() async throws -> String func attestKey(_ keyId: String, clientDataHash: Data, completionHandler: @escaping (Data?, Error?) -> Void) + func attestKey(_ keyId: String, clientDataHash: Data) async throws -> Data func generateAssertion(_ keyId: String, clientDataHash: Data, completionHandler: @escaping (Data?, Error?) -> Void) + func generateAssertion(_ keyId: String, clientDataHash: Data) async throws -> Data } diff --git a/iOS/DeviceCheck/DCDevice.swift b/iOS/DeviceCheck/DCDevice.swift index e6b052a..bf9cc1d 100644 --- a/iOS/DeviceCheck/DCDevice.swift +++ b/iOS/DeviceCheck/DCDevice.swift @@ -4,4 +4,5 @@ class DCDevice : NSObject { class var current: DCDevice { get } var isSupported: Bool { get } func generateToken(completionHandler completion: @escaping (Data?, Error?) -> Void) + func generateToken() async throws -> Data } diff --git a/iOS/EventKit/EKEventStore.swift b/iOS/EventKit/EKEventStore.swift index 647359f..a2e3720 100644 --- a/iOS/EventKit/EKEventStore.swift +++ b/iOS/EventKit/EKEventStore.swift @@ -12,6 +12,8 @@ class EKEventStore : NSObject { class func authorizationStatus(for entityType: EKEntityType) -> EKAuthorizationStatus @available(iOS 6.0, *) func requestAccess(to entityType: EKEntityType, completion: @escaping EKEventStoreRequestAccessCompletionHandler) + @available(iOS 6.0, *) + func requestAccess(to entityType: EKEntityType) async throws -> Bool var eventStoreIdentifier: String { get } @available(iOS 12.0, *) var delegateSources: [EKSource] { get } diff --git a/iOS/ExposureNotification/ENManager.swift b/iOS/ExposureNotification/ENManager.swift index 1ef9847..852e775 100644 --- a/iOS/ExposureNotification/ENManager.swift +++ b/iOS/ExposureNotification/ENManager.swift @@ -27,12 +27,16 @@ class ENManager : NSObject { var exposureNotificationStatus: ENStatus { get } var invalidationHandler: (() -> Void)? func activate(completionHandler: @escaping ENErrorHandler) + func activate() async throws func invalidate() @available(iOS 13.7, *) func getUserTraveled(completionHandler: @escaping ENGetUserTraveledHandler) + @available(iOS 13.7, *) + func userTraveled() async throws -> Bool class var authorizationStatus: ENAuthorizationStatus { get } var exposureNotificationEnabled: Bool { get } func setExposureNotificationEnabled(_ enabled: Bool, completionHandler: @escaping ENErrorHandler) + func setExposureNotificationEnabled(_ enabled: Bool) async throws @available(iOS 13.7, *) func detectExposures(configuration: ENExposureConfiguration, completionHandler: @escaping ENDetectExposuresHandler) -> Progress func detectExposures(configuration: ENExposureConfiguration, diagnosisKeyURLs: [URL], completionHandler: @escaping ENDetectExposuresHandler) -> Progress @@ -41,5 +45,7 @@ class ENManager : NSObject { @available(iOS 13.7, *) func getExposureWindows(summary: ENExposureDetectionSummary, completionHandler: @escaping ENGetExposureWindowsHandler) -> Progress func getDiagnosisKeys(completionHandler: @escaping ENGetDiagnosisKeysHandler) + func diagnosisKeys() async throws -> [ENTemporaryExposureKey] func getTestDiagnosisKeys(completionHandler: @escaping ENGetDiagnosisKeysHandler) + func testDiagnosisKeys() async throws -> [ENTemporaryExposureKey] } diff --git a/iOS/ExternalAccessory/EAAccessoryManager.swift b/iOS/ExternalAccessory/EAAccessoryManager.swift index c9aeb50..be889f2 100644 --- a/iOS/ExternalAccessory/EAAccessoryManager.swift +++ b/iOS/ExternalAccessory/EAAccessoryManager.swift @@ -26,6 +26,8 @@ class EAAccessoryManager : NSObject { class func shared() -> EAAccessoryManager @available(iOS 6, *) func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?, completion: EABluetoothAccessoryPickerCompletion? = nil) + @available(iOS 6, *) + func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?) async throws @available(iOS 3.0, *) func registerForLocalNotifications() @available(iOS 3.0, *) diff --git a/iOS/FileProvider/Extension.swift b/iOS/FileProvider/Extension.swift index 26b3784..e00b955 100644 --- a/iOS/FileProvider/Extension.swift +++ b/iOS/FileProvider/Extension.swift @@ -6,7 +6,9 @@ class NSFileProviderExtension : NSObject { func urlForItem(withPersistentIdentifier identifier: NSFileProviderItemIdentifier) -> URL? func persistentIdentifierForItem(at url: URL) -> NSFileProviderItemIdentifier? func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) + func providePlaceholder(at url: URL) async throws func startProvidingItem(at url: URL, completionHandler: @escaping (Error?) -> Void) + func startProvidingItem(at url: URL) async throws func stopProvidingItem(at url: URL) func itemChanged(at url: URL) } @@ -25,13 +27,19 @@ class NSFileProviderManager : NSObject { class var `default`: NSFileProviderManager { get } convenience init?(for domain: NSFileProviderDomain) func signalEnumerator(for containerItemIdentifier: NSFileProviderItemIdentifier, completionHandler completion: @escaping (Error?) -> Void) + func signalEnumerator(for containerItemIdentifier: NSFileProviderItemIdentifier) async throws func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier, completionHandler completion: @escaping (Error?) -> Void) + func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier) async throws var providerIdentifier: String { get } var documentStorageURL: URL { get } class func writePlaceholder(at placeholderURL: URL, withMetadata metadata: NSFileProviderItem) throws class func placeholderURL(for url: URL) -> URL class func add(_ domain: NSFileProviderDomain, completionHandler: @escaping (Error?) -> Void) + class func add(_ domain: NSFileProviderDomain) async throws class func remove(_ domain: NSFileProviderDomain, completionHandler: @escaping (Error?) -> Void) + class func remove(_ domain: NSFileProviderDomain) async throws class func getDomainsWithCompletionHandler(_ completionHandler: @escaping ([NSFileProviderDomain], Error?) -> Void) + class func domains() async throws -> [NSFileProviderDomain] class func removeAllDomains(completionHandler: @escaping (Error?) -> Void) + class func removeAllDomains() async throws } diff --git a/iOS/FileProvider/NSFileProviderActions.swift b/iOS/FileProvider/NSFileProviderActions.swift index ea852a4..acd031a 100644 --- a/iOS/FileProvider/NSFileProviderActions.swift +++ b/iOS/FileProvider/NSFileProviderActions.swift @@ -3,21 +3,41 @@ extension NSFileProviderExtension { @available(iOS 8.0, *) func importDocument(at fileURL: URL, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func importDocument(at fileURL: URL, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func createDirectory(withName directoryName: String, inParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func createDirectory(withName directoryName: String, inParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func renameItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toName itemName: String, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func renameItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toName itemName: String) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func reparentItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemWithIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, newName: String?, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func reparentItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemWithIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, newName: String?) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func trashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func trashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func untrashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier?, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func untrashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier?) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func deleteItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func deleteItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws + @available(iOS 8.0, *) func setLastUsedDate(_ lastUsedDate: Date?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func setLastUsedDate(_ lastUsedDate: Date?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func setTagData(_ tagData: Data?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) @available(iOS 8.0, *) + func setTagData(_ tagData: Data?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem + @available(iOS 8.0, *) func setFavoriteRank(_ favoriteRank: NSNumber?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + @available(iOS 8.0, *) + func setFavoriteRank(_ favoriteRank: NSNumber?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem } diff --git a/iOS/FileProvider/NSFileProviderEnumerating.swift b/iOS/FileProvider/NSFileProviderEnumerating.swift index b3c1757..eac15f9 100644 --- a/iOS/FileProvider/NSFileProviderEnumerating.swift +++ b/iOS/FileProvider/NSFileProviderEnumerating.swift @@ -33,6 +33,7 @@ protocol NSFileProviderEnumerator : NSObjectProtocol { func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) optional func enumerateChanges(for observer: NSFileProviderChangeObserver, from syncAnchor: NSFileProviderSyncAnchor) optional func currentSyncAnchor(completionHandler: @escaping (NSFileProviderSyncAnchor?) -> Void) + optional func currentSyncAnchor() async -> NSFileProviderSyncAnchor? } extension NSFileProviderExtension { func enumerator(for containerItemIdentifier: NSFileProviderItemIdentifier) throws -> NSFileProviderEnumerator diff --git a/iOS/Foundation/NSBundle.swift b/iOS/Foundation/NSBundle.swift index 40fe7cd..1c892e4 100644 --- a/iOS/Foundation/NSBundle.swift +++ b/iOS/Foundation/NSBundle.swift @@ -99,7 +99,9 @@ class NSBundleResourceRequest : NSObject, ProgressReporting { var tags: Set { get } var bundle: Bundle { get } func beginAccessingResources(completionHandler: @escaping (Error?) -> Void) + func beginAccessingResources() async throws func conditionallyBeginAccessingResources(completionHandler: @escaping (Bool) -> Void) + func conditionallyBeginAccessingResources() async -> Bool func endAccessingResources() } extension Bundle { diff --git a/iOS/Foundation/NSExtensionContext.swift b/iOS/Foundation/NSExtensionContext.swift index 2e85434..4624399 100644 --- a/iOS/Foundation/NSExtensionContext.swift +++ b/iOS/Foundation/NSExtensionContext.swift @@ -3,8 +3,10 @@ class NSExtensionContext : NSObject { var inputItems: [Any] { get } func completeRequest(returningItems items: [Any]?, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(returningItems items: [Any]?) async -> Bool func cancelRequest(withError error: Error) func open(_ URL: URL, completionHandler: ((Bool) -> Void)? = nil) + func open(_ URL: URL) async -> Bool } @available(iOS 8.0, *) let NSExtensionItemsAndErrorsKey: String diff --git a/iOS/Foundation/NSFileManager.swift b/iOS/Foundation/NSFileManager.swift index d82c9fc..d0164ff 100644 --- a/iOS/Foundation/NSFileManager.swift +++ b/iOS/Foundation/NSFileManager.swift @@ -117,6 +117,8 @@ class FileManager : NSObject { @NSCopying var ubiquityIdentityToken: (NSCoding & NSCopying & NSObjectProtocol)? { get } @available(iOS 11.0, *) func getFileProviderServicesForItem(at url: URL, completionHandler: @escaping ([NSFileProviderServiceName : NSFileProviderService]?, Error?) -> Void) + @available(iOS 11.0, *) + func fileProviderServicesForItem(at url: URL) async throws -> [NSFileProviderServiceName : NSFileProviderService] @available(iOS 7.0, *) func containerURL(forSecurityApplicationGroupIdentifier groupIdentifier: String) -> URL? } @@ -212,6 +214,7 @@ extension FileManager { @available(iOS 11.0, *) class NSFileProviderService : NSObject { func getFileProviderConnection(completionHandler: @escaping (NSXPCConnection?, Error?) -> Void) + func fileProviderConnection() async throws -> NSXPCConnection var name: NSFileProviderServiceName { get } } extension FileAttributeKey { diff --git a/iOS/Foundation/NSFilePresenter.swift b/iOS/Foundation/NSFilePresenter.swift index de811af..9d26ab2 100644 --- a/iOS/Foundation/NSFilePresenter.swift +++ b/iOS/Foundation/NSFilePresenter.swift @@ -6,7 +6,9 @@ protocol NSFilePresenter : NSObjectProtocol { optional func relinquishPresentedItem(toReader reader: @escaping ((() -> Void)?) -> Void) optional func relinquishPresentedItem(toWriter writer: @escaping ((() -> Void)?) -> Void) optional func savePresentedItemChanges(completionHandler: @escaping (Error?) -> Void) + optional func savePresentedItemChanges() async throws optional func accommodatePresentedItemDeletion(completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedItemDeletion() async throws optional func presentedItemDidMove(to newURL: URL) optional func presentedItemDidChange() @available(iOS 11.0, *) @@ -20,6 +22,7 @@ protocol NSFilePresenter : NSObjectProtocol { @available(iOS 5.0, *) optional func presentedItemDidResolveConflict(_ version: NSFileVersion) optional func accommodatePresentedSubitemDeletion(at url: URL, completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedSubitemDeletion(at url: URL) async throws optional func presentedSubitemDidAppear(at url: URL) optional func presentedSubitem(at oldURL: URL, didMoveTo newURL: URL) optional func presentedSubitemDidChange(at url: URL) diff --git a/iOS/Foundation/NSFileVersion.swift b/iOS/Foundation/NSFileVersion.swift index df2a724..379bcec 100644 --- a/iOS/Foundation/NSFileVersion.swift +++ b/iOS/Foundation/NSFileVersion.swift @@ -18,6 +18,8 @@ class NSFileVersion : NSObject { class func unresolvedConflictVersionsOfItem(at url: URL) -> [NSFileVersion]? @available(iOS 8.0, *) class func getNonlocalVersionsOfItem(at url: URL, completionHandler: @escaping ([NSFileVersion]?, Error?) -> Void) + @available(iOS 8.0, *) + class func nonlocalVersionsOfItem(at url: URL) async throws -> [NSFileVersion] class func version(itemAt url: URL, forPersistentIdentifier persistentIdentifier: Any) -> NSFileVersion? var url: URL { get } var localizedName: String? { get } diff --git a/iOS/Foundation/NSHTTPCookieStorage.swift b/iOS/Foundation/NSHTTPCookieStorage.swift index 64f575a..7eb7022 100644 --- a/iOS/Foundation/NSHTTPCookieStorage.swift +++ b/iOS/Foundation/NSHTTPCookieStorage.swift @@ -29,6 +29,8 @@ extension HTTPCookieStorage { func storeCookies(_ cookies: [HTTPCookie], for task: URLSessionTask) @available(iOS 8.0, *) func getCookiesFor(_ task: URLSessionTask, completionHandler: @escaping ([HTTPCookie]?) -> Void) + @available(iOS 8.0, *) + func cookies(for task: URLSessionTask) async -> [HTTPCookie]? } extension NSNotification.Name { @available(iOS 2.0, *) diff --git a/iOS/Foundation/NSItemProvider.swift b/iOS/Foundation/NSItemProvider.swift index 6d01366..a4c2572 100644 --- a/iOS/Foundation/NSItemProvider.swift +++ b/iOS/Foundation/NSItemProvider.swift @@ -77,6 +77,7 @@ class NSItemProvider : NSObject, NSCopying { convenience init?(contentsOf fileURL: URL!) func registerItem(forTypeIdentifier typeIdentifier: String, loadHandler: @escaping NSItemProvider.LoadHandler) func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil, completionHandler: NSItemProvider.CompletionHandler? = nil) + func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil) async throws -> NSSecureCoding } @available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) @@ -95,6 +96,8 @@ extension NSItemProvider { var previewImageHandler: NSItemProvider.LoadHandler? @available(iOS 8.0, *) func loadPreviewImage(options: [AnyHashable : Any]! = [:], completionHandler: NSItemProvider.CompletionHandler!) + @available(iOS 8.0, *) + func loadPreviewImage(options: [AnyHashable : Any]! = [:]) async throws -> NSSecureCoding } @available(iOS 8.0, *) let NSExtensionJavaScriptPreprocessingResultsKey: String diff --git a/iOS/Foundation/NSURLCache.swift b/iOS/Foundation/NSURLCache.swift index 2a6a278..75d7ebf 100644 --- a/iOS/Foundation/NSURLCache.swift +++ b/iOS/Foundation/NSURLCache.swift @@ -46,5 +46,7 @@ extension URLCache { @available(iOS 8.0, *) func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -> Void) @available(iOS 8.0, *) + func cachedResponse(for dataTask: URLSessionDataTask) async -> CachedURLResponse? + @available(iOS 8.0, *) func removeCachedResponse(for dataTask: URLSessionDataTask) } diff --git a/iOS/Foundation/NSURLConnection.swift b/iOS/Foundation/NSURLConnection.swift index bcc0a2b..626841a 100644 --- a/iOS/Foundation/NSURLConnection.swift +++ b/iOS/Foundation/NSURLConnection.swift @@ -55,4 +55,6 @@ extension NSURLConnection { extension NSURLConnection { @available(iOS, introduced: 5.0, deprecated: 9.0, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue, completionHandler handler: @escaping (URLResponse?, Data?, Error?) -> Void) + @available(iOS, introduced: 5.0, deprecated: 9.0, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") + class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue) async throws -> (URLResponse, Data) } diff --git a/iOS/Foundation/NSURLCredentialStorage.swift b/iOS/Foundation/NSURLCredentialStorage.swift index 7f8ca50..be7d85e 100644 --- a/iOS/Foundation/NSURLCredentialStorage.swift +++ b/iOS/Foundation/NSURLCredentialStorage.swift @@ -15,12 +15,16 @@ extension URLCredentialStorage { @available(iOS 8.0, *) func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping ([String : URLCredential]?) -> Void) @available(iOS 8.0, *) + func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask) async -> [String : URLCredential]? + @available(iOS 8.0, *) func set(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) @available(iOS 8.0, *) func remove(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, options: [String : Any]? = nil, task: URLSessionTask) @available(iOS 8.0, *) func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping (URLCredential?) -> Void) @available(iOS 8.0, *) + func defaultCredential(for space: URLProtectionSpace, task: URLSessionTask) async -> URLCredential? + @available(iOS 8.0, *) func setDefaultCredential(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) } extension NSNotification.Name { diff --git a/iOS/Foundation/NSURLSession.swift b/iOS/Foundation/NSURLSession.swift index 0c79a13..b71dfd5 100644 --- a/iOS/Foundation/NSURLSession.swift +++ b/iOS/Foundation/NSURLSession.swift @@ -13,10 +13,15 @@ class URLSession : NSObject { func finishTasksAndInvalidate() func invalidateAndCancel() func reset(completionHandler: @escaping () -> Void) + func reset() async func flush(completionHandler: @escaping () -> Void) + func flush() async func getTasksWithCompletionHandler(_ completionHandler: @escaping ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) -> Void) + func tasks() async -> ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) @available(iOS 9.0, *) func getAllTasks(completionHandler: @escaping ([URLSessionTask]) -> Void) + @available(iOS 9.0, *) + func allTasks() async -> [URLSessionTask] func dataTask(with request: URLRequest) -> URLSessionDataTask func dataTask(with url: URL) -> URLSessionDataTask func uploadTask(with request: URLRequest, fromFile fileURL: URL) -> URLSessionUploadTask @@ -119,11 +124,14 @@ class URLSessionUploadTask : URLSessionDataTask { @available(iOS 7.0, *) class URLSessionDownloadTask : URLSessionTask { func cancel(byProducingResumeData completionHandler: @escaping (Data?) -> Void) + func cancelByProducingResumeData() async -> Data? } @available(iOS 9.0, *) class URLSessionStreamTask : URLSessionTask { func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) + func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval) async throws -> (Data, Bool) func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) + func write(_ data: Data, timeout: TimeInterval) async throws func captureStreams() func closeWrite() func closeRead() @@ -169,7 +177,9 @@ extension URLSessionWebSocketTask { @available(iOS 13.0, *) class URLSessionWebSocketTask : URLSessionTask { func __send(_ message: __NSURLSessionWebSocketMessage, completionHandler: @escaping (Error?) -> Void) + func __send(_ message: __NSURLSessionWebSocketMessage) async throws func __receiveMessage(completionHandler: @escaping (__NSURLSessionWebSocketMessage?, Error?) -> Void) + func __receiveMessage() async throws -> __NSURLSessionWebSocketMessage func sendPing(pongReceiveHandler: @escaping (Error?) -> Void) func cancel(with closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) var maximumMessageSize: Int @@ -277,6 +287,7 @@ extension URLSession { protocol URLSessionDelegate : NSObjectProtocol { optional func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(iOS 7.0, *) optional func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) } @@ -285,10 +296,15 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(iOS 11.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest, completionHandler: @escaping (URLSession.DelayedRequestDisposition, URLRequest?) -> Void) @available(iOS 11.0, *) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest) async -> (URLSession.DelayedRequestDisposition, URLRequest?) + @available(iOS 11.0, *) optional func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> URLRequest? optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) optional func urlSession(_ session: URLSession, task: URLSessionTask, needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask) async -> InputStream? optional func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) @available(iOS 10.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) @@ -297,11 +313,13 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(iOS 7.0, *) protocol URLSessionDataDelegate : URLSessionTaskDelegate { optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse) async -> URLSession.ResponseDisposition optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome downloadTask: URLSessionDownloadTask) @available(iOS 9.0, *) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome streamTask: URLSessionStreamTask) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse, completionHandler: @escaping (CachedURLResponse?) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) async -> CachedURLResponse? } @available(iOS 7.0, *) protocol URLSessionDownloadDelegate : URLSessionTaskDelegate { diff --git a/iOS/Foundation/NSUserActivity.swift b/iOS/Foundation/NSUserActivity.swift index d9e18ec..7a9de26 100644 --- a/iOS/Foundation/NSUserActivity.swift +++ b/iOS/Foundation/NSUserActivity.swift @@ -26,6 +26,7 @@ class NSUserActivity : NSObject { func resignCurrent() func invalidate() func getContinuationStreams(completionHandler: @escaping (InputStream?, OutputStream?, Error?) -> Void) + func continuationStreams() async throws -> (InputStream, OutputStream) @available(iOS 9.0, *) var isEligibleForHandoff: Bool @available(iOS 9.0, *) @@ -39,7 +40,11 @@ class NSUserActivity : NSObject { @available(iOS 12.0, *) class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier], completionHandler handler: @escaping () -> Void) @available(iOS 12.0, *) + class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier]) async + @available(iOS 12.0, *) class func deleteAllSavedUserActivities(completionHandler handler: @escaping () -> Void) + @available(iOS 12.0, *) + class func deleteAllSavedUserActivities() async } let NSUserActivityTypeBrowsingWeb: String @available(iOS 8.0, *) diff --git a/iOS/GLKit/GLKTextureLoader.swift b/iOS/GLKit/GLKTextureLoader.swift index 533c0f3..25c0346 100644 --- a/iOS/GLKit/GLKTextureLoader.swift +++ b/iOS/GLKit/GLKTextureLoader.swift @@ -82,11 +82,19 @@ class GLKTextureLoader : NSObject { class func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil) throws -> GLKTextureInfo init(sharegroup: EAGLSharegroup) func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo } diff --git a/iOS/GameController/GCController.swift b/iOS/GameController/GCController.swift index 0e4007a..330bc2a 100644 --- a/iOS/GameController/GCController.swift +++ b/iOS/GameController/GCController.swift @@ -44,6 +44,7 @@ class GCController : NSObject, GCDevice { func capture() -> GCController class func controllers() -> [GCController] class func startWirelessControllerDiscovery(completionHandler: (() -> Void)? = nil) + class func startWirelessControllerDiscovery() async class func stopWirelessControllerDiscovery() @available(iOS 13.0, *) class func withMicroGamepad() -> GCController diff --git a/iOS/GameKit/GKAchievement.swift b/iOS/GameKit/GKAchievement.swift index 64364a8..2f43c52 100644 --- a/iOS/GameKit/GKAchievement.swift +++ b/iOS/GameKit/GKAchievement.swift @@ -2,12 +2,16 @@ @available(iOS 4.1, *) class GKAchievement : NSObject, NSCoding, NSSecureCoding { class func loadAchievements(completionHandler: (([GKAchievement]?, Error?) -> Void)? = nil) + class func loadAchievements() async throws -> [GKAchievement] class func resetAchievements(completionHandler: ((Error?) -> Void)? = nil) + class func resetAchievements() async throws init(identifier: String) @available(iOS 8.0, *) init(identifier: String, player: GKPlayer) @available(iOS 6.0, *) class func report(_ achievements: [GKAchievement], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 6.0, *) + class func report(_ achievements: [GKAchievement]) async throws var identifier: String var percentComplete: Double var isCompleted: Bool { get } diff --git a/iOS/GameKit/GKAchievementDescription.swift b/iOS/GameKit/GKAchievementDescription.swift index 91b02c7..fe8c020 100644 --- a/iOS/GameKit/GKAchievementDescription.swift +++ b/iOS/GameKit/GKAchievementDescription.swift @@ -2,6 +2,7 @@ @available(iOS 4.1, *) class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { class func loadAchievementDescriptions(completionHandler: (([GKAchievementDescription]?, Error?) -> Void)? = nil) + class func loadAchievementDescriptions() async throws -> [GKAchievementDescription] var identifier: String { get } @available(iOS 6.0, *) var groupIdentifier: String? { get } @@ -15,6 +16,7 @@ class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { } extension GKAchievementDescription { func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil) + func loadImage() async throws -> UIImage class func incompleteAchievementImage() -> UIImage class func placeholderCompletedAchievementImage() -> UIImage } diff --git a/iOS/GameKit/GKChallenge.swift b/iOS/GameKit/GKChallenge.swift index a41186d..473dfb9 100644 --- a/iOS/GameKit/GKChallenge.swift +++ b/iOS/GameKit/GKChallenge.swift @@ -10,6 +10,7 @@ enum GKChallengeState : Int { @available(iOS 6.0, *) class GKChallenge : NSObject, NSCoding, NSSecureCoding { class func loadReceivedChallenges(completionHandler: (([GKChallenge]?, Error?) -> Void)? = nil) + class func loadReceivedChallenges() async throws -> [GKChallenge] func decline() @available(iOS 8.0, *) @NSCopying var issuingPlayer: GKPlayer? { get } @@ -37,20 +38,30 @@ class GKAchievementChallenge : GKChallenge { extension GKScore { @available(iOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(iOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") + class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge]) async throws @available(iOS 14.0, *) class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 14.0, *) + class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKAchievement { @available(iOS 8.0, *) func selectChallengeablePlayers(_ players: [GKPlayer], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(iOS 8.0, *) + func selectChallengeablePlayers(_ players: [GKPlayer]) async throws -> [GKPlayer] @available(iOS 7.0, *) class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 7.0, *) + class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKScore { } extension GKAchievement { @available(iOS, introduced: 6.0, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, pass GKPlayers to selectChallengeablePlayers:") func selectChallengeablePlayerIDs(_ playerIDs: [String]?, withCompletionHandler completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 6.0, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, pass GKPlayers to selectChallengeablePlayers:") + func selectChallengeablePlayerIDs(_ playerIDs: [String]?) async throws -> [String] } typealias GKChallengeComposeCompletionBlock = (UIViewController, Bool, [String]?) -> Void extension GKScore { diff --git a/iOS/GameKit/GKCloudPlayer.swift b/iOS/GameKit/GKCloudPlayer.swift index f4a273c..70eb880 100644 --- a/iOS/GameKit/GKCloudPlayer.swift +++ b/iOS/GameKit/GKCloudPlayer.swift @@ -2,4 +2,5 @@ @available(iOS, introduced: 10.0, deprecated: 12.0, message: "GKGameSession is deprecated. Use GKPlayer for both real-time and turn-based matchmaking APIs.") class GKCloudPlayer : GKBasePlayer { class func getCurrentSignedInPlayer(forContainer containerName: String?, completionHandler handler: @escaping (GKCloudPlayer?, Error?) -> Void) + class func currentSignedInPlayer(forContainer containerName: String?) async throws -> GKCloudPlayer } diff --git a/iOS/GameKit/GKGameSession.swift b/iOS/GameKit/GKGameSession.swift index ae762a1..9a8b85d 100644 --- a/iOS/GameKit/GKGameSession.swift +++ b/iOS/GameKit/GKGameSession.swift @@ -22,15 +22,26 @@ class GKGameSession : NSObject { var maxNumberOfConnectedPlayers: Int { get } var badgedPlayers: [GKCloudPlayer] { get } class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int) async throws -> GKGameSession class func loadSessions(inContainer containerName: String?, completionHandler: @escaping ([GKGameSession]?, Error?) -> Void) + class func loadSessions(inContainer containerName: String?) async throws -> [GKGameSession] class func load(withIdentifier identifier: String, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func load(withIdentifier identifier: String) async throws -> GKGameSession class func remove(withIdentifier identifier: String, completionHandler: @escaping (Error?) -> Void) + class func remove(withIdentifier identifier: String) async throws func getShareURL(completionHandler: @escaping (URL?, Error?) -> Void) + func shareURL() async throws -> URL func loadData(completionHandler: @escaping (Data?, Error?) -> Void) + func loadData() async throws -> Data func save(_ data: Data, completionHandler: @escaping (Data?, Error?) -> Void) + func save(_ data: Data) async throws -> Data func setConnectionState(_ state: GKConnectionState, completionHandler: @escaping (Error?) -> Void) + func setConnectionState(_ state: GKConnectionState) async throws func players(with state: GKConnectionState) -> [GKCloudPlayer] func send(_ data: Data, with transport: GKTransportType, completionHandler: @escaping (Error?) -> Void) + func send(_ data: Data, with transport: GKTransportType) async throws func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool, completionHandler: @escaping (Error?) -> Void) + func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool) async throws func clearBadge(for players: [GKCloudPlayer], completionHandler: @escaping (Error?) -> Void) + func clearBadge(for players: [GKCloudPlayer]) async throws } diff --git a/iOS/GameKit/GKLeaderboard.swift b/iOS/GameKit/GKLeaderboard.swift index 7797c78..2a5d7df 100644 --- a/iOS/GameKit/GKLeaderboard.swift +++ b/iOS/GameKit/GKLeaderboard.swift @@ -39,15 +39,27 @@ class GKLeaderboard : NSObject { @available(iOS 14.0, *) class func loadLeaderboards(IDs leaderboardIDs: [String]?, completionHandler: @escaping ([GKLeaderboard]?, Error?) -> Void) @available(iOS 14.0, *) + class func loadLeaderboards(IDs leaderboardIDs: [String]?) async throws -> [GKLeaderboard] + @available(iOS 14.0, *) func loadPreviousOccurrence(completionHandler: @escaping (GKLeaderboard?, Error?) -> Void) @available(iOS 14.0, *) + func loadPreviousOccurrence() async throws -> GKLeaderboard + @available(iOS 14.0, *) class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String], completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String]) async throws + @available(iOS 14.0, *) func submitScore(_ score: Int, context: Int, player: GKPlayer, completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func submitScore(_ score: Int, context: Int, player: GKPlayer) async throws + @available(iOS 14.0, *) func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Int, Error?) -> Void) @available(iOS 14.0, *) + func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry], Int) + @available(iOS 14.0, *) func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Error?) -> Void) + @available(iOS 14.0, *) + func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry]) } extension GKLeaderboard { @available(iOS, introduced: 4.1, deprecated: 8.0, message: "Use initWithPlayers: instead") @@ -72,10 +84,16 @@ extension GKLeaderboard { init(players: [GKPlayer]) @available(iOS, introduced: 4.0, deprecated: 14.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") func loadScores(completionHandler: (([GKScore]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 4.0, deprecated: 14.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") + func loadScores() async throws -> [GKScore] @available(iOS, introduced: 6.0, deprecated: 14.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") class func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 6.0, deprecated: 14.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") + class func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboard { @available(iOS 7.0, *) func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil) + @available(iOS 7.0, *) + func loadImage() async throws -> UIImage } diff --git a/iOS/GameKit/GKLeaderboardSet.swift b/iOS/GameKit/GKLeaderboardSet.swift index 97b3ed7..7611939 100644 --- a/iOS/GameKit/GKLeaderboardSet.swift +++ b/iOS/GameKit/GKLeaderboardSet.swift @@ -6,13 +6,18 @@ class GKLeaderboardSet : NSObject, NSCoding, NSSecureCoding { var identifier: String? @available(iOS 7.0, *) class func loadLeaderboardSets(completionHandler: (([GKLeaderboardSet]?, Error?) -> Void)? = nil) + @available(iOS 7.0, *) + class func loadLeaderboardSets() async throws -> [GKLeaderboardSet] @available(iOS 14.0, *) func loadLeaderboards(handler: @escaping ([GKLeaderboard]?, Error?) -> Void) } extension GKLeaderboardSet { @available(iOS, introduced: 7.0, deprecated: 14.0, message: "Use loadLeaderboardsWithHandler: instead.") func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 7.0, deprecated: 14.0, message: "Use loadLeaderboardsWithHandler: instead.") + func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboardSet { func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil) + func loadImage() async throws -> UIImage } diff --git a/iOS/GameKit/GKLocalPlayer.swift b/iOS/GameKit/GKLocalPlayer.swift index 22ceeaf..2b48189 100644 --- a/iOS/GameKit/GKLocalPlayer.swift +++ b/iOS/GameKit/GKLocalPlayer.swift @@ -12,13 +12,22 @@ class GKLocalPlayer : GKPlayer { var isPersonalizedCommunicationRestricted: Bool { get } @available(iOS 10.0, *) func loadRecentPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(iOS 10.0, *) + func loadRecentPlayers() async throws -> [GKPlayer] func loadChallengableFriends(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + func loadChallengableFriends() async throws -> [GKPlayer] @available(iOS 7.0, *) func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 7.0, *) + func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String) async throws + @available(iOS 7.0, *) func loadDefaultLeaderboardIdentifier(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(iOS 7.0, *) + func loadDefaultLeaderboardIdentifier() async throws -> String @available(iOS 13.5, *) func fetchItems(forIdentityVerificationSignature completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(iOS 13.5, *) + func fetchItemsForIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } protocol GKLocalPlayerListener : GKChallengeListener, GKInviteEventListener, GKSavedGameListener, GKTurnBasedEventListener { } @@ -37,12 +46,18 @@ extension NSNotification.Name { extension GKLocalPlayer { @available(iOS, introduced: 8.0, deprecated: 10.0) func loadFriendPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 8.0, deprecated: 10.0) + func loadFriendPlayers() async throws -> [GKPlayer] @available(iOS, introduced: 7.0, deprecated: 13.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") func generateIdentityVerificationSignature(completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(iOS, introduced: 7.0, deprecated: 13.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") + func generateIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } extension GKLocalPlayer { @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") func loadFriends(completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") + func loadFriends() async throws -> [String] @available(iOS, introduced: 4.1, deprecated: 8.0, message: " This property is obsolete, Use loadFriendPlayersWithCompletionHandler: instead") var friends: [String]? { get } } diff --git a/iOS/GameKit/GKMatch.swift b/iOS/GameKit/GKMatch.swift index 201dd91..e1d3312 100644 --- a/iOS/GameKit/GKMatch.swift +++ b/iOS/GameKit/GKMatch.swift @@ -27,8 +27,12 @@ class GKMatch : NSObject { func voiceChat(withName name: String) -> GKVoiceChat? @available(iOS 8.0, *) func chooseBestHostingPlayer(completionHandler: @escaping (GKPlayer?) -> Void) + @available(iOS 8.0, *) + func chooseBestHostingPlayer() async -> GKPlayer? @available(iOS 6.0, *) func rematch(completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func rematch() async throws -> GKMatch } protocol GKMatchDelegate : NSObjectProtocol { @available(iOS 8.0, *) @@ -51,6 +55,8 @@ protocol GKMatchDelegate : NSObjectProtocol { extension GKMatch { @available(iOS, introduced: 6.0, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") func chooseBestHostPlayer(completionHandler: @escaping (String?) -> Void) + @available(iOS, introduced: 6.0, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") + func chooseBestHostPlayer() async -> String? @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use sendData:toPlayers:dataMode:error:") func send(_ data: Data, toPlayers playerIDs: [String], with mode: GKMatch.SendDataMode) throws @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use players instead.") diff --git a/iOS/GameKit/GKMatchmaker.swift b/iOS/GameKit/GKMatchmaker.swift index 4299ea0..c0c4e35 100644 --- a/iOS/GameKit/GKMatchmaker.swift +++ b/iOS/GameKit/GKMatchmaker.swift @@ -71,17 +71,25 @@ class GKMatchmaker : NSObject { class func shared() -> GKMatchmaker @available(iOS 6.0, *) func match(for invite: GKInvite, completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func match(for invite: GKInvite) async throws -> GKMatch func findMatch(for request: GKMatchRequest, withCompletionHandler completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + func findMatch(for request: GKMatchRequest) async throws -> GKMatch @available(iOS 8.0, *) func findPlayers(forHostedRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(iOS 8.0, *) + func findPlayers(forHostedRequest request: GKMatchRequest) async throws -> [GKPlayer] func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest, completionHandler: ((Error?) -> Void)? = nil) + func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest) async throws func cancel() @available(iOS 8.0, *) func cancelPendingInvite(to player: GKPlayer) @available(iOS 6.0, *) func finishMatchmaking(for match: GKMatch) func queryPlayerGroupActivity(_ playerGroup: Int, withCompletionHandler completionHandler: ((Int, Error?) -> Void)? = nil) + func queryPlayerGroupActivity(_ playerGroup: Int) async throws -> Int func queryActivity(completionHandler: ((Int, Error?) -> Void)? = nil) + func queryActivity() async throws -> Int @available(iOS 8.0, *) func startBrowsingForNearbyPlayers(handler reachableHandler: ((GKPlayer, Bool) -> Void)? = nil) @available(iOS 6.0, *) @@ -96,4 +104,6 @@ extension GKMatchmaker { func cancelInvite(toPlayer playerID: String) @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") func findPlayers(forHostedMatchRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(iOS, introduced: 4.1, deprecated: 8.0, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") + func findPlayers(forHostedMatchRequest request: GKMatchRequest) async throws -> [String] } diff --git a/iOS/GameKit/GKNotificationBanner.swift b/iOS/GameKit/GKNotificationBanner.swift index 7bfc6ea..031db5e 100644 --- a/iOS/GameKit/GKNotificationBanner.swift +++ b/iOS/GameKit/GKNotificationBanner.swift @@ -3,6 +3,10 @@ class GKNotificationBanner : NSObject { @available(iOS 5.0, *) class func show(withTitle title: String?, message: String?, completionHandler: (() -> Void)? = nil) + @available(iOS 5.0, *) + class func show(withTitle title: String?, message: String?) async @available(iOS 6.0, *) class func show(withTitle title: String?, message: String?, duration: TimeInterval, completionHandler: (() -> Void)? = nil) + @available(iOS 6.0, *) + class func show(withTitle title: String?, message: String?, duration: TimeInterval) async } diff --git a/iOS/GameKit/GKPlayer.swift b/iOS/GameKit/GKPlayer.swift index 25b741f..1cead7f 100644 --- a/iOS/GameKit/GKPlayer.swift +++ b/iOS/GameKit/GKPlayer.swift @@ -4,6 +4,7 @@ let GKPlayerIDNoLongerAvailable: String @available(iOS 4.1, *) class GKPlayer : GKBasePlayer { class func loadPlayers(forIdentifiers identifiers: [String], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + class func loadPlayers(forIdentifiers identifiers: [String]) async throws -> [GKPlayer] @available(iOS 13.0, *) func scopedIDsArePersistent() -> Bool @available(iOS 12.4, *) @@ -21,6 +22,8 @@ class GKPlayer : GKBasePlayer { extension GKPlayer { @available(iOS 5.0, *) func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: ((UIImage?, Error?) -> Void)? = nil) + @available(iOS 5.0, *) + func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> UIImage } extension GKPlayer { enum PhotoSize : Int { diff --git a/iOS/GameKit/GKSavedGame.swift b/iOS/GameKit/GKSavedGame.swift index d9b3963..9601795 100644 --- a/iOS/GameKit/GKSavedGame.swift +++ b/iOS/GameKit/GKSavedGame.swift @@ -9,14 +9,24 @@ class GKSavedGame : NSObject, NSCopying { var modificationDate: Date? { get } @available(iOS 8.0, *) func loadData(completionHandler handler: ((Data?, Error?) -> Void)? = nil) + @available(iOS 8.0, *) + func loadData() async throws -> Data } extension GKLocalPlayer : GKSavedGameListener { @available(iOS 8.0, *) func fetchSavedGames(completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil) @available(iOS 8.0, *) + func fetchSavedGames() async throws -> [GKSavedGame] + @available(iOS 8.0, *) func saveGameData(_ data: Data, withName name: String, completionHandler handler: ((GKSavedGame?, Error?) -> Void)? = nil) @available(iOS 8.0, *) + func saveGameData(_ data: Data, withName name: String) async throws -> GKSavedGame + @available(iOS 8.0, *) func deleteSavedGames(withName name: String, completionHandler handler: ((Error?) -> Void)? = nil) @available(iOS 8.0, *) + func deleteSavedGames(withName name: String) async throws + @available(iOS 8.0, *) func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data, completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil) + @available(iOS 8.0, *) + func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data) async throws -> [GKSavedGame] } diff --git a/iOS/GameKit/GKScore.swift b/iOS/GameKit/GKScore.swift index e33c3e2..ce7464f 100644 --- a/iOS/GameKit/GKScore.swift +++ b/iOS/GameKit/GKScore.swift @@ -18,6 +18,8 @@ class GKScore : NSObject, NSCoding, NSSecureCoding { var shouldSetDefaultLeaderboard: Bool @available(iOS 6.0, *) class func report(_ scores: [GKScore], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 6.0, *) + class func report(_ scores: [GKScore]) async throws } extension GKScore { } diff --git a/iOS/GameKit/GKTurnBasedMatch.swift b/iOS/GameKit/GKTurnBasedMatch.swift index aa52af9..c5d36bb 100644 --- a/iOS/GameKit/GKTurnBasedMatch.swift +++ b/iOS/GameKit/GKTurnBasedMatch.swift @@ -96,35 +96,65 @@ class GKTurnBasedMatch : NSObject { @available(iOS 7.0, *) var exchangeMaxInitiatedExchangesPerPlayer: Int { get } class func find(for request: GKMatchRequest, withCompletionHandler completionHandler: @escaping (GKTurnBasedMatch?, Error?) -> Void) + class func find(for request: GKMatchRequest) async throws -> GKTurnBasedMatch class func loadMatches(completionHandler: (([GKTurnBasedMatch]?, Error?) -> Void)? = nil) + class func loadMatches() async throws -> [GKTurnBasedMatch] @available(iOS 5.0, *) class func load(withID matchID: String, withCompletionHandler completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(iOS 5.0, *) + class func load(withID matchID: String) async throws -> GKTurnBasedMatch @available(iOS 6.0, *) func rematch(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func rematch() async throws -> GKTurnBasedMatch @available(iOS 5.0, *) func acceptInvite(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(iOS 5.0, *) + func acceptInvite() async throws -> GKTurnBasedMatch + @available(iOS 5.0, *) func declineInvite(completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 5.0, *) + func declineInvite() async throws func remove(completionHandler: ((Error?) -> Void)? = nil) + func remove() async throws func loadMatchData(completionHandler: ((Data?, Error?) -> Void)? = nil) + func loadMatchData() async throws -> Data @available(iOS 6.0, *) func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 6.0, *) + func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws + @available(iOS 6.0, *) func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome) async throws func endMatchInTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + func endMatchInTurn(withMatch matchData: Data) async throws @available(iOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") + func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?) async throws @available(iOS 14.0, *) func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any], completionHandler: @escaping (Error?) -> Void) + @available(iOS 14.0, *) + func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any]) async throws @available(iOS 6.0, *) func saveCurrentTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func saveCurrentTurn(withMatch matchData: Data) async throws @available(iOS 7.0, *) func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: ((Error?) -> Void)? = nil) @available(iOS 7.0, *) + func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throws + @available(iOS 7.0, *) func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval, completionHandler: ((GKTurnBasedExchange?, Error?) -> Void)? = nil) @available(iOS 7.0, *) + func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval) async throws -> GKTurnBasedExchange + @available(iOS 7.0, *) func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 7.0, *) + func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String]) async throws } @available(iOS 7.0, *) enum GKTurnBasedExchangeStatus : Int8 { @@ -155,7 +185,11 @@ class GKTurnBasedExchange : NSObject { @available(iOS 7.0, *) func cancel(withLocalizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) @available(iOS 7.0, *) + func cancel(withLocalizableMessageKey key: String, arguments: [String]) async throws + @available(iOS 7.0, *) func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 7.0, *) + func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data) async throws } @available(iOS 7.0, *) class GKTurnBasedExchangeReply : NSObject { diff --git a/iOS/HealthKit/HKHealthStore.swift b/iOS/HealthKit/HKHealthStore.swift index ed95ae0..6128820 100644 --- a/iOS/HealthKit/HKHealthStore.swift +++ b/iOS/HealthKit/HKHealthStore.swift @@ -6,19 +6,31 @@ class HKHealthStore : NSObject { func supportsHealthRecords() -> Bool func authorizationStatus(for type: HKObjectType) -> HKAuthorizationStatus func requestAuthorization(toShare typesToShare: Set?, read typesToRead: Set?, completion: @escaping (Bool, Error?) -> Void) + func requestAuthorization(toShare typesToShare: Set?, read typesToRead: Set?) async throws -> Bool @available(iOS 12.0, *) func getRequestStatusForAuthorization(toShare typesToShare: Set, read typesToRead: Set, completion: @escaping (HKAuthorizationRequestStatus, Error?) -> Void) + @available(iOS 12.0, *) + func requestStatusForAuthorization(toShare typesToShare: Set, read typesToRead: Set) async throws -> HKAuthorizationRequestStatus @available(iOS 9.0, *) func handleAuthorizationForExtension(completion: @escaping (Bool, Error?) -> Void) @available(iOS 9.0, *) + func handleAuthorizationForExtension() async throws -> Bool + @available(iOS 9.0, *) func earliestPermittedSampleDate() -> Date func save(_ object: HKObject, withCompletion completion: @escaping (Bool, Error?) -> Void) + func save(_ object: HKObject) async throws -> Bool func save(_ objects: [HKObject], withCompletion completion: @escaping (Bool, Error?) -> Void) + func save(_ objects: [HKObject]) async throws -> Bool func delete(_ object: HKObject, withCompletion completion: @escaping (Bool, Error?) -> Void) + func delete(_ object: HKObject) async throws -> Bool @available(iOS 9.0, *) func delete(_ objects: [HKObject], withCompletion completion: @escaping (Bool, Error?) -> Void) @available(iOS 9.0, *) + func delete(_ objects: [HKObject]) async throws -> Bool + @available(iOS 9.0, *) func deleteObjects(of objectType: HKObjectType, predicate: NSPredicate, withCompletion completion: @escaping (Bool, Int, Error?) -> Void) + @available(iOS 9.0, *) + func deleteObjects(of objectType: HKObjectType, predicate: NSPredicate) async throws -> (Bool, Int) func execute(_ query: HKQuery) func stop(_ query: HKQuery) @available(iOS, introduced: 9.0, deprecated: 11.0, message: "No longer supported") @@ -38,13 +50,19 @@ class HKHealthStore : NSObject { } extension HKHealthStore { func add(_ samples: [HKSample], to workout: HKWorkout, completion: @escaping (Bool, Error?) -> Void) + func add(_ samples: [HKSample], to workout: HKWorkout) async throws -> Bool @available(iOS 10.0, *) func startWatchApp(with workoutConfiguration: HKWorkoutConfiguration, completion: @escaping (Bool, Error?) -> Void) + @available(iOS 10.0, *) + func startWatchApp(with workoutConfiguration: HKWorkoutConfiguration) async throws -> Bool } extension HKHealthStore { func enableBackgroundDelivery(for type: HKObjectType, frequency: HKUpdateFrequency, withCompletion completion: @escaping (Bool, Error?) -> Void) + func enableBackgroundDelivery(for type: HKObjectType, frequency: HKUpdateFrequency) async throws -> Bool func disableBackgroundDelivery(for type: HKObjectType, withCompletion completion: @escaping (Bool, Error?) -> Void) + func disableBackgroundDelivery(for type: HKObjectType) async throws -> Bool func disableAllBackgroundDelivery(completion: @escaping (Bool, Error?) -> Void) + func disableAllBackgroundDelivery() async throws -> Bool } extension NSNotification.Name { @available(iOS 8.2, *) @@ -53,4 +71,6 @@ extension NSNotification.Name { extension HKHealthStore { @available(iOS 8.2, *) func preferredUnits(for quantityTypes: Set, completion: @escaping ([HKQuantityType : HKUnit], Error?) -> Void) + @available(iOS 8.2, *) + func preferredUnits(for quantityTypes: Set) async throws -> [HKQuantityType : HKUnit] } diff --git a/iOS/HealthKit/HKHeartbeatSeriesBuilder.swift b/iOS/HealthKit/HKHeartbeatSeriesBuilder.swift index f98445b..673cd2b 100644 --- a/iOS/HealthKit/HKHeartbeatSeriesBuilder.swift +++ b/iOS/HealthKit/HKHeartbeatSeriesBuilder.swift @@ -4,6 +4,9 @@ class HKHeartbeatSeriesBuilder : HKSeriesBuilder { class var maximumCount: Int { get } init(healthStore: HKHealthStore, device: HKDevice?, start startDate: Date) func addHeartbeatWithTimeInterval(sinceSeriesStartDate timeInterval: TimeInterval, precededByGap: Bool, completion: @escaping (Bool, Error?) -> Void) + func addHeartbeatWithTimeInterval(sinceSeriesStartDate timeInterval: TimeInterval, precededByGap: Bool) async throws -> Bool func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func finishSeries(completion: @escaping (HKHeartbeatSeriesSample?, Error?) -> Void) + func finishSeries() async throws -> HKHeartbeatSeriesSample } diff --git a/iOS/HealthKit/HKQuantitySeriesSampleBuilder.swift b/iOS/HealthKit/HKQuantitySeriesSampleBuilder.swift index dcdbd6d..77598f0 100644 --- a/iOS/HealthKit/HKQuantitySeriesSampleBuilder.swift +++ b/iOS/HealthKit/HKQuantitySeriesSampleBuilder.swift @@ -9,6 +9,8 @@ class HKQuantitySeriesSampleBuilder : NSObject { func insert(_ quantity: HKQuantity, for dateInterval: DateInterval) throws func insert(_ quantity: HKQuantity, at date: Date) throws func finishSeries(metadata: [String : Any]?, endDate: Date?, completion: @escaping ([HKQuantitySample]?, Error?) -> Void) + func finishSeries(metadata: [String : Any]?, endDate: Date?) async throws -> [HKQuantitySample] func finishSeries(metadata: [String : Any]?, completion: @escaping ([HKQuantitySample]?, Error?) -> Void) + func finishSeries(metadata: [String : Any]?) async throws -> [HKQuantitySample] func discard() } diff --git a/iOS/HealthKit/HKWorkoutBuilder.swift b/iOS/HealthKit/HKWorkoutBuilder.swift index 012e783..6bdedcf 100644 --- a/iOS/HealthKit/HKWorkoutBuilder.swift +++ b/iOS/HealthKit/HKWorkoutBuilder.swift @@ -9,11 +9,17 @@ class HKWorkoutBuilder : NSObject { var workoutEvents: [HKWorkoutEvent] { get } init(healthStore: HKHealthStore, configuration: HKWorkoutConfiguration, device: HKDevice?) func beginCollection(withStart startDate: Date, completion: @escaping (Bool, Error?) -> Void) + func beginCollection(withStart startDate: Date) async throws -> Bool func add(_ samples: [HKSample], completion: @escaping (Bool, Error?) -> Void) + func add(_ samples: [HKSample]) async throws -> Bool func addWorkoutEvents(_ workoutEvents: [HKWorkoutEvent], completion: @escaping (Bool, Error?) -> Void) + func addWorkoutEvents(_ workoutEvents: [HKWorkoutEvent]) async throws -> Bool func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func endCollection(withEnd endDate: Date, completion: @escaping (Bool, Error?) -> Void) + func endCollection(withEnd endDate: Date) async throws -> Bool func finishWorkout(completion: @escaping (HKWorkout?, Error?) -> Void) + func finishWorkout() async throws -> HKWorkout func discardWorkout() func elapsedTime(at date: Date) -> TimeInterval func statistics(for quantityType: HKQuantityType) -> HKStatistics? diff --git a/iOS/HealthKit/HKWorkoutRouteBuilder.swift b/iOS/HealthKit/HKWorkoutRouteBuilder.swift index 8f3d7cc..e5d8533 100644 --- a/iOS/HealthKit/HKWorkoutRouteBuilder.swift +++ b/iOS/HealthKit/HKWorkoutRouteBuilder.swift @@ -3,5 +3,7 @@ class HKWorkoutRouteBuilder : HKSeriesBuilder { init(healthStore: HKHealthStore, device: HKDevice?) func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func finishRoute(with workout: HKWorkout, metadata: [String : Any]?, completion: @escaping (HKWorkoutRoute?, Error?) -> Void) + func finishRoute(with workout: HKWorkout, metadata: [String : Any]?) async throws -> HKWorkoutRoute } diff --git a/iOS/HomeKit/HMAccessory.swift b/iOS/HomeKit/HMAccessory.swift index b25bbad..220e4ec 100644 --- a/iOS/HomeKit/HMAccessory.swift +++ b/iOS/HomeKit/HMAccessory.swift @@ -29,7 +29,9 @@ class HMAccessory : NSObject { @available(iOS 11.3, *) var supportsIdentify: Bool { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws func identify(completionHandler completion: @escaping (Error?) -> Void) + func identify() async throws } @available(iOS 8.0, *) protocol HMAccessoryDelegate : NSObjectProtocol { diff --git a/iOS/HomeKit/HMActionSet.swift b/iOS/HomeKit/HMActionSet.swift index 3a0f45f..214e6f9 100644 --- a/iOS/HomeKit/HMActionSet.swift +++ b/iOS/HomeKit/HMActionSet.swift @@ -11,8 +11,11 @@ class HMActionSet : NSObject { @available(iOS 10.0, *) var lastExecutionDate: Date? { get } func updateName(_ name: String, completionHandler completion: @escaping HMErrorBlock) + func updateName(_ name: String) async throws func addAction(_ action: HMAction, completionHandler completion: @escaping HMErrorBlock) + func addAction(_ action: HMAction) async throws func removeAction(_ action: HMAction, completionHandler completion: @escaping HMErrorBlock) + func removeAction(_ action: HMAction) async throws } @available(iOS 9.0, *) let HMActionSetTypeWakeUp: String diff --git a/iOS/HomeKit/HMCameraStream.swift b/iOS/HomeKit/HMCameraStream.swift index ac05359..2158bc2 100644 --- a/iOS/HomeKit/HMCameraStream.swift +++ b/iOS/HomeKit/HMCameraStream.swift @@ -5,4 +5,5 @@ class HMCameraStream : HMCameraSource { @available(iOS, introduced: 10.0, deprecated: 10.0) func setAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting) func updateAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting, completionHandler completion: @escaping (Error?) -> Void) + func updateAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting) async throws } diff --git a/iOS/HomeKit/HMCharacteristic.swift b/iOS/HomeKit/HMCharacteristic.swift index 89e1c5a..442a2a4 100644 --- a/iOS/HomeKit/HMCharacteristic.swift +++ b/iOS/HomeKit/HMCharacteristic.swift @@ -12,7 +12,11 @@ class HMCharacteristic : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void) + func writeValue(_ value: Any?) async throws func readValue(completionHandler completion: @escaping (Error?) -> Void) + func readValue() async throws func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) + func enableNotification(_ enable: Bool) async throws func updateAuthorizationData(_ data: Data?, completionHandler completion: @escaping (Error?) -> Void) + func updateAuthorizationData(_ data: Data?) async throws } diff --git a/iOS/HomeKit/HMCharacteristicEvent.swift b/iOS/HomeKit/HMCharacteristicEvent.swift index 09dafdc..a450424 100644 --- a/iOS/HomeKit/HMCharacteristicEvent.swift +++ b/iOS/HomeKit/HMCharacteristicEvent.swift @@ -6,6 +6,8 @@ class HMCharacteristicEvent : HMEvent, NSCopying, NSMutableCop @NSCopying var triggerValue: TriggerValueType? { get } @available(iOS, introduced: 9.0, deprecated: 11.0, message: "No longer supported.") func updateTriggerValue(_ triggerValue: TriggerValueType?, completionHandler completion: @escaping (Error?) -> Void) + @available(iOS, introduced: 9.0, deprecated: 11.0, message: "No longer supported.") + func updateTriggerValue(_ triggerValue: TriggerValueType?) async throws } @available(iOS 11.0, *) class HMMutableCharacteristicEvent : HMCharacteristicEvent where TriggerValueType : NSCopying { diff --git a/iOS/HomeKit/HMCharacteristicWriteAction.swift b/iOS/HomeKit/HMCharacteristicWriteAction.swift index 586d0b4..7dcd509 100644 --- a/iOS/HomeKit/HMCharacteristicWriteAction.swift +++ b/iOS/HomeKit/HMCharacteristicWriteAction.swift @@ -5,4 +5,5 @@ class HMCharacteristicWriteAction : HMAction where TargetValueT var characteristic: HMCharacteristic { get } @NSCopying var targetValue: TargetValueType { get } func updateTargetValue(_ targetValue: TargetValueType, completionHandler completion: @escaping (Error?) -> Void) + func updateTargetValue(_ targetValue: TargetValueType) async throws } diff --git a/iOS/HomeKit/HMEventTrigger.swift b/iOS/HomeKit/HMEventTrigger.swift index 1ae18b3..895a343 100644 --- a/iOS/HomeKit/HMEventTrigger.swift +++ b/iOS/HomeKit/HMEventTrigger.swift @@ -23,16 +23,29 @@ class HMEventTrigger : HMTrigger { @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use updateEvents:completionHandler: instead") func addEvent(_ event: HMEvent, completionHandler completion: @escaping (Error?) -> Void) @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use updateEvents:completionHandler: instead") + func addEvent(_ event: HMEvent) async throws + @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use updateEvents:completionHandler: instead") func removeEvent(_ event: HMEvent, completionHandler completion: @escaping (Error?) -> Void) + @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use updateEvents:completionHandler: instead") + func removeEvent(_ event: HMEvent) async throws @available(iOS 11.0, *) func updateEvents(_ events: [HMEvent], completionHandler completion: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func updateEvents(_ events: [HMEvent]) async throws + @available(iOS 11.0, *) func updateEndEvents(_ endEvents: [HMEvent], completionHandler completion: @escaping (Error?) -> Void) + @available(iOS 11.0, *) + func updateEndEvents(_ endEvents: [HMEvent]) async throws func updatePredicate(_ predicate: NSPredicate?, completionHandler completion: @escaping (Error?) -> Void) + func updatePredicate(_ predicate: NSPredicate?) async throws @available(iOS 11.0, *) func updateRecurrences(_ recurrences: [DateComponents]?, completionHandler completion: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func updateRecurrences(_ recurrences: [DateComponents]?) async throws + @available(iOS 11.0, *) func updateExecuteOnce(_ executeOnce: Bool, completionHandler completion: @escaping (Error?) -> Void) + @available(iOS 11.0, *) + func updateExecuteOnce(_ executeOnce: Bool) async throws } extension HMEventTrigger { @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use predicateForEvaluatingTriggerOccurringBeforeSignificantEvent: instead") diff --git a/iOS/HomeKit/HMHome.swift b/iOS/HomeKit/HMHome.swift index 8d9baab..7a98897 100644 --- a/iOS/HomeKit/HMHome.swift +++ b/iOS/HomeKit/HMHome.swift @@ -17,18 +17,27 @@ class HMHome : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws } extension HMHome { var accessories: [HMAccessory] { get } func addAccessory(_ accessory: HMAccessory, completionHandler completion: @escaping (Error?) -> Void) + func addAccessory(_ accessory: HMAccessory) async throws func removeAccessory(_ accessory: HMAccessory, completionHandler completion: @escaping (Error?) -> Void) + func removeAccessory(_ accessory: HMAccessory) async throws func assignAccessory(_ accessory: HMAccessory, to room: HMRoom, completionHandler completion: @escaping (Error?) -> Void) + func assignAccessory(_ accessory: HMAccessory, to room: HMRoom) async throws func servicesWithTypes(_ serviceTypes: [String]) -> [HMService]? func unblockAccessory(_ accessory: HMAccessory, completionHandler completion: @escaping (Error?) -> Void) + func unblockAccessory(_ accessory: HMAccessory) async throws @available(iOS 10.0, *) func addAndSetupAccessories(completionHandler completion: @escaping (Error?) -> Void) + @available(iOS 10.0, *) + func addAndSetupAccessories() async throws @available(iOS 11.3, *) func addAndSetupAccessories(with payload: HMAccessorySetupPayload, completionHandler completion: @escaping ([HMAccessory]?, Error?) -> Void) + @available(iOS 11.3, *) + func addAndSetupAccessories(with payload: HMAccessorySetupPayload) async throws -> [HMAccessory] @available(iOS 13.2, *) var supportsAddingNetworkRouter: Bool { get } } @@ -39,41 +48,58 @@ extension HMHome { var users: [HMUser] { get } @available(iOS 9.0, *) func manageUsers(completionHandler completion: @escaping (Error?) -> Void) + @available(iOS 9.0, *) + func manageUsers() async throws @available(iOS, introduced: 8.0, deprecated: 9.0) func addUser(completionHandler completion: @escaping (HMUser?, Error?) -> Void) @available(iOS, introduced: 8.0, deprecated: 9.0) + func addUser() async throws -> HMUser + @available(iOS, introduced: 8.0, deprecated: 9.0) func removeUser(_ user: HMUser, completionHandler completion: @escaping (Error?) -> Void) + @available(iOS, introduced: 8.0, deprecated: 9.0) + func removeUser(_ user: HMUser) async throws @available(iOS 9.0, *) func homeAccessControl(for user: HMUser) -> HMHomeAccessControl } extension HMHome { var rooms: [HMRoom] { get } func addRoom(withName roomName: String, completionHandler completion: @escaping (HMRoom?, Error?) -> Void) + func addRoom(withName roomName: String) async throws -> HMRoom func removeRoom(_ room: HMRoom, completionHandler completion: @escaping (Error?) -> Void) + func removeRoom(_ room: HMRoom) async throws func roomForEntireHome() -> HMRoom } extension HMHome { var zones: [HMZone] { get } func addZone(withName zoneName: String, completionHandler completion: @escaping (HMZone?, Error?) -> Void) + func addZone(withName zoneName: String) async throws -> HMZone func removeZone(_ zone: HMZone, completionHandler completion: @escaping (Error?) -> Void) + func removeZone(_ zone: HMZone) async throws } extension HMHome { var serviceGroups: [HMServiceGroup] { get } func addServiceGroup(withName serviceGroupName: String, completionHandler completion: @escaping (HMServiceGroup?, Error?) -> Void) + func addServiceGroup(withName serviceGroupName: String) async throws -> HMServiceGroup func removeServiceGroup(_ group: HMServiceGroup, completionHandler completion: @escaping (Error?) -> Void) + func removeServiceGroup(_ group: HMServiceGroup) async throws } extension HMHome { var actionSets: [HMActionSet] { get } func addActionSet(withName actionSetName: String, completionHandler completion: @escaping (HMActionSet?, Error?) -> Void) + func addActionSet(withName actionSetName: String) async throws -> HMActionSet func removeActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func removeActionSet(_ actionSet: HMActionSet) async throws func executeActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func executeActionSet(_ actionSet: HMActionSet) async throws @available(iOS 9.0, *) func builtinActionSet(ofType actionSetType: String) -> HMActionSet? } extension HMHome { var triggers: [HMTrigger] { get } func addTrigger(_ trigger: HMTrigger, completionHandler completion: @escaping (Error?) -> Void) + func addTrigger(_ trigger: HMTrigger) async throws func removeTrigger(_ trigger: HMTrigger, completionHandler completion: @escaping (Error?) -> Void) + func removeTrigger(_ trigger: HMTrigger) async throws } @available(iOS 8.0, *) protocol HMHomeDelegate : NSObjectProtocol { diff --git a/iOS/HomeKit/HMHomeManager.swift b/iOS/HomeKit/HMHomeManager.swift index 8897533..c610bcf 100644 --- a/iOS/HomeKit/HMHomeManager.swift +++ b/iOS/HomeKit/HMHomeManager.swift @@ -15,8 +15,11 @@ class HMHomeManager : NSObject { var primaryHome: HMHome? { get } var homes: [HMHome] { get } func updatePrimaryHome(_ home: HMHome, completionHandler completion: @escaping (Error?) -> Void) + func updatePrimaryHome(_ home: HMHome) async throws func addHome(withName homeName: String, completionHandler completion: @escaping (HMHome?, Error?) -> Void) + func addHome(withName homeName: String) async throws -> HMHome func removeHome(_ home: HMHome, completionHandler completion: @escaping (Error?) -> Void) + func removeHome(_ home: HMHome) async throws } @available(iOS 8.0, *) protocol HMHomeManagerDelegate : NSObjectProtocol { diff --git a/iOS/HomeKit/HMRoom.swift b/iOS/HomeKit/HMRoom.swift index 23a799f..c5b2b5e 100644 --- a/iOS/HomeKit/HMRoom.swift +++ b/iOS/HomeKit/HMRoom.swift @@ -6,4 +6,5 @@ class HMRoom : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws } diff --git a/iOS/HomeKit/HMService.swift b/iOS/HomeKit/HMService.swift index 09699dd..18bb1cd 100644 --- a/iOS/HomeKit/HMService.swift +++ b/iOS/HomeKit/HMService.swift @@ -17,5 +17,7 @@ class HMService : NSObject { @available(iOS 10.0, *) var linkedServices: [HMService]? { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws func updateAssociatedServiceType(_ serviceType: String?, completionHandler completion: @escaping (Error?) -> Void) + func updateAssociatedServiceType(_ serviceType: String?) async throws } diff --git a/iOS/HomeKit/HMServiceGroup.swift b/iOS/HomeKit/HMServiceGroup.swift index e796ac8..b65888f 100644 --- a/iOS/HomeKit/HMServiceGroup.swift +++ b/iOS/HomeKit/HMServiceGroup.swift @@ -6,6 +6,9 @@ class HMServiceGroup : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws func addService(_ service: HMService, completionHandler completion: @escaping (Error?) -> Void) + func addService(_ service: HMService) async throws func removeService(_ service: HMService, completionHandler completion: @escaping (Error?) -> Void) + func removeService(_ service: HMService) async throws } diff --git a/iOS/HomeKit/HMTimerTrigger.swift b/iOS/HomeKit/HMTimerTrigger.swift index bb9736e..629fdc5 100644 --- a/iOS/HomeKit/HMTimerTrigger.swift +++ b/iOS/HomeKit/HMTimerTrigger.swift @@ -7,6 +7,9 @@ class HMTimerTrigger : HMTrigger { var recurrence: DateComponents? { get } var recurrenceCalendar: Calendar? { get } func updateFireDate(_ fireDate: Date, completionHandler completion: @escaping (Error?) -> Void) + func updateFireDate(_ fireDate: Date) async throws func updateTimeZone(_ timeZone: TimeZone?, completionHandler completion: @escaping (Error?) -> Void) + func updateTimeZone(_ timeZone: TimeZone?) async throws func updateRecurrence(_ recurrence: DateComponents?, completionHandler completion: @escaping (Error?) -> Void) + func updateRecurrence(_ recurrence: DateComponents?) async throws } diff --git a/iOS/HomeKit/HMTrigger.swift b/iOS/HomeKit/HMTrigger.swift index 4bfcecd..e346831 100644 --- a/iOS/HomeKit/HMTrigger.swift +++ b/iOS/HomeKit/HMTrigger.swift @@ -8,7 +8,11 @@ class HMTrigger : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws func addActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func addActionSet(_ actionSet: HMActionSet) async throws func removeActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func removeActionSet(_ actionSet: HMActionSet) async throws func enable(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) + func enable(_ enable: Bool) async throws } diff --git a/iOS/HomeKit/HMZone.swift b/iOS/HomeKit/HMZone.swift index 7ea1f7d..26105de 100644 --- a/iOS/HomeKit/HMZone.swift +++ b/iOS/HomeKit/HMZone.swift @@ -6,6 +6,9 @@ class HMZone : NSObject { @available(iOS 9.0, *) var uniqueIdentifier: UUID { get } func updateName(_ name: String, completionHandler completion: @escaping (Error?) -> Void) + func updateName(_ name: String) async throws func addRoom(_ room: HMRoom, completionHandler completion: @escaping (Error?) -> Void) + func addRoom(_ room: HMRoom) async throws func removeRoom(_ room: HMRoom, completionHandler completion: @escaping (Error?) -> Void) + func removeRoom(_ room: HMRoom) async throws } diff --git a/iOS/IdentityLookup/ILMessageFilterExtensionContext.swift b/iOS/IdentityLookup/ILMessageFilterExtensionContext.swift index d151e72..9a2fe7d 100644 --- a/iOS/IdentityLookup/ILMessageFilterExtensionContext.swift +++ b/iOS/IdentityLookup/ILMessageFilterExtensionContext.swift @@ -2,4 +2,5 @@ @available(iOS 11.0, *) class ILMessageFilterExtensionContext : NSExtensionContext { func deferQueryRequestToNetwork(completion: @escaping (ILNetworkResponse?, Error?) -> Void) + func deferQueryRequestToNetwork() async throws -> ILNetworkResponse } diff --git a/iOS/IdentityLookup/ILMessageFilterQueryHandling.swift b/iOS/IdentityLookup/ILMessageFilterQueryHandling.swift index 19cc7a1..3e07f76 100644 --- a/iOS/IdentityLookup/ILMessageFilterQueryHandling.swift +++ b/iOS/IdentityLookup/ILMessageFilterQueryHandling.swift @@ -2,4 +2,5 @@ @available(iOS 11.0, *) protocol ILMessageFilterQueryHandling : NSObjectProtocol { func handle(_ queryRequest: ILMessageFilterQueryRequest, context: ILMessageFilterExtensionContext, completion: @escaping (ILMessageFilterQueryResponse) -> Void) + func handle(_ queryRequest: ILMessageFilterQueryRequest, context: ILMessageFilterExtensionContext) async -> ILMessageFilterQueryResponse } diff --git a/iOS/ImageCaptureCore/ICCameraDevice.swift b/iOS/ImageCaptureCore/ICCameraDevice.swift index 6d69700..3c4dd69 100644 --- a/iOS/ImageCaptureCore/ICCameraDevice.swift +++ b/iOS/ImageCaptureCore/ICCameraDevice.swift @@ -94,6 +94,8 @@ class ICCameraDevice : ICDevice { var ptpEventHandler: (Data) -> Void @available(iOS 13.0, *) func requestSendPTPCommand(_ ptpCommand: Data, outData ptpData: Data?, completion: @escaping (Data, Data, Error?) -> Void) + @available(iOS 13.0, *) + func requestSendPTPCommand(_ ptpCommand: Data, outData ptpData: Data?) async throws -> (Data, Data) } protocol ICCameraDeviceDelegate : ICDeviceDelegate { @available(iOS 13.0, *) diff --git a/iOS/ImageCaptureCore/ICCameraFile.swift b/iOS/ImageCaptureCore/ICCameraFile.swift index de25a5f..74771a8 100644 --- a/iOS/ImageCaptureCore/ICCameraFile.swift +++ b/iOS/ImageCaptureCore/ICCameraFile.swift @@ -50,9 +50,15 @@ class ICCameraFile : ICCameraItem { @available(iOS 13.0, *) func requestThumbnailData(options: [ICCameraItemThumbnailOption : Any]? = nil, completion: @escaping (Data?, Error?) -> Void) @available(iOS 13.0, *) + func requestThumbnailData(options: [ICCameraItemThumbnailOption : Any]? = nil) async throws -> Data + @available(iOS 13.0, *) func requestMetadataDictionary(options: [ICCameraItemMetadataOption : Any]? = nil, completion: @escaping ([AnyHashable : Any]?, Error?) -> Void) @available(iOS 13.0, *) + func requestMetadataDictionary(options: [ICCameraItemMetadataOption : Any]? = nil) async throws -> [AnyHashable : Any] + @available(iOS 13.0, *) func requestDownload(options: [ICDownloadOption : Any]? = nil, completion: @escaping (String?, Error?) -> Void) -> Progress? @available(iOS 13.0, *) func requestReadData(atOffset offset: off_t, length: off_t, completion: @escaping (Data?, Error?) -> Void) + @available(iOS 13.0, *) + func requestReadData(atOffset offset: off_t, length: off_t) async throws -> Data } diff --git a/iOS/ImageCaptureCore/ICDevice.swift b/iOS/ImageCaptureCore/ICDevice.swift index af977d0..9615fbd 100644 --- a/iOS/ImageCaptureCore/ICDevice.swift +++ b/iOS/ImageCaptureCore/ICDevice.swift @@ -94,9 +94,15 @@ class ICDevice : NSObject { @available(iOS 13.0, *) func requestOpenSession(options: [ICSessionOptions : Any]? = nil, completion: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func requestOpenSession(options: [ICSessionOptions : Any]? = nil) async throws + @available(iOS 13.0, *) func requestCloseSession(options: [ICSessionOptions : Any]? = nil, completion: @escaping (Error?) -> Void) @available(iOS 13.0, *) + func requestCloseSession(options: [ICSessionOptions : Any]? = nil) async throws + @available(iOS 13.0, *) func requestEject(completion: @escaping (Error?) -> Void) + @available(iOS 13.0, *) + func requestEject() async throws } protocol ICDeviceDelegate : NSObjectProtocol { @available(iOS 13.0, *) diff --git a/iOS/ImageCaptureCore/ICDeviceBrowser.swift b/iOS/ImageCaptureCore/ICDeviceBrowser.swift index 358ed68..535068c 100644 --- a/iOS/ImageCaptureCore/ICDeviceBrowser.swift +++ b/iOS/ImageCaptureCore/ICDeviceBrowser.swift @@ -50,7 +50,11 @@ class ICDeviceBrowser : NSObject { @available(iOS 14.0, *) func requestContentsAuthorization(completion: @escaping (ICAuthorizationStatus) -> Void) @available(iOS 14.0, *) + func requestContentsAuthorization() async -> ICAuthorizationStatus + @available(iOS 14.0, *) func controlAuthorizationStatus() -> ICAuthorizationStatus @available(iOS 14.0, *) func requestControlAuthorization(completion: @escaping (ICAuthorizationStatus) -> Void) + @available(iOS 14.0, *) + func requestControlAuthorization() async -> ICAuthorizationStatus } diff --git a/iOS/Intents/INActivateCarSignalIntent.swift b/iOS/Intents/INActivateCarSignalIntent.swift index ee22b02..c6e4980 100644 --- a/iOS/Intents/INActivateCarSignalIntent.swift +++ b/iOS/Intents/INActivateCarSignalIntent.swift @@ -8,7 +8,11 @@ class INActivateCarSignalIntent : INIntent { @available(iOS 10.3, *) protocol INActivateCarSignalIntentHandling : NSObjectProtocol { func handle(intent: INActivateCarSignalIntent, completion: @escaping (INActivateCarSignalIntentResponse) -> Void) + func handle(intent: INActivateCarSignalIntent) async -> INActivateCarSignalIntentResponse optional func confirm(intent: INActivateCarSignalIntent, completion: @escaping (INActivateCarSignalIntentResponse) -> Void) + optional func confirm(intent: INActivateCarSignalIntent) async -> INActivateCarSignalIntentResponse optional func resolveCarName(for intent: INActivateCarSignalIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INActivateCarSignalIntent) async -> INSpeakableStringResolutionResult optional func resolveSignals(for intent: INActivateCarSignalIntent, with completion: @escaping (INCarSignalOptionsResolutionResult) -> Void) + optional func resolveSignals(for intent: INActivateCarSignalIntent) async -> INCarSignalOptionsResolutionResult } diff --git a/iOS/Intents/INAddMediaIntent.swift b/iOS/Intents/INAddMediaIntent.swift index 22a3991..c4b1643 100644 --- a/iOS/Intents/INAddMediaIntent.swift +++ b/iOS/Intents/INAddMediaIntent.swift @@ -9,7 +9,11 @@ class INAddMediaIntent : INIntent { @available(iOS 13.0, *) protocol INAddMediaIntentHandling : NSObjectProtocol { func handle(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + func handle(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func confirm(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + optional func confirm(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func resolveMediaItems(for intent: INAddMediaIntent, with completion: @escaping ([INAddMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INAddMediaIntent) async -> [INAddMediaMediaItemResolutionResult] optional func resolveMediaDestination(for intent: INAddMediaIntent, with completion: @escaping (INAddMediaMediaDestinationResolutionResult) -> Void) + optional func resolveMediaDestination(for intent: INAddMediaIntent) async -> INAddMediaMediaDestinationResolutionResult } diff --git a/iOS/Intents/INAddTasksIntent.swift b/iOS/Intents/INAddTasksIntent.swift index c1628bf..554820b 100644 --- a/iOS/Intents/INAddTasksIntent.swift +++ b/iOS/Intents/INAddTasksIntent.swift @@ -13,17 +13,31 @@ class INAddTasksIntent : INIntent { @available(iOS 11.0, *) protocol INAddTasksIntentHandling : NSObjectProtocol { func handle(intent: INAddTasksIntent, completion: @escaping (INAddTasksIntentResponse) -> Void) + func handle(intent: INAddTasksIntent) async -> INAddTasksIntentResponse optional func confirm(intent: INAddTasksIntent, completion: @escaping (INAddTasksIntentResponse) -> Void) + optional func confirm(intent: INAddTasksIntent) async -> INAddTasksIntentResponse @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTargetTaskListForAddTasks:withCompletion: is deprecated. Use resolveTargetTaskListForAddTasks:completion: instead") optional func resolveTargetTaskList(for intent: INAddTasksIntent, with completion: @escaping (INTaskListResolutionResult) -> Void) + @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTargetTaskListForAddTasks:withCompletion: is deprecated. Use resolveTargetTaskListForAddTasks:completion: instead") + optional func resolveTargetTaskList(for intent: INAddTasksIntent) async -> INTaskListResolutionResult @available(iOS 13.0, *) optional func resolveTargetTaskList(for intent: INAddTasksIntent, with completion: @escaping (INAddTasksTargetTaskListResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolveTargetTaskList(for intent: INAddTasksIntent) async -> INAddTasksTargetTaskListResolutionResult optional func resolveTaskTitles(for intent: INAddTasksIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + optional func resolveTaskTitles(for intent: INAddTasksIntent) async -> [INSpeakableStringResolutionResult] optional func resolveSpatialEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INSpatialEventTriggerResolutionResult) -> Void) + optional func resolveSpatialEventTrigger(for intent: INAddTasksIntent) async -> INSpatialEventTriggerResolutionResult @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTemporalEventTriggerForAddTasks:withCompletion: is deprecated. Use resolveTemporalEventTriggerForAddTasks:completion: instead") optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INTemporalEventTriggerResolutionResult) -> Void) + @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTemporalEventTriggerForAddTasks:withCompletion: is deprecated. Use resolveTemporalEventTriggerForAddTasks:completion: instead") + optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent) async -> INTemporalEventTriggerResolutionResult @available(iOS 13.0, *) optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INAddTasksTemporalEventTriggerResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent) async -> INAddTasksTemporalEventTriggerResolutionResult + @available(iOS 13.0, *) optional func resolvePriority(for intent: INAddTasksIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolvePriority(for intent: INAddTasksIntent) async -> INTaskPriorityResolutionResult } diff --git a/iOS/Intents/INAppendToNoteIntent.swift b/iOS/Intents/INAppendToNoteIntent.swift index 2bb1e2d..ac62e90 100644 --- a/iOS/Intents/INAppendToNoteIntent.swift +++ b/iOS/Intents/INAppendToNoteIntent.swift @@ -8,7 +8,11 @@ class INAppendToNoteIntent : INIntent { @available(iOS 11.0, *) protocol INAppendToNoteIntentHandling : NSObjectProtocol { func handle(intent: INAppendToNoteIntent, completion: @escaping (INAppendToNoteIntentResponse) -> Void) + func handle(intent: INAppendToNoteIntent) async -> INAppendToNoteIntentResponse optional func confirm(intent: INAppendToNoteIntent, completion: @escaping (INAppendToNoteIntentResponse) -> Void) + optional func confirm(intent: INAppendToNoteIntent) async -> INAppendToNoteIntentResponse optional func resolveTargetNote(for intent: INAppendToNoteIntent, with completion: @escaping (INNoteResolutionResult) -> Void) + optional func resolveTargetNote(for intent: INAppendToNoteIntent) async -> INNoteResolutionResult optional func resolveContent(for intent: INAppendToNoteIntent, with completion: @escaping (INNoteContentResolutionResult) -> Void) + optional func resolveContent(for intent: INAppendToNoteIntent) async -> INNoteContentResolutionResult } diff --git a/iOS/Intents/INBookRestaurantReservationIntent.swift b/iOS/Intents/INBookRestaurantReservationIntent.swift index 6192b1c..33555dc 100644 --- a/iOS/Intents/INBookRestaurantReservationIntent.swift +++ b/iOS/Intents/INBookRestaurantReservationIntent.swift @@ -14,10 +14,17 @@ class INBookRestaurantReservationIntent : INIntent, NSCopying { @available(iOS 10.0, *) protocol INBookRestaurantReservationIntentHandling : NSObjectProtocol { func handle(bookRestaurantReservation intent: INBookRestaurantReservationIntent, completion: @escaping (INBookRestaurantReservationIntentResponse) -> Void) + func handle(bookRestaurantReservation intent: INBookRestaurantReservationIntent) async -> INBookRestaurantReservationIntentResponse optional func confirm(bookRestaurantReservation intent: INBookRestaurantReservationIntent, completion: @escaping (INBookRestaurantReservationIntentResponse) -> Void) + optional func confirm(bookRestaurantReservation intent: INBookRestaurantReservationIntent) async -> INBookRestaurantReservationIntentResponse optional func resolveRestaurant(for intent: INBookRestaurantReservationIntent, completion: @escaping (INRestaurantResolutionResult) -> Void) + optional func resolveRestaurant(for intent: INBookRestaurantReservationIntent) async -> INRestaurantResolutionResult optional func resolveBookingDateComponents(for intent: INBookRestaurantReservationIntent, completion: @escaping (INDateComponentsResolutionResult) -> Void) + optional func resolveBookingDateComponents(for intent: INBookRestaurantReservationIntent) async -> INDateComponentsResolutionResult optional func resolvePartySize(for intent: INBookRestaurantReservationIntent, completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolvePartySize(for intent: INBookRestaurantReservationIntent) async -> INIntegerResolutionResult optional func resolveGuest(for intent: INBookRestaurantReservationIntent, completion: @escaping (INRestaurantGuestResolutionResult) -> Void) + optional func resolveGuest(for intent: INBookRestaurantReservationIntent) async -> INRestaurantGuestResolutionResult optional func resolveGuestProvidedSpecialRequestText(for intent: INBookRestaurantReservationIntent, completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveGuestProvidedSpecialRequestText(for intent: INBookRestaurantReservationIntent) async -> INStringResolutionResult } diff --git a/iOS/Intents/INCancelRideIntent.swift b/iOS/Intents/INCancelRideIntent.swift index 46daaeb..07c69be 100644 --- a/iOS/Intents/INCancelRideIntent.swift +++ b/iOS/Intents/INCancelRideIntent.swift @@ -7,5 +7,7 @@ class INCancelRideIntent : INIntent { @available(iOS 11.0, *) protocol INCancelRideIntentHandling : NSObjectProtocol { func handle(cancelRide intent: INCancelRideIntent, completion: @escaping (INCancelRideIntentResponse) -> Void) + func handle(cancelRide intent: INCancelRideIntent) async -> INCancelRideIntentResponse optional func confirm(cancelRide intent: INCancelRideIntent, completion: @escaping (INCancelRideIntentResponse) -> Void) + optional func confirm(cancelRide intent: INCancelRideIntent) async -> INCancelRideIntentResponse } diff --git a/iOS/Intents/INCancelWorkoutIntent.swift b/iOS/Intents/INCancelWorkoutIntent.swift index e6d5e06..dabe5ae 100644 --- a/iOS/Intents/INCancelWorkoutIntent.swift +++ b/iOS/Intents/INCancelWorkoutIntent.swift @@ -7,6 +7,9 @@ class INCancelWorkoutIntent : INIntent { @available(iOS 10.0, *) protocol INCancelWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INCancelWorkoutIntent, completion: @escaping (INCancelWorkoutIntentResponse) -> Void) + func handle(intent: INCancelWorkoutIntent) async -> INCancelWorkoutIntentResponse optional func confirm(intent: INCancelWorkoutIntent, completion: @escaping (INCancelWorkoutIntentResponse) -> Void) + optional func confirm(intent: INCancelWorkoutIntent) async -> INCancelWorkoutIntentResponse optional func resolveWorkoutName(for intent: INCancelWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INCancelWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INCreateNoteIntent.swift b/iOS/Intents/INCreateNoteIntent.swift index 16d963f..156036d 100644 --- a/iOS/Intents/INCreateNoteIntent.swift +++ b/iOS/Intents/INCreateNoteIntent.swift @@ -9,8 +9,13 @@ class INCreateNoteIntent : INIntent { @available(iOS 11.0, *) protocol INCreateNoteIntentHandling : NSObjectProtocol { func handle(intent: INCreateNoteIntent, completion: @escaping (INCreateNoteIntentResponse) -> Void) + func handle(intent: INCreateNoteIntent) async -> INCreateNoteIntentResponse optional func confirm(intent: INCreateNoteIntent, completion: @escaping (INCreateNoteIntentResponse) -> Void) + optional func confirm(intent: INCreateNoteIntent) async -> INCreateNoteIntentResponse optional func resolveTitle(for intent: INCreateNoteIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INCreateNoteIntent) async -> INSpeakableStringResolutionResult optional func resolveContent(for intent: INCreateNoteIntent, with completion: @escaping (INNoteContentResolutionResult) -> Void) + optional func resolveContent(for intent: INCreateNoteIntent) async -> INNoteContentResolutionResult optional func resolveGroupName(for intent: INCreateNoteIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveGroupName(for intent: INCreateNoteIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INCreateTaskListIntent.swift b/iOS/Intents/INCreateTaskListIntent.swift index a1cce95..a24effa 100644 --- a/iOS/Intents/INCreateTaskListIntent.swift +++ b/iOS/Intents/INCreateTaskListIntent.swift @@ -9,8 +9,13 @@ class INCreateTaskListIntent : INIntent { @available(iOS 11.0, *) protocol INCreateTaskListIntentHandling : NSObjectProtocol { func handle(intent: INCreateTaskListIntent, completion: @escaping (INCreateTaskListIntentResponse) -> Void) + func handle(intent: INCreateTaskListIntent) async -> INCreateTaskListIntentResponse optional func confirm(intent: INCreateTaskListIntent, completion: @escaping (INCreateTaskListIntentResponse) -> Void) + optional func confirm(intent: INCreateTaskListIntent) async -> INCreateTaskListIntentResponse optional func resolveTitle(for intent: INCreateTaskListIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INCreateTaskListIntent) async -> INSpeakableStringResolutionResult optional func resolveTaskTitles(for intent: INCreateTaskListIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + optional func resolveTaskTitles(for intent: INCreateTaskListIntent) async -> [INSpeakableStringResolutionResult] optional func resolveGroupName(for intent: INCreateTaskListIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveGroupName(for intent: INCreateTaskListIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INDeleteTasksIntent.swift b/iOS/Intents/INDeleteTasksIntent.swift index 453281a..ae42ec1 100644 --- a/iOS/Intents/INDeleteTasksIntent.swift +++ b/iOS/Intents/INDeleteTasksIntent.swift @@ -17,7 +17,11 @@ extension INDeleteTasksIntent { @available(iOS 13.0, *) protocol INDeleteTasksIntentHandling : NSObjectProtocol { func handle(intent: INDeleteTasksIntent, completion: @escaping (INDeleteTasksIntentResponse) -> Void) + func handle(intent: INDeleteTasksIntent) async -> INDeleteTasksIntentResponse optional func confirm(intent: INDeleteTasksIntent, completion: @escaping (INDeleteTasksIntentResponse) -> Void) + optional func confirm(intent: INDeleteTasksIntent) async -> INDeleteTasksIntentResponse optional func resolveTaskList(for intent: INDeleteTasksIntent, with completion: @escaping (INDeleteTasksTaskListResolutionResult) -> Void) + optional func resolveTaskList(for intent: INDeleteTasksIntent) async -> INDeleteTasksTaskListResolutionResult optional func resolveTasks(for intent: INDeleteTasksIntent, with completion: @escaping ([INDeleteTasksTaskResolutionResult]) -> Void) + optional func resolveTasks(for intent: INDeleteTasksIntent) async -> [INDeleteTasksTaskResolutionResult] } diff --git a/iOS/Intents/INEndWorkoutIntent.swift b/iOS/Intents/INEndWorkoutIntent.swift index acf310b..e0f0238 100644 --- a/iOS/Intents/INEndWorkoutIntent.swift +++ b/iOS/Intents/INEndWorkoutIntent.swift @@ -7,6 +7,9 @@ class INEndWorkoutIntent : INIntent { @available(iOS 10.0, *) protocol INEndWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INEndWorkoutIntent, completion: @escaping (INEndWorkoutIntentResponse) -> Void) + func handle(intent: INEndWorkoutIntent) async -> INEndWorkoutIntentResponse optional func confirm(intent: INEndWorkoutIntent, completion: @escaping (INEndWorkoutIntentResponse) -> Void) + optional func confirm(intent: INEndWorkoutIntent) async -> INEndWorkoutIntentResponse optional func resolveWorkoutName(for intent: INEndWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INEndWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INGetAvailableRestaurantReservationBookingDefaultsIntent.swift b/iOS/Intents/INGetAvailableRestaurantReservationBookingDefaultsIntent.swift index cba7377..ade38e6 100644 --- a/iOS/Intents/INGetAvailableRestaurantReservationBookingDefaultsIntent.swift +++ b/iOS/Intents/INGetAvailableRestaurantReservationBookingDefaultsIntent.swift @@ -8,6 +8,9 @@ class INGetAvailableRestaurantReservationBookingDefaultsIntent : INIntent { @available(iOS 10.0, *) protocol INGetAvailableRestaurantReservationBookingDefaultsIntentHandling : NSObjectProtocol { func handle(getAvailableRestaurantReservationBookingDefaults intent: INGetAvailableRestaurantReservationBookingDefaultsIntent, completion: @escaping (INGetAvailableRestaurantReservationBookingDefaultsIntentResponse) -> Void) + func handle(getAvailableRestaurantReservationBookingDefaults intent: INGetAvailableRestaurantReservationBookingDefaultsIntent) async -> INGetAvailableRestaurantReservationBookingDefaultsIntentResponse optional func confirm(getAvailableRestaurantReservationBookingDefaults intent: INGetAvailableRestaurantReservationBookingDefaultsIntent, completion: @escaping (INGetAvailableRestaurantReservationBookingDefaultsIntentResponse) -> Void) + optional func confirm(getAvailableRestaurantReservationBookingDefaults intent: INGetAvailableRestaurantReservationBookingDefaultsIntent) async -> INGetAvailableRestaurantReservationBookingDefaultsIntentResponse optional func resolveRestaurant(for intent: INGetAvailableRestaurantReservationBookingDefaultsIntent, completion: @escaping (INRestaurantResolutionResult) -> Void) + optional func resolveRestaurant(for intent: INGetAvailableRestaurantReservationBookingDefaultsIntent) async -> INRestaurantResolutionResult } diff --git a/iOS/Intents/INGetAvailableRestaurantReservationBookingsIntent.swift b/iOS/Intents/INGetAvailableRestaurantReservationBookingsIntent.swift index edb9d73..1414153 100644 --- a/iOS/Intents/INGetAvailableRestaurantReservationBookingsIntent.swift +++ b/iOS/Intents/INGetAvailableRestaurantReservationBookingsIntent.swift @@ -13,8 +13,13 @@ class INGetAvailableRestaurantReservationBookingsIntent : INIntent, NSCopying { @available(iOS 10.0, *) protocol INGetAvailableRestaurantReservationBookingsIntentHandling : NSObjectProtocol { func handle(getAvailableRestaurantReservationBookings intent: INGetAvailableRestaurantReservationBookingsIntent, completion: @escaping (INGetAvailableRestaurantReservationBookingsIntentResponse) -> Void) + func handle(getAvailableRestaurantReservationBookings intent: INGetAvailableRestaurantReservationBookingsIntent) async -> INGetAvailableRestaurantReservationBookingsIntentResponse optional func confirm(getAvailableRestaurantReservationBookings intent: INGetAvailableRestaurantReservationBookingsIntent, completion: @escaping (INGetAvailableRestaurantReservationBookingsIntentResponse) -> Void) + optional func confirm(getAvailableRestaurantReservationBookings intent: INGetAvailableRestaurantReservationBookingsIntent) async -> INGetAvailableRestaurantReservationBookingsIntentResponse optional func resolveRestaurant(for intent: INGetAvailableRestaurantReservationBookingsIntent, completion: @escaping (INRestaurantResolutionResult) -> Void) + optional func resolveRestaurant(for intent: INGetAvailableRestaurantReservationBookingsIntent) async -> INRestaurantResolutionResult optional func resolvePartySize(for intent: INGetAvailableRestaurantReservationBookingsIntent, completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolvePartySize(for intent: INGetAvailableRestaurantReservationBookingsIntent) async -> INIntegerResolutionResult optional func resolvePreferredBookingDateComponents(for intent: INGetAvailableRestaurantReservationBookingsIntent, completion: @escaping (INDateComponentsResolutionResult) -> Void) + optional func resolvePreferredBookingDateComponents(for intent: INGetAvailableRestaurantReservationBookingsIntent) async -> INDateComponentsResolutionResult } diff --git a/iOS/Intents/INGetCarLockStatusIntent.swift b/iOS/Intents/INGetCarLockStatusIntent.swift index 7d42437..58bacdb 100644 --- a/iOS/Intents/INGetCarLockStatusIntent.swift +++ b/iOS/Intents/INGetCarLockStatusIntent.swift @@ -7,6 +7,9 @@ class INGetCarLockStatusIntent : INIntent { @available(iOS 10.3, *) protocol INGetCarLockStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetCarLockStatusIntent, completion: @escaping (INGetCarLockStatusIntentResponse) -> Void) + func handle(intent: INGetCarLockStatusIntent) async -> INGetCarLockStatusIntentResponse optional func confirm(intent: INGetCarLockStatusIntent, completion: @escaping (INGetCarLockStatusIntentResponse) -> Void) + optional func confirm(intent: INGetCarLockStatusIntent) async -> INGetCarLockStatusIntentResponse optional func resolveCarName(for intent: INGetCarLockStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INGetCarLockStatusIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INGetCarPowerLevelStatusIntent.swift b/iOS/Intents/INGetCarPowerLevelStatusIntent.swift index 80826dc..2523e95 100644 --- a/iOS/Intents/INGetCarPowerLevelStatusIntent.swift +++ b/iOS/Intents/INGetCarPowerLevelStatusIntent.swift @@ -7,12 +7,15 @@ class INGetCarPowerLevelStatusIntent : INIntent { @available(iOS 10.3, *) protocol INGetCarPowerLevelStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetCarPowerLevelStatusIntent, completion: @escaping (INGetCarPowerLevelStatusIntentResponse) -> Void) + func handle(intent: INGetCarPowerLevelStatusIntent) async -> INGetCarPowerLevelStatusIntentResponse @available(iOS 14.0, *) optional func startSendingUpdates(for intent: INGetCarPowerLevelStatusIntent, to observer: INGetCarPowerLevelStatusIntentResponseObserver) @available(iOS 14.0, *) optional func stopSendingUpdates(for intent: INGetCarPowerLevelStatusIntent) optional func confirm(intent: INGetCarPowerLevelStatusIntent, completion: @escaping (INGetCarPowerLevelStatusIntentResponse) -> Void) + optional func confirm(intent: INGetCarPowerLevelStatusIntent) async -> INGetCarPowerLevelStatusIntentResponse optional func resolveCarName(for intent: INGetCarPowerLevelStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INGetCarPowerLevelStatusIntent) async -> INSpeakableStringResolutionResult } @available(iOS 14.0, *) protocol INGetCarPowerLevelStatusIntentResponseObserver : NSObjectProtocol { diff --git a/iOS/Intents/INGetRestaurantGuestIntent.swift b/iOS/Intents/INGetRestaurantGuestIntent.swift index 9ffd03e..c064db6 100644 --- a/iOS/Intents/INGetRestaurantGuestIntent.swift +++ b/iOS/Intents/INGetRestaurantGuestIntent.swift @@ -5,5 +5,7 @@ class INGetRestaurantGuestIntent : INIntent { @available(iOS 10.0, *) protocol INGetRestaurantGuestIntentHandling : NSObjectProtocol { func handle(getRestaurantGuest intent: INGetRestaurantGuestIntent, completion: @escaping (INGetRestaurantGuestIntentResponse) -> Void) + func handle(getRestaurantGuest intent: INGetRestaurantGuestIntent) async -> INGetRestaurantGuestIntentResponse optional func confirm(getRestaurantGuest guestIntent: INGetRestaurantGuestIntent, completion: @escaping (INGetRestaurantGuestIntentResponse) -> Void) + optional func confirm(getRestaurantGuest guestIntent: INGetRestaurantGuestIntent) async -> INGetRestaurantGuestIntentResponse } diff --git a/iOS/Intents/INGetRideStatusIntent.swift b/iOS/Intents/INGetRideStatusIntent.swift index b2faa37..e7acd37 100644 --- a/iOS/Intents/INGetRideStatusIntent.swift +++ b/iOS/Intents/INGetRideStatusIntent.swift @@ -5,9 +5,11 @@ class INGetRideStatusIntent : INIntent { @available(iOS 10.0, *) protocol INGetRideStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetRideStatusIntent, completion: @escaping (INGetRideStatusIntentResponse) -> Void) + func handle(intent: INGetRideStatusIntent) async -> INGetRideStatusIntentResponse func startSendingUpdates(for intent: INGetRideStatusIntent, to observer: INGetRideStatusIntentResponseObserver) func stopSendingUpdates(for intent: INGetRideStatusIntent) optional func confirm(intent: INGetRideStatusIntent, completion: @escaping (INGetRideStatusIntentResponse) -> Void) + optional func confirm(intent: INGetRideStatusIntent) async -> INGetRideStatusIntentResponse } @available(iOS 10.0, *) protocol INGetRideStatusIntentResponseObserver : NSObjectProtocol { diff --git a/iOS/Intents/INGetUserCurrentRestaurantReservationBookingsIntent.swift b/iOS/Intents/INGetUserCurrentRestaurantReservationBookingsIntent.swift index 45281fb..3188634 100644 --- a/iOS/Intents/INGetUserCurrentRestaurantReservationBookingsIntent.swift +++ b/iOS/Intents/INGetUserCurrentRestaurantReservationBookingsIntent.swift @@ -11,6 +11,9 @@ class INGetUserCurrentRestaurantReservationBookingsIntent : INIntent, NSCopying @available(iOS 10.0, *) protocol INGetUserCurrentRestaurantReservationBookingsIntentHandling : NSObjectProtocol { func handle(getUserCurrentRestaurantReservationBookings intent: INGetUserCurrentRestaurantReservationBookingsIntent, completion: @escaping (INGetUserCurrentRestaurantReservationBookingsIntentResponse) -> Void) + func handle(getUserCurrentRestaurantReservationBookings intent: INGetUserCurrentRestaurantReservationBookingsIntent) async -> INGetUserCurrentRestaurantReservationBookingsIntentResponse optional func confirm(getUserCurrentRestaurantReservationBookings intent: INGetUserCurrentRestaurantReservationBookingsIntent, completion: @escaping (INGetUserCurrentRestaurantReservationBookingsIntentResponse) -> Void) + optional func confirm(getUserCurrentRestaurantReservationBookings intent: INGetUserCurrentRestaurantReservationBookingsIntent) async -> INGetUserCurrentRestaurantReservationBookingsIntentResponse optional func resolveRestaurant(for intent: INGetUserCurrentRestaurantReservationBookingsIntent, completion: @escaping (INRestaurantResolutionResult) -> Void) + optional func resolveRestaurant(for intent: INGetUserCurrentRestaurantReservationBookingsIntent) async -> INRestaurantResolutionResult } diff --git a/iOS/Intents/INGetVisualCodeIntent.swift b/iOS/Intents/INGetVisualCodeIntent.swift index 58185e5..2b8abd8 100644 --- a/iOS/Intents/INGetVisualCodeIntent.swift +++ b/iOS/Intents/INGetVisualCodeIntent.swift @@ -7,6 +7,9 @@ class INGetVisualCodeIntent : INIntent { @available(iOS 11.0, *) protocol INGetVisualCodeIntentHandling : NSObjectProtocol { func handle(intent: INGetVisualCodeIntent, completion: @escaping (INGetVisualCodeIntentResponse) -> Void) + func handle(intent: INGetVisualCodeIntent) async -> INGetVisualCodeIntentResponse optional func confirm(intent: INGetVisualCodeIntent, completion: @escaping (INGetVisualCodeIntentResponse) -> Void) + optional func confirm(intent: INGetVisualCodeIntent) async -> INGetVisualCodeIntentResponse optional func resolveVisualCodeType(for intent: INGetVisualCodeIntent, with completion: @escaping (INVisualCodeTypeResolutionResult) -> Void) + optional func resolveVisualCodeType(for intent: INGetVisualCodeIntent) async -> INVisualCodeTypeResolutionResult } diff --git a/iOS/Intents/INInteraction.swift b/iOS/Intents/INInteraction.swift index e80e359..fbb9e5d 100644 --- a/iOS/Intents/INInteraction.swift +++ b/iOS/Intents/INInteraction.swift @@ -24,9 +24,13 @@ enum INInteractionDirection : Int { class INInteraction : NSObject, NSSecureCoding, NSCopying { init(intent: INIntent, response: INIntentResponse?) func donate(completion: ((Error?) -> Void)? = nil) + func donate() async throws class func deleteAll(completion: ((Error?) -> Void)? = nil) + class func deleteAll() async throws class func delete(with identifiers: [String], completion: ((Error?) -> Void)? = nil) + class func delete(with identifiers: [String]) async throws class func delete(with groupIdentifier: String, completion: ((Error?) -> Void)? = nil) + class func delete(with groupIdentifier: String) async throws @NSCopying var intent: INIntent { get } @NSCopying var intentResponse: INIntentResponse? { get } var intentHandlingStatus: INIntentHandlingStatus { get } diff --git a/iOS/Intents/INListCarsIntent.swift b/iOS/Intents/INListCarsIntent.swift index 11ed418..ee03fe0 100644 --- a/iOS/Intents/INListCarsIntent.swift +++ b/iOS/Intents/INListCarsIntent.swift @@ -5,5 +5,7 @@ class INListCarsIntent : INIntent { @available(iOS 14.0, *) protocol INListCarsIntentHandling : NSObjectProtocol { func handle(intent: INListCarsIntent, completion: @escaping (INListCarsIntentResponse) -> Void) + func handle(intent: INListCarsIntent) async -> INListCarsIntentResponse optional func confirm(intent: INListCarsIntent, completion: @escaping (INListCarsIntentResponse) -> Void) + optional func confirm(intent: INListCarsIntent) async -> INListCarsIntentResponse } diff --git a/iOS/Intents/INListRideOptionsIntent.swift b/iOS/Intents/INListRideOptionsIntent.swift index 4df79c1..2bc12e1 100644 --- a/iOS/Intents/INListRideOptionsIntent.swift +++ b/iOS/Intents/INListRideOptionsIntent.swift @@ -8,7 +8,11 @@ class INListRideOptionsIntent : INIntent { @available(iOS 10.0, *) protocol INListRideOptionsIntentHandling : NSObjectProtocol { func handle(intent: INListRideOptionsIntent, completion: @escaping (INListRideOptionsIntentResponse) -> Void) + func handle(intent: INListRideOptionsIntent) async -> INListRideOptionsIntentResponse optional func confirm(intent: INListRideOptionsIntent, completion: @escaping (INListRideOptionsIntentResponse) -> Void) + optional func confirm(intent: INListRideOptionsIntent) async -> INListRideOptionsIntentResponse optional func resolvePickupLocation(for intent: INListRideOptionsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolvePickupLocation(for intent: INListRideOptionsIntent) async -> INPlacemarkResolutionResult optional func resolveDropOffLocation(for intent: INListRideOptionsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveDropOffLocation(for intent: INListRideOptionsIntent) async -> INPlacemarkResolutionResult } diff --git a/iOS/Intents/INPauseWorkoutIntent.swift b/iOS/Intents/INPauseWorkoutIntent.swift index 8320007..4191333 100644 --- a/iOS/Intents/INPauseWorkoutIntent.swift +++ b/iOS/Intents/INPauseWorkoutIntent.swift @@ -7,6 +7,9 @@ class INPauseWorkoutIntent : INIntent { @available(iOS 10.0, *) protocol INPauseWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INPauseWorkoutIntent, completion: @escaping (INPauseWorkoutIntentResponse) -> Void) + func handle(intent: INPauseWorkoutIntent) async -> INPauseWorkoutIntentResponse optional func confirm(intent: INPauseWorkoutIntent, completion: @escaping (INPauseWorkoutIntentResponse) -> Void) + optional func confirm(intent: INPauseWorkoutIntent) async -> INPauseWorkoutIntentResponse optional func resolveWorkoutName(for intent: INPauseWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INPauseWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INPayBillIntent.swift b/iOS/Intents/INPayBillIntent.swift index 235213d..fbd9d1d 100644 --- a/iOS/Intents/INPayBillIntent.swift +++ b/iOS/Intents/INPayBillIntent.swift @@ -13,12 +13,21 @@ class INPayBillIntent : INIntent { @available(iOS 10.3, *) protocol INPayBillIntentHandling : NSObjectProtocol { func handle(intent: INPayBillIntent, completion: @escaping (INPayBillIntentResponse) -> Void) + func handle(intent: INPayBillIntent) async -> INPayBillIntentResponse optional func confirm(intent: INPayBillIntent, completion: @escaping (INPayBillIntentResponse) -> Void) + optional func confirm(intent: INPayBillIntent) async -> INPayBillIntentResponse optional func resolveBillPayee(for intent: INPayBillIntent, with completion: @escaping (INBillPayeeResolutionResult) -> Void) + optional func resolveBillPayee(for intent: INPayBillIntent) async -> INBillPayeeResolutionResult optional func resolveFromAccount(for intent: INPayBillIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveFromAccount(for intent: INPayBillIntent) async -> INPaymentAccountResolutionResult optional func resolveTransactionAmount(for intent: INPayBillIntent, with completion: @escaping (INPaymentAmountResolutionResult) -> Void) + optional func resolveTransactionAmount(for intent: INPayBillIntent) async -> INPaymentAmountResolutionResult optional func resolveTransactionScheduledDate(for intent: INPayBillIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveTransactionScheduledDate(for intent: INPayBillIntent) async -> INDateComponentsRangeResolutionResult optional func resolveTransactionNote(for intent: INPayBillIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveTransactionNote(for intent: INPayBillIntent) async -> INStringResolutionResult optional func resolveBillType(for intent: INPayBillIntent, with completion: @escaping (INBillTypeResolutionResult) -> Void) + optional func resolveBillType(for intent: INPayBillIntent) async -> INBillTypeResolutionResult optional func resolveDueDate(for intent: INPayBillIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDueDate(for intent: INPayBillIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/iOS/Intents/INPlayMediaIntent.swift b/iOS/Intents/INPlayMediaIntent.swift index 3426012..9c2f066 100644 --- a/iOS/Intents/INPlayMediaIntent.swift +++ b/iOS/Intents/INPlayMediaIntent.swift @@ -33,17 +33,31 @@ extension INPlayMediaIntent { @available(iOS 12.0, *) protocol INPlayMediaIntentHandling : NSObjectProtocol { func handle(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + func handle(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse optional func confirm(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + optional func confirm(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse @available(iOS 13.0, *) optional func resolveMediaItems(for intent: INPlayMediaIntent, with completion: @escaping ([INPlayMediaMediaItemResolutionResult]) -> Void) @available(iOS 13.0, *) + optional func resolveMediaItems(for intent: INPlayMediaIntent) async -> [INPlayMediaMediaItemResolutionResult] + @available(iOS 13.0, *) optional func resolvePlayShuffled(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolvePlayShuffled(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(iOS 13.0, *) optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackRepeatModeResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent) async -> INPlaybackRepeatModeResolutionResult + @available(iOS 13.0, *) optional func resolveResumePlayback(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolveResumePlayback(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(iOS 13.0, *) optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackQueueLocationResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent) async -> INPlaybackQueueLocationResolutionResult + @available(iOS 13.0, *) optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent, with completion: @escaping (INPlayMediaPlaybackSpeedResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent) async -> INPlayMediaPlaybackSpeedResolutionResult } diff --git a/iOS/Intents/INRelevantShortcutStore.swift b/iOS/Intents/INRelevantShortcutStore.swift index cccd44d..d12cded 100644 --- a/iOS/Intents/INRelevantShortcutStore.swift +++ b/iOS/Intents/INRelevantShortcutStore.swift @@ -3,4 +3,5 @@ class INRelevantShortcutStore : NSObject { class var `default`: INRelevantShortcutStore { get } func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut], completionHandler: ((Error?) -> Void)? = nil) + func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut]) async throws } diff --git a/iOS/Intents/INRequestPaymentIntent.swift b/iOS/Intents/INRequestPaymentIntent.swift index 863e65b..d2c891e 100644 --- a/iOS/Intents/INRequestPaymentIntent.swift +++ b/iOS/Intents/INRequestPaymentIntent.swift @@ -9,14 +9,25 @@ class INRequestPaymentIntent : INIntent { @available(iOS 10.0, *) protocol INRequestPaymentIntentHandling : NSObjectProtocol { func handle(intent: INRequestPaymentIntent, completion: @escaping (INRequestPaymentIntentResponse) -> Void) + func handle(intent: INRequestPaymentIntent) async -> INRequestPaymentIntentResponse optional func confirm(intent: INRequestPaymentIntent, completion: @escaping (INRequestPaymentIntentResponse) -> Void) + optional func confirm(intent: INRequestPaymentIntent) async -> INRequestPaymentIntentResponse @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolvePayerForRequestPayment:withCompletion: is deprecated. Use resolvePayerForRequestPayment:completion: instead") optional func resolvePayer(for intent: INRequestPaymentIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolvePayerForRequestPayment:withCompletion: is deprecated. Use resolvePayerForRequestPayment:completion: instead") + optional func resolvePayer(for intent: INRequestPaymentIntent) async -> INPersonResolutionResult @available(iOS 11.0, *) optional func resolvePayer(for intent: INRequestPaymentIntent, with completion: @escaping (INRequestPaymentPayerResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolvePayer(for intent: INRequestPaymentIntent) async -> INRequestPaymentPayerResolutionResult @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCurrencyAmountForRequestPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForRequestPayment:completion: instead") optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCurrencyAmountForRequestPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForRequestPayment:completion: instead") + optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent) async -> INCurrencyAmountResolutionResult @available(iOS 11.0, *) optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent, with completion: @escaping (INRequestPaymentCurrencyAmountResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent) async -> INRequestPaymentCurrencyAmountResolutionResult optional func resolveNote(for intent: INRequestPaymentIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveNote(for intent: INRequestPaymentIntent) async -> INStringResolutionResult } diff --git a/iOS/Intents/INRequestRideIntent.swift b/iOS/Intents/INRequestRideIntent.swift index 3393a5b..dc054ad 100644 --- a/iOS/Intents/INRequestRideIntent.swift +++ b/iOS/Intents/INRequestRideIntent.swift @@ -22,11 +22,19 @@ extension INRequestRideIntent { @available(iOS 10.0, *) protocol INRequestRideIntentHandling : NSObjectProtocol { func handle(intent: INRequestRideIntent, completion: @escaping (INRequestRideIntentResponse) -> Void) + func handle(intent: INRequestRideIntent) async -> INRequestRideIntentResponse optional func confirm(intent: INRequestRideIntent, completion: @escaping (INRequestRideIntentResponse) -> Void) + optional func confirm(intent: INRequestRideIntent) async -> INRequestRideIntentResponse optional func resolvePickupLocation(for intent: INRequestRideIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolvePickupLocation(for intent: INRequestRideIntent) async -> INPlacemarkResolutionResult optional func resolveDropOffLocation(for intent: INRequestRideIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveDropOffLocation(for intent: INRequestRideIntent) async -> INPlacemarkResolutionResult optional func resolveRideOptionName(for intent: INRequestRideIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveRideOptionName(for intent: INRequestRideIntent) async -> INSpeakableStringResolutionResult optional func resolvePartySize(for intent: INRequestRideIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolvePartySize(for intent: INRequestRideIntent) async -> INIntegerResolutionResult @available(iOS 10.3, *) optional func resolveScheduledPickupTime(for intent: INRequestRideIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + @available(iOS 10.3, *) + optional func resolveScheduledPickupTime(for intent: INRequestRideIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/iOS/Intents/INResumeWorkoutIntent.swift b/iOS/Intents/INResumeWorkoutIntent.swift index 803652c..8c3ee7a 100644 --- a/iOS/Intents/INResumeWorkoutIntent.swift +++ b/iOS/Intents/INResumeWorkoutIntent.swift @@ -7,6 +7,9 @@ class INResumeWorkoutIntent : INIntent { @available(iOS 10.0, *) protocol INResumeWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INResumeWorkoutIntent, completion: @escaping (INResumeWorkoutIntentResponse) -> Void) + func handle(intent: INResumeWorkoutIntent) async -> INResumeWorkoutIntentResponse optional func confirm(intent: INResumeWorkoutIntent, completion: @escaping (INResumeWorkoutIntentResponse) -> Void) + optional func confirm(intent: INResumeWorkoutIntent) async -> INResumeWorkoutIntentResponse optional func resolveWorkoutName(for intent: INResumeWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INResumeWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSaveProfileInCarIntent.swift b/iOS/Intents/INSaveProfileInCarIntent.swift index d5a5a58..498113c 100644 --- a/iOS/Intents/INSaveProfileInCarIntent.swift +++ b/iOS/Intents/INSaveProfileInCarIntent.swift @@ -18,8 +18,13 @@ extension INSaveProfileInCarIntent { @available(iOS 10.0, *) protocol INSaveProfileInCarIntentHandling : NSObjectProtocol { func handle(intent: INSaveProfileInCarIntent, completion: @escaping (INSaveProfileInCarIntentResponse) -> Void) + func handle(intent: INSaveProfileInCarIntent) async -> INSaveProfileInCarIntentResponse optional func confirm(intent: INSaveProfileInCarIntent, completion: @escaping (INSaveProfileInCarIntentResponse) -> Void) + optional func confirm(intent: INSaveProfileInCarIntent) async -> INSaveProfileInCarIntentResponse optional func resolveProfileNumber(for intent: INSaveProfileInCarIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolveProfileNumber(for intent: INSaveProfileInCarIntent) async -> INIntegerResolutionResult @available(iOS 10.2, *) optional func resolveProfileName(for intent: INSaveProfileInCarIntent, with completion: @escaping (INStringResolutionResult) -> Void) + @available(iOS 10.2, *) + optional func resolveProfileName(for intent: INSaveProfileInCarIntent) async -> INStringResolutionResult } diff --git a/iOS/Intents/INSearchCallHistoryIntent.swift b/iOS/Intents/INSearchCallHistoryIntent.swift index f63d01a..41cf19c 100644 --- a/iOS/Intents/INSearchCallHistoryIntent.swift +++ b/iOS/Intents/INSearchCallHistoryIntent.swift @@ -24,13 +24,23 @@ extension INSearchCallHistoryIntent { @available(iOS 10.0, *) protocol INSearchCallHistoryIntentHandling : NSObjectProtocol { func handle(intent: INSearchCallHistoryIntent, completion: @escaping (INSearchCallHistoryIntentResponse) -> Void) + func handle(intent: INSearchCallHistoryIntent) async -> INSearchCallHistoryIntentResponse optional func confirm(intent: INSearchCallHistoryIntent, completion: @escaping (INSearchCallHistoryIntentResponse) -> Void) + optional func confirm(intent: INSearchCallHistoryIntent) async -> INSearchCallHistoryIntentResponse @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCallTypeForSearchCallHistory:withCompletion: is deprecated. Use resolveCallTypesForSearchCallHistory:withCompletion: instead") optional func resolveCallType(for intent: INSearchCallHistoryIntent, with completion: @escaping (INCallRecordTypeResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCallTypeForSearchCallHistory:withCompletion: is deprecated. Use resolveCallTypesForSearchCallHistory:withCompletion: instead") + optional func resolveCallType(for intent: INSearchCallHistoryIntent) async -> INCallRecordTypeResolutionResult optional func resolveDateCreated(for intent: INSearchCallHistoryIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INSearchCallHistoryIntent) async -> INDateComponentsRangeResolutionResult optional func resolveRecipient(for intent: INSearchCallHistoryIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + optional func resolveRecipient(for intent: INSearchCallHistoryIntent) async -> INPersonResolutionResult @available(iOS 11.0, *) optional func resolveCallTypes(for intent: INSearchCallHistoryIntent, with completion: @escaping (INCallRecordTypeOptionsResolutionResult) -> Void) @available(iOS 11.0, *) + optional func resolveCallTypes(for intent: INSearchCallHistoryIntent) async -> INCallRecordTypeOptionsResolutionResult + @available(iOS 11.0, *) optional func resolveUnseen(for intent: INSearchCallHistoryIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolveUnseen(for intent: INSearchCallHistoryIntent) async -> INBooleanResolutionResult } diff --git a/iOS/Intents/INSearchForAccountsIntent.swift b/iOS/Intents/INSearchForAccountsIntent.swift index c38e6c5..d21df2e 100644 --- a/iOS/Intents/INSearchForAccountsIntent.swift +++ b/iOS/Intents/INSearchForAccountsIntent.swift @@ -10,9 +10,15 @@ class INSearchForAccountsIntent : INIntent { @available(iOS 11.0, *) protocol INSearchForAccountsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForAccountsIntent, completion: @escaping (INSearchForAccountsIntentResponse) -> Void) + func handle(intent: INSearchForAccountsIntent) async -> INSearchForAccountsIntentResponse optional func confirm(intent: INSearchForAccountsIntent, completion: @escaping (INSearchForAccountsIntentResponse) -> Void) + optional func confirm(intent: INSearchForAccountsIntent) async -> INSearchForAccountsIntentResponse optional func resolveAccountNickname(for intent: INSearchForAccountsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveAccountNickname(for intent: INSearchForAccountsIntent) async -> INSpeakableStringResolutionResult optional func resolveAccountType(for intent: INSearchForAccountsIntent, with completion: @escaping (INAccountTypeResolutionResult) -> Void) + optional func resolveAccountType(for intent: INSearchForAccountsIntent) async -> INAccountTypeResolutionResult optional func resolveOrganizationName(for intent: INSearchForAccountsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveOrganizationName(for intent: INSearchForAccountsIntent) async -> INSpeakableStringResolutionResult optional func resolveRequestedBalanceType(for intent: INSearchForAccountsIntent, with completion: @escaping (INBalanceTypeResolutionResult) -> Void) + optional func resolveRequestedBalanceType(for intent: INSearchForAccountsIntent) async -> INBalanceTypeResolutionResult } diff --git a/iOS/Intents/INSearchForBillsIntent.swift b/iOS/Intents/INSearchForBillsIntent.swift index a4269cb..8ca2d45 100644 --- a/iOS/Intents/INSearchForBillsIntent.swift +++ b/iOS/Intents/INSearchForBillsIntent.swift @@ -11,10 +11,17 @@ class INSearchForBillsIntent : INIntent { @available(iOS 10.3, *) protocol INSearchForBillsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForBillsIntent, completion: @escaping (INSearchForBillsIntentResponse) -> Void) + func handle(intent: INSearchForBillsIntent) async -> INSearchForBillsIntentResponse optional func confirm(intent: INSearchForBillsIntent, completion: @escaping (INSearchForBillsIntentResponse) -> Void) + optional func confirm(intent: INSearchForBillsIntent) async -> INSearchForBillsIntentResponse optional func resolveBillPayee(for intent: INSearchForBillsIntent, with completion: @escaping (INBillPayeeResolutionResult) -> Void) + optional func resolveBillPayee(for intent: INSearchForBillsIntent) async -> INBillPayeeResolutionResult optional func resolvePaymentDateRange(for intent: INSearchForBillsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolvePaymentDateRange(for intent: INSearchForBillsIntent) async -> INDateComponentsRangeResolutionResult optional func resolveBillType(for intent: INSearchForBillsIntent, with completion: @escaping (INBillTypeResolutionResult) -> Void) + optional func resolveBillType(for intent: INSearchForBillsIntent) async -> INBillTypeResolutionResult optional func resolveStatus(for intent: INSearchForBillsIntent, with completion: @escaping (INPaymentStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSearchForBillsIntent) async -> INPaymentStatusResolutionResult optional func resolveDueDateRange(for intent: INSearchForBillsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDueDateRange(for intent: INSearchForBillsIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/iOS/Intents/INSearchForMediaIntent.swift b/iOS/Intents/INSearchForMediaIntent.swift index 753d2b8..365b44f 100644 --- a/iOS/Intents/INSearchForMediaIntent.swift +++ b/iOS/Intents/INSearchForMediaIntent.swift @@ -8,6 +8,9 @@ class INSearchForMediaIntent : INIntent { @available(iOS 13.0, *) protocol INSearchForMediaIntentHandling : NSObjectProtocol { func handle(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + func handle(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func confirm(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + optional func confirm(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func resolveMediaItems(for intent: INSearchForMediaIntent, with completion: @escaping ([INSearchForMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INSearchForMediaIntent) async -> [INSearchForMediaMediaItemResolutionResult] } diff --git a/iOS/Intents/INSearchForMessagesIntent.swift b/iOS/Intents/INSearchForMessagesIntent.swift index c2ef3ff..fb76f18 100644 --- a/iOS/Intents/INSearchForMessagesIntent.swift +++ b/iOS/Intents/INSearchForMessagesIntent.swift @@ -27,13 +27,23 @@ class INSearchForMessagesIntent : INIntent { @available(iOS 10.0, *) protocol INSearchForMessagesIntentHandling : NSObjectProtocol { func handle(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) + func handle(intent: INSearchForMessagesIntent) async -> INSearchForMessagesIntentResponse optional func confirm(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) + optional func confirm(intent: INSearchForMessagesIntent) async -> INSearchForMessagesIntentResponse optional func resolveRecipients(for intent: INSearchForMessagesIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveRecipients(for intent: INSearchForMessagesIntent) async -> [INPersonResolutionResult] optional func resolveSenders(for intent: INSearchForMessagesIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveSenders(for intent: INSearchForMessagesIntent) async -> [INPersonResolutionResult] optional func resolveAttributes(for intent: INSearchForMessagesIntent, with completion: @escaping (INMessageAttributeOptionsResolutionResult) -> Void) + optional func resolveAttributes(for intent: INSearchForMessagesIntent) async -> INMessageAttributeOptionsResolutionResult optional func resolveDateTimeRange(for intent: INSearchForMessagesIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateTimeRange(for intent: INSearchForMessagesIntent) async -> INDateComponentsRangeResolutionResult @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveGroupNamesForSearchForMessages:withCompletion: is deprecated. Use resolveSpeakableGroupNamesForSearchForMessages:withCompletion: instead") optional func resolveGroupNames(for intent: INSearchForMessagesIntent, with completion: @escaping ([INStringResolutionResult]) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveGroupNamesForSearchForMessages:withCompletion: is deprecated. Use resolveSpeakableGroupNamesForSearchForMessages:withCompletion: instead") + optional func resolveGroupNames(for intent: INSearchForMessagesIntent) async -> [INStringResolutionResult] @available(iOS 11.0, *) optional func resolveSpeakableGroupNames(for intent: INSearchForMessagesIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + @available(iOS 11.0, *) + optional func resolveSpeakableGroupNames(for intent: INSearchForMessagesIntent) async -> [INSpeakableStringResolutionResult] } diff --git a/iOS/Intents/INSearchForNotebookItemsIntent.swift b/iOS/Intents/INSearchForNotebookItemsIntent.swift index 5d30ed7..143637f 100644 --- a/iOS/Intents/INSearchForNotebookItemsIntent.swift +++ b/iOS/Intents/INSearchForNotebookItemsIntent.swift @@ -21,17 +21,31 @@ class INSearchForNotebookItemsIntent : INIntent { @available(iOS 11.0, *) protocol INSearchForNotebookItemsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForNotebookItemsIntent, completion: @escaping (INSearchForNotebookItemsIntentResponse) -> Void) + func handle(intent: INSearchForNotebookItemsIntent) async -> INSearchForNotebookItemsIntentResponse optional func confirm(intent: INSearchForNotebookItemsIntent, completion: @escaping (INSearchForNotebookItemsIntentResponse) -> Void) + optional func confirm(intent: INSearchForNotebookItemsIntent) async -> INSearchForNotebookItemsIntentResponse optional func resolveTitle(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INSearchForNotebookItemsIntent) async -> INSpeakableStringResolutionResult optional func resolveContent(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveContent(for intent: INSearchForNotebookItemsIntent) async -> INStringResolutionResult optional func resolveItemType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INNotebookItemTypeResolutionResult) -> Void) + optional func resolveItemType(for intent: INSearchForNotebookItemsIntent) async -> INNotebookItemTypeResolutionResult optional func resolveStatus(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTaskStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSearchForNotebookItemsIntent) async -> INTaskStatusResolutionResult optional func resolveLocation(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocation(for intent: INSearchForNotebookItemsIntent) async -> INPlacemarkResolutionResult optional func resolveLocationSearchType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INLocationSearchTypeResolutionResult) -> Void) + optional func resolveLocationSearchType(for intent: INSearchForNotebookItemsIntent) async -> INLocationSearchTypeResolutionResult optional func resolveDateTime(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateTime(for intent: INSearchForNotebookItemsIntent) async -> INDateComponentsRangeResolutionResult optional func resolveDateSearchType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INDateSearchTypeResolutionResult) -> Void) + optional func resolveDateSearchType(for intent: INSearchForNotebookItemsIntent) async -> INDateSearchTypeResolutionResult @available(iOS 13.0, *) optional func resolveTemporalEventTriggerTypes(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTemporalEventTriggerTypeOptionsResolutionResult) -> Void) @available(iOS 13.0, *) + optional func resolveTemporalEventTriggerTypes(for intent: INSearchForNotebookItemsIntent) async -> INTemporalEventTriggerTypeOptionsResolutionResult + @available(iOS 13.0, *) optional func resolveTaskPriority(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolveTaskPriority(for intent: INSearchForNotebookItemsIntent) async -> INTaskPriorityResolutionResult } diff --git a/iOS/Intents/INSearchForPhotosIntent.swift b/iOS/Intents/INSearchForPhotosIntent.swift index 30d9f56..f08efa0 100644 --- a/iOS/Intents/INSearchForPhotosIntent.swift +++ b/iOS/Intents/INSearchForPhotosIntent.swift @@ -15,11 +15,19 @@ class INSearchForPhotosIntent : INIntent { @available(iOS 10.0, *) protocol INSearchForPhotosIntentHandling : NSObjectProtocol { func handle(intent: INSearchForPhotosIntent, completion: @escaping (INSearchForPhotosIntentResponse) -> Void) + func handle(intent: INSearchForPhotosIntent) async -> INSearchForPhotosIntentResponse optional func confirm(intent: INSearchForPhotosIntent, completion: @escaping (INSearchForPhotosIntentResponse) -> Void) + optional func confirm(intent: INSearchForPhotosIntent) async -> INSearchForPhotosIntentResponse optional func resolveDateCreated(for intent: INSearchForPhotosIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INSearchForPhotosIntent) async -> INDateComponentsRangeResolutionResult optional func resolveLocationCreated(for intent: INSearchForPhotosIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocationCreated(for intent: INSearchForPhotosIntent) async -> INPlacemarkResolutionResult optional func resolveAlbumName(for intent: INSearchForPhotosIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveAlbumName(for intent: INSearchForPhotosIntent) async -> INStringResolutionResult @available(iOS 11.0, *) optional func resolveSearchTerms(for intent: INSearchForPhotosIntent, with completion: @escaping ([INStringResolutionResult]) -> Void) + @available(iOS 11.0, *) + optional func resolveSearchTerms(for intent: INSearchForPhotosIntent) async -> [INStringResolutionResult] optional func resolvePeopleInPhoto(for intent: INSearchForPhotosIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolvePeopleInPhoto(for intent: INSearchForPhotosIntent) async -> [INPersonResolutionResult] } diff --git a/iOS/Intents/INSendMessageIntent.swift b/iOS/Intents/INSendMessageIntent.swift index 315809f..4c43a12 100644 --- a/iOS/Intents/INSendMessageIntent.swift +++ b/iOS/Intents/INSendMessageIntent.swift @@ -19,16 +19,29 @@ class INSendMessageIntent : INIntent { @available(iOS 10.0, *) protocol INSendMessageIntentHandling : NSObjectProtocol { func handle(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) + func handle(intent: INSendMessageIntent) async -> INSendMessageIntentResponse optional func confirm(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) + optional func confirm(intent: INSendMessageIntent) async -> INSendMessageIntentResponse @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveRecipientsForSendMessage:withCompletion: is deprecated. Use resolveRecipientsForSendMessage:completion: instead") optional func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveRecipientsForSendMessage:withCompletion: is deprecated. Use resolveRecipientsForSendMessage:completion: instead") + optional func resolveRecipients(for intent: INSendMessageIntent) async -> [INPersonResolutionResult] @available(iOS 11.0, *) optional func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INSendMessageRecipientResolutionResult]) -> Void) + @available(iOS 11.0, *) + optional func resolveRecipients(for intent: INSendMessageIntent) async -> [INSendMessageRecipientResolutionResult] @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveGroupNameForSendMessage:withCompletion: is deprecated. Use resolveSpeakableGroupNameForSendMessage:withCompletion: instead") optional func resolveGroupName(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveGroupNameForSendMessage:withCompletion: is deprecated. Use resolveSpeakableGroupNameForSendMessage:withCompletion: instead") + optional func resolveGroupName(for intent: INSendMessageIntent) async -> INStringResolutionResult @available(iOS 14.0, *) optional func resolveOutgoingMessageType(for intent: INSendMessageIntent, with completion: @escaping (INOutgoingMessageTypeResolutionResult) -> Void) + @available(iOS 14.0, *) + optional func resolveOutgoingMessageType(for intent: INSendMessageIntent) async -> INOutgoingMessageTypeResolutionResult optional func resolveContent(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveContent(for intent: INSendMessageIntent) async -> INStringResolutionResult @available(iOS 11.0, *) optional func resolveSpeakableGroupName(for intent: INSendMessageIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolveSpeakableGroupName(for intent: INSendMessageIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSendPaymentIntent.swift b/iOS/Intents/INSendPaymentIntent.swift index 6ff3a13..9428869 100644 --- a/iOS/Intents/INSendPaymentIntent.swift +++ b/iOS/Intents/INSendPaymentIntent.swift @@ -9,14 +9,25 @@ class INSendPaymentIntent : INIntent { @available(iOS 10.0, *) protocol INSendPaymentIntentHandling : NSObjectProtocol { func handle(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) + func handle(intent: INSendPaymentIntent) async -> INSendPaymentIntentResponse optional func confirm(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) + optional func confirm(intent: INSendPaymentIntent) async -> INSendPaymentIntentResponse @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolvePayeeForSendPayment:withCompletion: is deprecated. Use resolvePayeeForSendPayment:completion: instead") optional func resolvePayee(for intent: INSendPaymentIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolvePayeeForSendPayment:withCompletion: is deprecated. Use resolvePayeeForSendPayment:completion: instead") + optional func resolvePayee(for intent: INSendPaymentIntent) async -> INPersonResolutionResult @available(iOS 11.0, *) optional func resolvePayee(for intent: INSendPaymentIntent, with completion: @escaping (INSendPaymentPayeeResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolvePayee(for intent: INSendPaymentIntent) async -> INSendPaymentPayeeResolutionResult @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCurrencyAmountForSendPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForSendPayment:completion: instead") optional func resolveCurrencyAmount(for intent: INSendPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "resolveCurrencyAmountForSendPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForSendPayment:completion: instead") + optional func resolveCurrencyAmount(for intent: INSendPaymentIntent) async -> INCurrencyAmountResolutionResult @available(iOS 11.0, *) optional func resolveCurrencyAmount(for intent: INSendPaymentIntent, with completion: @escaping (INSendPaymentCurrencyAmountResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolveCurrencyAmount(for intent: INSendPaymentIntent) async -> INSendPaymentCurrencyAmountResolutionResult optional func resolveNote(for intent: INSendPaymentIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveNote(for intent: INSendPaymentIntent) async -> INStringResolutionResult } diff --git a/iOS/Intents/INSendRideFeedbackIntent.swift b/iOS/Intents/INSendRideFeedbackIntent.swift index cb723ee..9728120 100644 --- a/iOS/Intents/INSendRideFeedbackIntent.swift +++ b/iOS/Intents/INSendRideFeedbackIntent.swift @@ -9,5 +9,7 @@ class INSendRideFeedbackIntent : INIntent { @available(iOS 11.0, *) protocol INSendRideFeedbackIntentHandling : NSObjectProtocol { func handle(sendRideFeedback sendRideFeedbackintent: INSendRideFeedbackIntent, completion: @escaping (INSendRideFeedbackIntentResponse) -> Void) + func handle(sendRideFeedback sendRideFeedbackintent: INSendRideFeedbackIntent) async -> INSendRideFeedbackIntentResponse optional func confirm(sendRideFeedback sendRideFeedbackIntent: INSendRideFeedbackIntent, completion: @escaping (INSendRideFeedbackIntentResponse) -> Void) + optional func confirm(sendRideFeedback sendRideFeedbackIntent: INSendRideFeedbackIntent) async -> INSendRideFeedbackIntentResponse } diff --git a/iOS/Intents/INSetAudioSourceInCarIntent.swift b/iOS/Intents/INSetAudioSourceInCarIntent.swift index f9eb586..52a1b15 100644 --- a/iOS/Intents/INSetAudioSourceInCarIntent.swift +++ b/iOS/Intents/INSetAudioSourceInCarIntent.swift @@ -8,7 +8,11 @@ class INSetAudioSourceInCarIntent : INIntent { @available(iOS 10.0, *) protocol INSetAudioSourceInCarIntentHandling : NSObjectProtocol { func handle(intent: INSetAudioSourceInCarIntent, completion: @escaping (INSetAudioSourceInCarIntentResponse) -> Void) + func handle(intent: INSetAudioSourceInCarIntent) async -> INSetAudioSourceInCarIntentResponse optional func confirm(intent: INSetAudioSourceInCarIntent, completion: @escaping (INSetAudioSourceInCarIntentResponse) -> Void) + optional func confirm(intent: INSetAudioSourceInCarIntent) async -> INSetAudioSourceInCarIntentResponse optional func resolveAudioSource(for intent: INSetAudioSourceInCarIntent, with completion: @escaping (INCarAudioSourceResolutionResult) -> Void) + optional func resolveAudioSource(for intent: INSetAudioSourceInCarIntent) async -> INCarAudioSourceResolutionResult optional func resolveRelativeAudioSourceReference(for intent: INSetAudioSourceInCarIntent, with completion: @escaping (INRelativeReferenceResolutionResult) -> Void) + optional func resolveRelativeAudioSourceReference(for intent: INSetAudioSourceInCarIntent) async -> INRelativeReferenceResolutionResult } diff --git a/iOS/Intents/INSetCarLockStatusIntent.swift b/iOS/Intents/INSetCarLockStatusIntent.swift index 9f2589b..d810645 100644 --- a/iOS/Intents/INSetCarLockStatusIntent.swift +++ b/iOS/Intents/INSetCarLockStatusIntent.swift @@ -16,7 +16,11 @@ extension INSetCarLockStatusIntent { @available(iOS 10.3, *) protocol INSetCarLockStatusIntentHandling : NSObjectProtocol { func handle(intent: INSetCarLockStatusIntent, completion: @escaping (INSetCarLockStatusIntentResponse) -> Void) + func handle(intent: INSetCarLockStatusIntent) async -> INSetCarLockStatusIntentResponse optional func confirm(intent: INSetCarLockStatusIntent, completion: @escaping (INSetCarLockStatusIntentResponse) -> Void) + optional func confirm(intent: INSetCarLockStatusIntent) async -> INSetCarLockStatusIntentResponse optional func resolveLocked(for intent: INSetCarLockStatusIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveLocked(for intent: INSetCarLockStatusIntent) async -> INBooleanResolutionResult optional func resolveCarName(for intent: INSetCarLockStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INSetCarLockStatusIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSetClimateSettingsInCarIntent.swift b/iOS/Intents/INSetClimateSettingsInCarIntent.swift index aee14c3..f3c4d16 100644 --- a/iOS/Intents/INSetClimateSettingsInCarIntent.swift +++ b/iOS/Intents/INSetClimateSettingsInCarIntent.swift @@ -36,18 +36,33 @@ extension INSetClimateSettingsInCarIntent { @available(iOS 10.0, *) protocol INSetClimateSettingsInCarIntentHandling : NSObjectProtocol { func handle(intent: INSetClimateSettingsInCarIntent, completion: @escaping (INSetClimateSettingsInCarIntentResponse) -> Void) + func handle(intent: INSetClimateSettingsInCarIntent) async -> INSetClimateSettingsInCarIntentResponse optional func confirm(intent: INSetClimateSettingsInCarIntent, completion: @escaping (INSetClimateSettingsInCarIntentResponse) -> Void) + optional func confirm(intent: INSetClimateSettingsInCarIntent) async -> INSetClimateSettingsInCarIntentResponse optional func resolveEnableFan(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableFan(for intent: INSetClimateSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveEnableAirConditioner(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableAirConditioner(for intent: INSetClimateSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveEnableClimateControl(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableClimateControl(for intent: INSetClimateSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveEnableAutoMode(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableAutoMode(for intent: INSetClimateSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveAirCirculationMode(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INCarAirCirculationModeResolutionResult) -> Void) + optional func resolveAirCirculationMode(for intent: INSetClimateSettingsInCarIntent) async -> INCarAirCirculationModeResolutionResult optional func resolveFanSpeedIndex(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolveFanSpeedIndex(for intent: INSetClimateSettingsInCarIntent) async -> INIntegerResolutionResult optional func resolveFanSpeedPercentage(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INDoubleResolutionResult) -> Void) + optional func resolveFanSpeedPercentage(for intent: INSetClimateSettingsInCarIntent) async -> INDoubleResolutionResult optional func resolveRelativeFanSpeedSetting(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INRelativeSettingResolutionResult) -> Void) + optional func resolveRelativeFanSpeedSetting(for intent: INSetClimateSettingsInCarIntent) async -> INRelativeSettingResolutionResult optional func resolveTemperature(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INTemperatureResolutionResult) -> Void) + optional func resolveTemperature(for intent: INSetClimateSettingsInCarIntent) async -> INTemperatureResolutionResult optional func resolveRelativeTemperatureSetting(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INRelativeSettingResolutionResult) -> Void) + optional func resolveRelativeTemperatureSetting(for intent: INSetClimateSettingsInCarIntent) async -> INRelativeSettingResolutionResult optional func resolveClimateZone(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INCarSeatResolutionResult) -> Void) + optional func resolveClimateZone(for intent: INSetClimateSettingsInCarIntent) async -> INCarSeatResolutionResult @available(iOS 12.0, *) optional func resolveCarName(for intent: INSetClimateSettingsInCarIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 12.0, *) + optional func resolveCarName(for intent: INSetClimateSettingsInCarIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSetDefrosterSettingsInCarIntent.swift b/iOS/Intents/INSetDefrosterSettingsInCarIntent.swift index fe43893..274eb5b 100644 --- a/iOS/Intents/INSetDefrosterSettingsInCarIntent.swift +++ b/iOS/Intents/INSetDefrosterSettingsInCarIntent.swift @@ -22,9 +22,15 @@ extension INSetDefrosterSettingsInCarIntent { @available(iOS 10.0, *) protocol INSetDefrosterSettingsInCarIntentHandling : NSObjectProtocol { func handle(intent: INSetDefrosterSettingsInCarIntent, completion: @escaping (INSetDefrosterSettingsInCarIntentResponse) -> Void) + func handle(intent: INSetDefrosterSettingsInCarIntent) async -> INSetDefrosterSettingsInCarIntentResponse optional func confirm(intent: INSetDefrosterSettingsInCarIntent, completion: @escaping (INSetDefrosterSettingsInCarIntentResponse) -> Void) + optional func confirm(intent: INSetDefrosterSettingsInCarIntent) async -> INSetDefrosterSettingsInCarIntentResponse optional func resolveEnable(for intent: INSetDefrosterSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnable(for intent: INSetDefrosterSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveDefroster(for intent: INSetDefrosterSettingsInCarIntent, with completion: @escaping (INCarDefrosterResolutionResult) -> Void) + optional func resolveDefroster(for intent: INSetDefrosterSettingsInCarIntent) async -> INCarDefrosterResolutionResult @available(iOS 12.0, *) optional func resolveCarName(for intent: INSetDefrosterSettingsInCarIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 12.0, *) + optional func resolveCarName(for intent: INSetDefrosterSettingsInCarIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSetMessageAttributeIntent.swift b/iOS/Intents/INSetMessageAttributeIntent.swift index c860495..01d925b 100644 --- a/iOS/Intents/INSetMessageAttributeIntent.swift +++ b/iOS/Intents/INSetMessageAttributeIntent.swift @@ -8,6 +8,9 @@ class INSetMessageAttributeIntent : INIntent { @available(iOS 10.0, *) protocol INSetMessageAttributeIntentHandling : NSObjectProtocol { func handle(intent: INSetMessageAttributeIntent, completion: @escaping (INSetMessageAttributeIntentResponse) -> Void) + func handle(intent: INSetMessageAttributeIntent) async -> INSetMessageAttributeIntentResponse optional func confirm(intent: INSetMessageAttributeIntent, completion: @escaping (INSetMessageAttributeIntentResponse) -> Void) + optional func confirm(intent: INSetMessageAttributeIntent) async -> INSetMessageAttributeIntentResponse optional func resolveAttribute(for intent: INSetMessageAttributeIntent, with completion: @escaping (INMessageAttributeResolutionResult) -> Void) + optional func resolveAttribute(for intent: INSetMessageAttributeIntent) async -> INMessageAttributeResolutionResult } diff --git a/iOS/Intents/INSetProfileInCarIntent.swift b/iOS/Intents/INSetProfileInCarIntent.swift index fe306e0..48633c5 100644 --- a/iOS/Intents/INSetProfileInCarIntent.swift +++ b/iOS/Intents/INSetProfileInCarIntent.swift @@ -47,12 +47,21 @@ class INSetProfileInCarIntent : INIntent { @available(iOS 10.0, *) protocol INSetProfileInCarIntentHandling : NSObjectProtocol { func handle(intent: INSetProfileInCarIntent, completion: @escaping (INSetProfileInCarIntentResponse) -> Void) + func handle(intent: INSetProfileInCarIntent) async -> INSetProfileInCarIntentResponse optional func confirm(intent: INSetProfileInCarIntent, completion: @escaping (INSetProfileInCarIntentResponse) -> Void) + optional func confirm(intent: INSetProfileInCarIntent) async -> INSetProfileInCarIntentResponse optional func resolveProfileNumber(for intent: INSetProfileInCarIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolveProfileNumber(for intent: INSetProfileInCarIntent) async -> INIntegerResolutionResult @available(iOS 10.2, *) optional func resolveProfileName(for intent: INSetProfileInCarIntent, with completion: @escaping (INStringResolutionResult) -> Void) + @available(iOS 10.2, *) + optional func resolveProfileName(for intent: INSetProfileInCarIntent) async -> INStringResolutionResult @available(iOS 12.0, *) optional func resolveCarName(for intent: INSetProfileInCarIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 12.0, *) + optional func resolveCarName(for intent: INSetProfileInCarIntent) async -> INSpeakableStringResolutionResult @available(iOS, introduced: 10.0, deprecated: 11.0, message: "The property doesn't need to be resolved") optional func resolveDefaultProfile(forSetProfileInCar intent: INSetProfileInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "The property doesn't need to be resolved") + optional func resolveDefaultProfile(forSetProfileInCar intent: INSetProfileInCarIntent) async -> INBooleanResolutionResult } diff --git a/iOS/Intents/INSetRadioStationIntent.swift b/iOS/Intents/INSetRadioStationIntent.swift index 91f4194..6371329 100644 --- a/iOS/Intents/INSetRadioStationIntent.swift +++ b/iOS/Intents/INSetRadioStationIntent.swift @@ -20,10 +20,17 @@ extension INSetRadioStationIntent { @available(iOS 10.0, *) protocol INSetRadioStationIntentHandling : NSObjectProtocol { func handle(intent: INSetRadioStationIntent, completion: @escaping (INSetRadioStationIntentResponse) -> Void) + func handle(intent: INSetRadioStationIntent) async -> INSetRadioStationIntentResponse optional func confirm(intent: INSetRadioStationIntent, completion: @escaping (INSetRadioStationIntentResponse) -> Void) + optional func confirm(intent: INSetRadioStationIntent) async -> INSetRadioStationIntentResponse optional func resolveRadioType(for intent: INSetRadioStationIntent, with completion: @escaping (INRadioTypeResolutionResult) -> Void) + optional func resolveRadioType(for intent: INSetRadioStationIntent) async -> INRadioTypeResolutionResult optional func resolveFrequency(for intent: INSetRadioStationIntent, with completion: @escaping (INDoubleResolutionResult) -> Void) + optional func resolveFrequency(for intent: INSetRadioStationIntent) async -> INDoubleResolutionResult optional func resolveStationName(for intent: INSetRadioStationIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveStationName(for intent: INSetRadioStationIntent) async -> INStringResolutionResult optional func resolveChannel(for intent: INSetRadioStationIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveChannel(for intent: INSetRadioStationIntent) async -> INStringResolutionResult optional func resolvePresetNumber(for intent: INSetRadioStationIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolvePresetNumber(for intent: INSetRadioStationIntent) async -> INIntegerResolutionResult } diff --git a/iOS/Intents/INSetSeatSettingsInCarIntent.swift b/iOS/Intents/INSetSeatSettingsInCarIntent.swift index e048d64..aeead61 100644 --- a/iOS/Intents/INSetSeatSettingsInCarIntent.swift +++ b/iOS/Intents/INSetSeatSettingsInCarIntent.swift @@ -29,13 +29,23 @@ extension INSetSeatSettingsInCarIntent { @available(iOS 10.0, *) protocol INSetSeatSettingsInCarIntentHandling : NSObjectProtocol { func handle(intent: INSetSeatSettingsInCarIntent, completion: @escaping (INSetSeatSettingsInCarIntentResponse) -> Void) + func handle(intent: INSetSeatSettingsInCarIntent) async -> INSetSeatSettingsInCarIntentResponse optional func confirm(intent: INSetSeatSettingsInCarIntent, completion: @escaping (INSetSeatSettingsInCarIntentResponse) -> Void) + optional func confirm(intent: INSetSeatSettingsInCarIntent) async -> INSetSeatSettingsInCarIntentResponse optional func resolveEnableHeating(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableHeating(for intent: INSetSeatSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveEnableCooling(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableCooling(for intent: INSetSeatSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveEnableMassage(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveEnableMassage(for intent: INSetSeatSettingsInCarIntent) async -> INBooleanResolutionResult optional func resolveSeat(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INCarSeatResolutionResult) -> Void) + optional func resolveSeat(for intent: INSetSeatSettingsInCarIntent) async -> INCarSeatResolutionResult optional func resolveLevel(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolveLevel(for intent: INSetSeatSettingsInCarIntent) async -> INIntegerResolutionResult optional func resolveRelativeLevelSetting(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INRelativeSettingResolutionResult) -> Void) + optional func resolveRelativeLevelSetting(for intent: INSetSeatSettingsInCarIntent) async -> INRelativeSettingResolutionResult @available(iOS 12.0, *) optional func resolveCarName(for intent: INSetSeatSettingsInCarIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 12.0, *) + optional func resolveCarName(for intent: INSetSeatSettingsInCarIntent) async -> INSpeakableStringResolutionResult } diff --git a/iOS/Intents/INSetTaskAttributeIntent.swift b/iOS/Intents/INSetTaskAttributeIntent.swift index a7320d5..8e7beb3 100644 --- a/iOS/Intents/INSetTaskAttributeIntent.swift +++ b/iOS/Intents/INSetTaskAttributeIntent.swift @@ -15,16 +15,29 @@ class INSetTaskAttributeIntent : INIntent { @available(iOS 11.0, *) protocol INSetTaskAttributeIntentHandling : NSObjectProtocol { func handle(intent: INSetTaskAttributeIntent, completion: @escaping (INSetTaskAttributeIntentResponse) -> Void) + func handle(intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeIntentResponse optional func confirm(intent: INSetTaskAttributeIntent, completion: @escaping (INSetTaskAttributeIntentResponse) -> Void) + optional func confirm(intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeIntentResponse optional func resolveTargetTask(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskResolutionResult) -> Void) + optional func resolveTargetTask(for intent: INSetTaskAttributeIntent) async -> INTaskResolutionResult @available(iOS 13.0, *) optional func resolveTaskTitle(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolveTaskTitle(for intent: INSetTaskAttributeIntent) async -> INSpeakableStringResolutionResult optional func resolveStatus(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSetTaskAttributeIntent) async -> INTaskStatusResolutionResult @available(iOS 13.0, *) optional func resolvePriority(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolvePriority(for intent: INSetTaskAttributeIntent) async -> INTaskPriorityResolutionResult optional func resolveSpatialEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSpatialEventTriggerResolutionResult) -> Void) + optional func resolveSpatialEventTrigger(for intent: INSetTaskAttributeIntent) async -> INSpatialEventTriggerResolutionResult @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTemporalEventTriggerForSetTaskAttribute:withCompletion: is deprecated. Use resolveTemporalEventTriggerForSetTaskAttribute:completion: instead") optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTemporalEventTriggerResolutionResult) -> Void) + @available(iOS, introduced: 11.0, deprecated: 13.0, message: "resolveTemporalEventTriggerForSetTaskAttribute:withCompletion: is deprecated. Use resolveTemporalEventTriggerForSetTaskAttribute:completion: instead") + optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent) async -> INTemporalEventTriggerResolutionResult @available(iOS 13.0, *) optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSetTaskAttributeTemporalEventTriggerResolutionResult) -> Void) + @available(iOS 13.0, *) + optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeTemporalEventTriggerResolutionResult } diff --git a/iOS/Intents/INSnoozeTasksIntent.swift b/iOS/Intents/INSnoozeTasksIntent.swift index c1ea41b..1e6e996 100644 --- a/iOS/Intents/INSnoozeTasksIntent.swift +++ b/iOS/Intents/INSnoozeTasksIntent.swift @@ -17,7 +17,11 @@ extension INSnoozeTasksIntent { @available(iOS 13.0, *) protocol INSnoozeTasksIntentHandling : NSObjectProtocol { func handle(intent: INSnoozeTasksIntent, completion: @escaping (INSnoozeTasksIntentResponse) -> Void) + func handle(intent: INSnoozeTasksIntent) async -> INSnoozeTasksIntentResponse optional func confirm(intent: INSnoozeTasksIntent, completion: @escaping (INSnoozeTasksIntentResponse) -> Void) + optional func confirm(intent: INSnoozeTasksIntent) async -> INSnoozeTasksIntentResponse optional func resolveTasks(for intent: INSnoozeTasksIntent, with completion: @escaping ([INSnoozeTasksTaskResolutionResult]) -> Void) + optional func resolveTasks(for intent: INSnoozeTasksIntent) async -> [INSnoozeTasksTaskResolutionResult] optional func resolveNextTriggerTime(for intent: INSnoozeTasksIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveNextTriggerTime(for intent: INSnoozeTasksIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/iOS/Intents/INStartAudioCallIntent.swift b/iOS/Intents/INStartAudioCallIntent.swift index 6a31178..2263055 100644 --- a/iOS/Intents/INStartAudioCallIntent.swift +++ b/iOS/Intents/INStartAudioCallIntent.swift @@ -10,8 +10,13 @@ class INStartAudioCallIntent : INIntent { @available(iOS, introduced: 10.0, deprecated: 13.0, message: "INStartAudioCallIntent is deprecated. Please adopt INStartCallIntent instead") protocol INStartAudioCallIntentHandling : NSObjectProtocol { func handle(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) + func handle(intent: INStartAudioCallIntent) async -> INStartAudioCallIntentResponse optional func confirm(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) + optional func confirm(intent: INStartAudioCallIntent) async -> INStartAudioCallIntentResponse @available(iOS 11.0, *) optional func resolveDestinationType(for intent: INStartAudioCallIntent, with completion: @escaping (INCallDestinationTypeResolutionResult) -> Void) + @available(iOS 11.0, *) + optional func resolveDestinationType(for intent: INStartAudioCallIntent) async -> INCallDestinationTypeResolutionResult optional func resolveContacts(for intent: INStartAudioCallIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveContacts(for intent: INStartAudioCallIntent) async -> [INPersonResolutionResult] } diff --git a/iOS/Intents/INStartCallIntent.swift b/iOS/Intents/INStartCallIntent.swift index 9063757..05bc4ac 100644 --- a/iOS/Intents/INStartCallIntent.swift +++ b/iOS/Intents/INStartCallIntent.swift @@ -15,10 +15,17 @@ class INStartCallIntent : INIntent { @available(iOS 13.0, *) protocol INStartCallIntentHandling : NSObjectProtocol { func handle(intent: INStartCallIntent, completion: @escaping (INStartCallIntentResponse) -> Void) + func handle(intent: INStartCallIntent) async -> INStartCallIntentResponse optional func confirm(intent: INStartCallIntent, completion: @escaping (INStartCallIntentResponse) -> Void) + optional func confirm(intent: INStartCallIntent) async -> INStartCallIntentResponse @available(iOS 14.0, *) optional func resolveCallRecordToCallBack(for intent: INStartCallIntent, with completion: @escaping (INCallRecordResolutionResult) -> Void) + @available(iOS 14.0, *) + optional func resolveCallRecordToCallBack(for intent: INStartCallIntent) async -> INCallRecordResolutionResult optional func resolveDestinationType(for intent: INStartCallIntent, with completion: @escaping (INCallDestinationTypeResolutionResult) -> Void) + optional func resolveDestinationType(for intent: INStartCallIntent) async -> INCallDestinationTypeResolutionResult optional func resolveContacts(for intent: INStartCallIntent, with completion: @escaping ([INStartCallContactResolutionResult]) -> Void) + optional func resolveContacts(for intent: INStartCallIntent) async -> [INStartCallContactResolutionResult] optional func resolveCallCapability(for intent: INStartCallIntent, with completion: @escaping (INStartCallCallCapabilityResolutionResult) -> Void) + optional func resolveCallCapability(for intent: INStartCallIntent) async -> INStartCallCallCapabilityResolutionResult } diff --git a/iOS/Intents/INStartPhotoPlaybackIntent.swift b/iOS/Intents/INStartPhotoPlaybackIntent.swift index 3fbcd82..e2bb488 100644 --- a/iOS/Intents/INStartPhotoPlaybackIntent.swift +++ b/iOS/Intents/INStartPhotoPlaybackIntent.swift @@ -15,9 +15,15 @@ class INStartPhotoPlaybackIntent : INIntent { @available(iOS 10.0, *) protocol INStartPhotoPlaybackIntentHandling : NSObjectProtocol { func handle(intent: INStartPhotoPlaybackIntent, completion: @escaping (INStartPhotoPlaybackIntentResponse) -> Void) + func handle(intent: INStartPhotoPlaybackIntent) async -> INStartPhotoPlaybackIntentResponse optional func confirm(intent: INStartPhotoPlaybackIntent, completion: @escaping (INStartPhotoPlaybackIntentResponse) -> Void) + optional func confirm(intent: INStartPhotoPlaybackIntent) async -> INStartPhotoPlaybackIntentResponse optional func resolveDateCreated(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INStartPhotoPlaybackIntent) async -> INDateComponentsRangeResolutionResult optional func resolveLocationCreated(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocationCreated(for intent: INStartPhotoPlaybackIntent) async -> INPlacemarkResolutionResult optional func resolveAlbumName(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveAlbumName(for intent: INStartPhotoPlaybackIntent) async -> INStringResolutionResult optional func resolvePeopleInPhoto(for intent: INStartPhotoPlaybackIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolvePeopleInPhoto(for intent: INStartPhotoPlaybackIntent) async -> [INPersonResolutionResult] } diff --git a/iOS/Intents/INStartVideoCallIntent.swift b/iOS/Intents/INStartVideoCallIntent.swift index 0053791..ee5239f 100644 --- a/iOS/Intents/INStartVideoCallIntent.swift +++ b/iOS/Intents/INStartVideoCallIntent.swift @@ -7,6 +7,9 @@ class INStartVideoCallIntent : INIntent { @available(iOS, introduced: 10.0, deprecated: 13.0, message: "INStartVideoCallIntent is deprecated. Please adopt INStartCallIntent instead") protocol INStartVideoCallIntentHandling : NSObjectProtocol { func handle(intent: INStartVideoCallIntent, completion: @escaping (INStartVideoCallIntentResponse) -> Void) + func handle(intent: INStartVideoCallIntent) async -> INStartVideoCallIntentResponse optional func confirm(intent: INStartVideoCallIntent, completion: @escaping (INStartVideoCallIntentResponse) -> Void) + optional func confirm(intent: INStartVideoCallIntent) async -> INStartVideoCallIntentResponse optional func resolveContacts(for intent: INStartVideoCallIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveContacts(for intent: INStartVideoCallIntent) async -> [INPersonResolutionResult] } diff --git a/iOS/Intents/INStartWorkoutIntent.swift b/iOS/Intents/INStartWorkoutIntent.swift index d981879..e1a52e8 100644 --- a/iOS/Intents/INStartWorkoutIntent.swift +++ b/iOS/Intents/INStartWorkoutIntent.swift @@ -20,10 +20,17 @@ extension INStartWorkoutIntent { @available(iOS 10.0, *) protocol INStartWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INStartWorkoutIntent, completion: @escaping (INStartWorkoutIntentResponse) -> Void) + func handle(intent: INStartWorkoutIntent) async -> INStartWorkoutIntentResponse optional func confirm(intent: INStartWorkoutIntent, completion: @escaping (INStartWorkoutIntentResponse) -> Void) + optional func confirm(intent: INStartWorkoutIntent) async -> INStartWorkoutIntentResponse optional func resolveWorkoutName(for intent: INStartWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INStartWorkoutIntent) async -> INSpeakableStringResolutionResult optional func resolveGoalValue(for intent: INStartWorkoutIntent, with completion: @escaping (INDoubleResolutionResult) -> Void) + optional func resolveGoalValue(for intent: INStartWorkoutIntent) async -> INDoubleResolutionResult optional func resolveWorkoutGoalUnitType(for intent: INStartWorkoutIntent, with completion: @escaping (INWorkoutGoalUnitTypeResolutionResult) -> Void) + optional func resolveWorkoutGoalUnitType(for intent: INStartWorkoutIntent) async -> INWorkoutGoalUnitTypeResolutionResult optional func resolveWorkoutLocationType(for intent: INStartWorkoutIntent, with completion: @escaping (INWorkoutLocationTypeResolutionResult) -> Void) + optional func resolveWorkoutLocationType(for intent: INStartWorkoutIntent) async -> INWorkoutLocationTypeResolutionResult optional func resolveIsOpenEnded(for intent: INStartWorkoutIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveIsOpenEnded(for intent: INStartWorkoutIntent) async -> INBooleanResolutionResult } diff --git a/iOS/Intents/INTransferMoneyIntent.swift b/iOS/Intents/INTransferMoneyIntent.swift index a5eafee..a3893b7 100644 --- a/iOS/Intents/INTransferMoneyIntent.swift +++ b/iOS/Intents/INTransferMoneyIntent.swift @@ -11,10 +11,17 @@ class INTransferMoneyIntent : INIntent { @available(iOS 11.0, *) protocol INTransferMoneyIntentHandling : NSObjectProtocol { func handle(intent: INTransferMoneyIntent, completion: @escaping (INTransferMoneyIntentResponse) -> Void) + func handle(intent: INTransferMoneyIntent) async -> INTransferMoneyIntentResponse optional func confirm(intent: INTransferMoneyIntent, completion: @escaping (INTransferMoneyIntentResponse) -> Void) + optional func confirm(intent: INTransferMoneyIntent) async -> INTransferMoneyIntentResponse optional func resolveFromAccount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveFromAccount(for intent: INTransferMoneyIntent) async -> INPaymentAccountResolutionResult optional func resolveToAccount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveToAccount(for intent: INTransferMoneyIntent) async -> INPaymentAccountResolutionResult optional func resolveTransactionAmount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAmountResolutionResult) -> Void) + optional func resolveTransactionAmount(for intent: INTransferMoneyIntent) async -> INPaymentAmountResolutionResult optional func resolveTransactionScheduledDate(for intent: INTransferMoneyIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveTransactionScheduledDate(for intent: INTransferMoneyIntent) async -> INDateComponentsRangeResolutionResult optional func resolveTransactionNote(for intent: INTransferMoneyIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveTransactionNote(for intent: INTransferMoneyIntent) async -> INStringResolutionResult } diff --git a/iOS/Intents/INUpdateMediaAffinityIntent.swift b/iOS/Intents/INUpdateMediaAffinityIntent.swift index 0684ce2..61d72cd 100644 --- a/iOS/Intents/INUpdateMediaAffinityIntent.swift +++ b/iOS/Intents/INUpdateMediaAffinityIntent.swift @@ -9,7 +9,11 @@ class INUpdateMediaAffinityIntent : INIntent { @available(iOS 13.0, *) protocol INUpdateMediaAffinityIntentHandling : NSObjectProtocol { func handle(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + func handle(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func confirm(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + optional func confirm(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent, with completion: @escaping ([INUpdateMediaAffinityMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent) async -> [INUpdateMediaAffinityMediaItemResolutionResult] optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent, with completion: @escaping (INMediaAffinityTypeResolutionResult) -> Void) + optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent) async -> INMediaAffinityTypeResolutionResult } diff --git a/iOS/Intents/INVoiceShortcutCenter.swift b/iOS/Intents/INVoiceShortcutCenter.swift index 29a8ad0..a8b0f03 100644 --- a/iOS/Intents/INVoiceShortcutCenter.swift +++ b/iOS/Intents/INVoiceShortcutCenter.swift @@ -3,6 +3,8 @@ class INVoiceShortcutCenter : NSObject { class var shared: INVoiceShortcutCenter { get } func getAllVoiceShortcuts(completion completionHandler: @escaping ([INVoiceShortcut]?, Error?) -> Void) + func allVoiceShortcuts() async throws -> [INVoiceShortcut] func getVoiceShortcut(with identifier: UUID, completion completionHandler: @escaping (INVoiceShortcut?, Error?) -> Void) + func getVoiceShortcut(with identifier: UUID) async throws -> INVoiceShortcut func setShortcutSuggestions(_ suggestions: [INShortcut]) } diff --git a/iOS/IntentsUI/INImage_IntentsUI.swift b/iOS/IntentsUI/INImage_IntentsUI.swift index 8cb1b2e..0024af5 100644 --- a/iOS/IntentsUI/INImage_IntentsUI.swift +++ b/iOS/IntentsUI/INImage_IntentsUI.swift @@ -8,4 +8,6 @@ extension INImage { class func imageSize(for response: INIntentResponse) -> CGSize @available(iOS 11.0, *) func fetchUIImage(completion: @escaping (UIImage?) -> Void) + @available(iOS 11.0, *) + func fetchUIImage() async -> UIImage? } diff --git a/iOS/IntentsUI/INUIHostedViewControlling.swift b/iOS/IntentsUI/INUIHostedViewControlling.swift index ed84413..16a7cf5 100644 --- a/iOS/IntentsUI/INUIHostedViewControlling.swift +++ b/iOS/IntentsUI/INUIHostedViewControlling.swift @@ -18,8 +18,11 @@ enum INUIInteractiveBehavior : UInt { @available(iOS 10.0, *) protocol INUIHostedViewControlling : NSObjectProtocol { optional func configure(with interaction: INInteraction, context: INUIHostedViewContext, completion: @escaping (CGSize) -> Void) + optional func configure(with interaction: INInteraction, context: INUIHostedViewContext) async -> CGSize @available(iOS 11.0, *) optional func configureView(for parameters: Set, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext, completion: @escaping (Bool, Set, CGSize) -> Void) + @available(iOS 11.0, *) + optional func configureView(for parameters: Set, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext) async -> (Bool, Set, CGSize) } extension NSExtensionContext { @available(iOS 10.0, *) diff --git a/iOS/LinkPresentation/LPMetadataProvider.swift b/iOS/LinkPresentation/LPMetadataProvider.swift index bddb4fe..0a5bdde 100644 --- a/iOS/LinkPresentation/LPMetadataProvider.swift +++ b/iOS/LinkPresentation/LPMetadataProvider.swift @@ -2,6 +2,7 @@ @available(iOS 13.0, *) class LPMetadataProvider : NSObject { func startFetchingMetadata(for URL: URL, completionHandler: @escaping (LPLinkMetadata?, Error?) -> Void) + func startFetchingMetadata(for URL: URL) async throws -> LPLinkMetadata func cancel() var shouldFetchSubresources: Bool var timeout: TimeInterval diff --git a/iOS/LocalAuthentication/LAContext.swift b/iOS/LocalAuthentication/LAContext.swift index 2d653dc..4d4cd88 100644 --- a/iOS/LocalAuthentication/LAContext.swift +++ b/iOS/LocalAuthentication/LAContext.swift @@ -16,6 +16,8 @@ class LAContext : NSObject { func canEvaluatePolicy(_ policy: LAPolicy, error: NSErrorPointer) -> Bool @available(iOS 8.0, *) func evaluatePolicy(_ policy: LAPolicy, localizedReason: String, reply: @escaping (Bool, Error?) -> Void) + @available(iOS 8.0, *) + func evaluatePolicy(_ policy: LAPolicy, localizedReason: String) async throws -> Bool @available(iOS 9.0, *) func invalidate() @available(iOS 9.0, *) @@ -24,6 +26,8 @@ class LAContext : NSObject { func isCredentialSet(_ type: LACredentialType) -> Bool @available(iOS 9.0, *) func evaluateAccessControl(_ accessControl: SecAccessControl, operation: LAAccessControlOperation, localizedReason: String, reply: @escaping (Bool, Error?) -> Void) + @available(iOS 9.0, *) + func evaluateAccessControl(_ accessControl: SecAccessControl, operation: LAAccessControlOperation, localizedReason: String) async throws -> Bool @available(iOS 8.0, *) var localizedFallbackTitle: String? @available(iOS, introduced: 8.3, deprecated: 9.0) diff --git a/iOS/MapKit/MKDirections.swift b/iOS/MapKit/MKDirections.swift index 01692cb..52a0d73 100644 --- a/iOS/MapKit/MKDirections.swift +++ b/iOS/MapKit/MKDirections.swift @@ -7,7 +7,9 @@ extension MKDirections { class MKDirections : NSObject { init(request: MKDirections.Request) func calculate(completionHandler: @escaping MKDirections.DirectionsHandler) + func calculate() async throws -> MKDirections.Response func calculateETA(completionHandler: @escaping MKDirections.ETAHandler) + func calculateETA() async throws -> MKDirections.ETAResponse func cancel() var isCalculating: Bool { get } } diff --git a/iOS/MapKit/MKLocalSearch.swift b/iOS/MapKit/MKLocalSearch.swift index 51b23a3..13b1139 100644 --- a/iOS/MapKit/MKLocalSearch.swift +++ b/iOS/MapKit/MKLocalSearch.swift @@ -8,6 +8,7 @@ class MKLocalSearch : NSObject { @available(iOS 14.0, *) init(request: MKLocalPointsOfInterestRequest) func start(completionHandler: @escaping MKLocalSearch.CompletionHandler) + func start() async throws -> MKLocalSearch.Response func cancel() var isSearching: Bool { get } } diff --git a/iOS/MapKit/MKMapItem.swift b/iOS/MapKit/MKMapItem.swift index 656b48d..0355c19 100644 --- a/iOS/MapKit/MKMapItem.swift +++ b/iOS/MapKit/MKMapItem.swift @@ -17,7 +17,11 @@ class MKMapItem : NSObject { @available(iOS 13.2, *) func openInMaps(launchOptions: [String : Any]? = nil, from scene: UIScene?, completionHandler completion: ((Bool) -> Void)? = nil) @available(iOS 13.2, *) + func openInMaps(launchOptions: [String : Any]? = nil, from scene: UIScene?) async -> Bool + @available(iOS 13.2, *) class func openMaps(with mapItems: [MKMapItem], launchOptions: [String : Any]? = nil, from scene: UIScene?, completionHandler completion: ((Bool) -> Void)? = nil) + @available(iOS 13.2, *) + class func openMaps(with mapItems: [MKMapItem], launchOptions: [String : Any]? = nil, from scene: UIScene?) async -> Bool } @available(iOS 6.0, *) let MKLaunchOptionsDirectionsModeKey: String diff --git a/iOS/MapKit/MKMapSnapshotter.swift b/iOS/MapKit/MKMapSnapshotter.swift index bb3554c..cea245a 100644 --- a/iOS/MapKit/MKMapSnapshotter.swift +++ b/iOS/MapKit/MKMapSnapshotter.swift @@ -6,7 +6,9 @@ extension MKMapSnapshotter { class MKMapSnapshotter : NSObject { init(options: MKMapSnapshotter.Options) func start(completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start() async throws -> MKMapSnapshotter.Snapshot func start(with queue: DispatchQueue, completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start(with queue: DispatchQueue) async throws -> MKMapSnapshotter.Snapshot func cancel() var isLoading: Bool { get } } diff --git a/iOS/MediaPlayer/MPMediaLibrary.swift b/iOS/MediaPlayer/MPMediaLibrary.swift index 779bae3..1dd7e3b 100644 --- a/iOS/MediaPlayer/MPMediaLibrary.swift +++ b/iOS/MediaPlayer/MPMediaLibrary.swift @@ -21,7 +21,11 @@ class MPMediaLibrary : NSObject, NSSecureCoding { @available(iOS 9.3, *) func addItem(withProductID productID: String, completionHandler: (([MPMediaEntity], Error?) -> Void)? = nil) @available(iOS 9.3, *) + func addItem(withProductID productID: String) async throws -> [MPMediaEntity] + @available(iOS 9.3, *) func getPlaylist(with uuid: UUID, creationMetadata: MPMediaPlaylistCreationMetadata?, completionHandler: @escaping (MPMediaPlaylist?, Error?) -> Void) + @available(iOS 9.3, *) + func getPlaylist(with uuid: UUID, creationMetadata: MPMediaPlaylistCreationMetadata?) async throws -> MPMediaPlaylist } extension NSNotification.Name { static let MPMediaLibraryDidChange: NSNotification.Name diff --git a/iOS/MediaPlayer/MPMediaPlaylist.swift b/iOS/MediaPlayer/MPMediaPlaylist.swift index cddd461..a157e8d 100644 --- a/iOS/MediaPlayer/MPMediaPlaylist.swift +++ b/iOS/MediaPlayer/MPMediaPlaylist.swift @@ -24,7 +24,11 @@ class MPMediaPlaylist : MPMediaItemCollection { @available(iOS 9.3, *) func addItem(withProductID productID: String, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 9.3, *) + func addItem(withProductID productID: String) async throws + @available(iOS 9.3, *) func add(_ mediaItems: [MPMediaItem], completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 9.3, *) + func add(_ mediaItems: [MPMediaItem]) async throws } let MPMediaPlaylistPropertyPersistentID: String @available(iOS 9.0, *) diff --git a/iOS/MediaPlayer/MPMusicPlayerApplicationController.swift b/iOS/MediaPlayer/MPMusicPlayerApplicationController.swift index 4862882..88b787e 100644 --- a/iOS/MediaPlayer/MPMusicPlayerApplicationController.swift +++ b/iOS/MediaPlayer/MPMusicPlayerApplicationController.swift @@ -11,6 +11,7 @@ class MPMusicPlayerControllerMutableQueue : MPMusicPlayerControllerQueue { @available(iOS 10.3, *) class MPMusicPlayerApplicationController : MPMusicPlayerController { func perform(queueTransaction: @escaping (MPMusicPlayerControllerMutableQueue) -> Void, completionHandler: @escaping (MPMusicPlayerControllerQueue, Error?) -> Void) + func perform(queueTransaction: @escaping (MPMusicPlayerControllerMutableQueue) -> Void) async throws -> MPMusicPlayerControllerQueue } extension NSNotification.Name { @available(iOS 10.3, *) diff --git a/iOS/MediaPlayer/MPMusicPlayerController.swift b/iOS/MediaPlayer/MPMusicPlayerController.swift index 64eaf58..e6e561c 100644 --- a/iOS/MediaPlayer/MPMusicPlayerController.swift +++ b/iOS/MediaPlayer/MPMusicPlayerController.swift @@ -56,6 +56,8 @@ class MPMusicPlayerController : NSObject, MPMediaPlayback { func append(_ descriptor: MPMusicPlayerQueueDescriptor) @available(iOS 10.1, *) func prepareToPlay(completionHandler: @escaping (Error?) -> Void) + @available(iOS 10.1, *) + func prepareToPlay() async throws func skipToNextItem() func skipToBeginning() func skipToPreviousItem() diff --git a/iOS/MediaPlayer/MPPlayableContentDataSource.swift b/iOS/MediaPlayer/MPPlayableContentDataSource.swift index f7d9618..5c5a9ba 100644 --- a/iOS/MediaPlayer/MPPlayableContentDataSource.swift +++ b/iOS/MediaPlayer/MPPlayableContentDataSource.swift @@ -2,9 +2,12 @@ @available(iOS, introduced: 7.1, deprecated: 14.0, message: "Use CarPlay framework") protocol MPPlayableContentDataSource : NSObjectProtocol { optional func beginLoadingChildItems(at indexPath: IndexPath, completionHandler: @escaping (Error?) -> Void) + optional func beginLoadingChildItems(at indexPath: IndexPath) async throws optional func childItemsDisplayPlaybackProgress(at indexPath: IndexPath) -> Bool @available(iOS, introduced: 10.0, deprecated: 14.0, message: "Use CarPlay framework") optional func contentItem(forIdentifier identifier: String, completionHandler: @escaping (MPContentItem?, Error?) -> Void) + @available(iOS, introduced: 10.0, deprecated: 14.0, message: "Use CarPlay framework") + optional func contentItem(forIdentifier identifier: String) async throws -> MPContentItem func numberOfChildItems(at indexPath: IndexPath) -> Int func contentItem(at indexPath: IndexPath) -> MPContentItem? } diff --git a/iOS/MediaPlayer/MPPlayableContentDelegate.swift b/iOS/MediaPlayer/MPPlayableContentDelegate.swift index 7642e2d..38f8225 100644 --- a/iOS/MediaPlayer/MPPlayableContentDelegate.swift +++ b/iOS/MediaPlayer/MPPlayableContentDelegate.swift @@ -3,10 +3,16 @@ protocol MPPlayableContentDelegate : NSObjectProtocol { @available(iOS, introduced: 7.1, deprecated: 14.0, message: "Use CarPlay framework") optional func playableContentManager(_ contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAt indexPath: IndexPath, completionHandler: @escaping (Error?) -> Void) + @available(iOS, introduced: 7.1, deprecated: 14.0, message: "Use CarPlay framework") + optional func playableContentManager(_ contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAt indexPath: IndexPath) async throws @available(iOS, introduced: 9.0, deprecated: 9.3, message: "Use Intents framework for initiating playback queues.") optional func playableContentManager(_ contentManager: MPPlayableContentManager, initializePlaybackQueueWithCompletionHandler completionHandler: @escaping (Error?) -> Void) + @available(iOS, introduced: 9.0, deprecated: 9.3, message: "Use Intents framework for initiating playback queues.") + optional func playableContentManagerInitializePlaybackQueue(_ contentManager: MPPlayableContentManager) async throws @available(iOS, introduced: 9.3, deprecated: 12.0, message: "Use Intents framework for initiating playback queues.") optional func playableContentManager(_ contentManager: MPPlayableContentManager, initializePlaybackQueueWithContentItems contentItems: [Any]?, completionHandler: @escaping (Error?) -> Void) + @available(iOS, introduced: 9.3, deprecated: 12.0, message: "Use Intents framework for initiating playback queues.") + optional func playableContentManager(_ contentManager: MPPlayableContentManager, initializePlaybackQueueWithContentItems contentItems: [Any]?) async throws @available(iOS, introduced: 8.4, deprecated: 14.0, message: "Use CarPlay framework") optional func playableContentManager(_ contentManager: MPPlayableContentManager, didUpdate context: MPPlayableContentManagerContext) } diff --git a/iOS/Messages/MSConversation.swift b/iOS/Messages/MSConversation.swift index bb3ec54..12d1f10 100644 --- a/iOS/Messages/MSConversation.swift +++ b/iOS/Messages/MSConversation.swift @@ -5,15 +5,27 @@ class MSConversation : NSObject { var remoteParticipantIdentifiers: [UUID] { get } var selectedMessage: MSMessage? { get } func insert(_ message: MSMessage, completionHandler: ((Error?) -> Void)? = nil) + func insert(_ message: MSMessage) async throws func insert(_ sticker: MSSticker, completionHandler: ((Error?) -> Void)? = nil) + func insert(_ sticker: MSSticker) async throws func insertText(_ text: String, completionHandler: ((Error?) -> Void)? = nil) + func insertText(_ text: String) async throws func insertAttachment(_ URL: URL, withAlternateFilename filename: String?, completionHandler: ((Error?) -> Void)? = nil) + func insertAttachment(_ URL: URL, withAlternateFilename filename: String?) async throws @available(iOS 11.0, *) func send(_ message: MSMessage, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func send(_ message: MSMessage) async throws + @available(iOS 11.0, *) func send(_ sticker: MSSticker, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func send(_ sticker: MSSticker) async throws + @available(iOS 11.0, *) func sendText(_ text: String, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func sendText(_ text: String) async throws + @available(iOS 11.0, *) func sendAttachment(_ URL: URL, withAlternateFilename filename: String?, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 11.0, *) + func sendAttachment(_ URL: URL, withAlternateFilename filename: String?) async throws } diff --git a/iOS/Metal/MTLDevice.swift b/iOS/Metal/MTLDevice.swift index 6d68915..e09577c 100644 --- a/iOS/Metal/MTLDevice.swift +++ b/iOS/Metal/MTLDevice.swift @@ -181,18 +181,25 @@ protocol MTLDevice : NSObjectProtocol { func makeLibrary(data: __DispatchData) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?, completionHandler: @escaping MTLNewLibraryCompletionHandler) + func makeLibrary(source: String, options: MTLCompileOptions?) async throws -> MTLLibrary func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, completionHandler: @escaping MTLNewRenderPipelineStateCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) async throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewRenderPipelineStateWithReflectionCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLRenderPipelineState, MTLRenderPipelineReflection) func makeComputePipelineState(function computeFunction: MTLFunction) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, completionHandler: @escaping MTLNewComputePipelineStateCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction) async throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(iOS 9.0, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState @available(iOS 9.0, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + @available(iOS 9.0, *) + func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(iOS 10.0, *) func makeFence() -> MTLFence? func supportsFeatureSet(_ featureSet: MTLFeatureSet) -> Bool @@ -209,6 +216,8 @@ protocol MTLDevice : NSObjectProtocol { @available(iOS 11.0, *) func makeRenderPipelineState(tileDescriptor descriptor: MTLTileRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewRenderPipelineStateWithReflectionCompletionHandler) @available(iOS 11.0, *) + func makeRenderPipelineState(tileDescriptor descriptor: MTLTileRenderPipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLRenderPipelineState, MTLRenderPipelineReflection) + @available(iOS 11.0, *) var maxThreadgroupMemoryLength: Int { get } @available(iOS 12.0, *) var maxArgumentBufferSamplerCount: Int { get } diff --git a/iOS/Metal/MTLLibrary.swift b/iOS/Metal/MTLLibrary.swift index 1c86e74..0f04116 100644 --- a/iOS/Metal/MTLLibrary.swift +++ b/iOS/Metal/MTLLibrary.swift @@ -139,13 +139,19 @@ protocol MTLLibrary : NSObjectProtocol { func makeFunction(name: String, constantValues: MTLFunctionConstantValues) throws -> MTLFunction @available(iOS 10.0, *) func makeFunction(name: String, constantValues: MTLFunctionConstantValues, completionHandler: @escaping (MTLFunction?, Error?) -> Void) + @available(iOS 10.0, *) + func makeFunction(name: String, constantValues: MTLFunctionConstantValues) async throws -> MTLFunction @available(iOS 14.0, *) func makeFunction(descriptor: MTLFunctionDescriptor, completionHandler: @escaping (MTLFunction?, Error?) -> Void) @available(iOS 14.0, *) + func makeFunction(descriptor: MTLFunctionDescriptor) async throws -> MTLFunction + @available(iOS 14.0, *) func makeFunction(descriptor: MTLFunctionDescriptor) throws -> MTLFunction @available(iOS 14.0, *) func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor, completionHandler: @escaping (MTLFunction?, Error?) -> Void) @available(iOS 14.0, *) + func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor) async throws -> MTLFunction + @available(iOS 14.0, *) func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor) throws -> MTLFunction var functionNames: [String] { get } @available(iOS 14.0, *) diff --git a/iOS/MetalKit/MTKTextureLoader.swift b/iOS/MetalKit/MTKTextureLoader.swift index c2cf1ac..fce4cb6 100644 --- a/iOS/MetalKit/MTKTextureLoader.swift +++ b/iOS/MetalKit/MTKTextureLoader.swift @@ -65,16 +65,27 @@ class MTKTextureLoader : NSObject { var device: MTLDevice { get } init(device: MTLDevice) func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(iOS 10.0, *) func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) @available(iOS 10.0, *) + func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture + @available(iOS 10.0, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) @available(iOS 10.0, *) + func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] + @available(iOS 10.0, *) func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) + @available(iOS 10.0, *) + func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(iOS 10.0, *) func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + @available(iOS 10.0, *) + func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) throws -> MTLTexture @available(iOS 10.0, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, error: NSErrorPointer) -> [MTLTexture] diff --git a/iOS/MetalPerformanceShaders/MetalPerformanceShaders.swift b/iOS/MetalPerformanceShaders/MetalPerformanceShaders.swift index 0b828d8..f3ff8bc 100644 --- a/iOS/MetalPerformanceShaders/MetalPerformanceShaders.swift +++ b/iOS/MetalPerformanceShaders/MetalPerformanceShaders.swift @@ -3739,6 +3739,7 @@ class MPSAccelerationStructure : MPSKernel, NSSecureCoding, NSCopying { init?(coder aDecoder: NSCoder, group: MPSAccelerationStructureGroup) func rebuild() func rebuild(completionHandler: @escaping MPSAccelerationStructureCompletionHandler) + func rebuild() async -> MPSAccelerationStructure? func encodeRefit(commandBuffer: MTLCommandBuffer) func copy(with zone: NSZone? = nil, group: MPSAccelerationStructureGroup) -> Self } diff --git a/iOS/MultipeerConnectivity/MCSession.swift b/iOS/MultipeerConnectivity/MCSession.swift index c17f49a..5787bf0 100644 --- a/iOS/MultipeerConnectivity/MCSession.swift +++ b/iOS/MultipeerConnectivity/MCSession.swift @@ -56,6 +56,7 @@ protocol MCSessionDelegate : NSObjectProtocol { } extension MCSession { func nearbyConnectionData(forPeer peerID: MCPeerID, withCompletionHandler completionHandler: @escaping (Data?, Error?) -> Void) + func nearbyConnectionData(forPeer peerID: MCPeerID) async throws -> Data func connectPeer(_ peerID: MCPeerID, withNearbyConnectionData data: Data) func cancelConnectPeer(_ peerID: MCPeerID) } diff --git a/iOS/NaturalLanguage/NLTagger.swift b/iOS/NaturalLanguage/NLTagger.swift index 4f0e495..b33f461 100644 --- a/iOS/NaturalLanguage/NLTagger.swift +++ b/iOS/NaturalLanguage/NLTagger.swift @@ -37,6 +37,8 @@ class NLTagger : NSObject { func gazetteers(for tagScheme: NLTagScheme) -> [NLGazetteer] @available(iOS 13.0, *) class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme, completionHandler: @escaping (NLTagger.AssetsResult, Error?) -> Void) + @available(iOS 13.0, *) + class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme) async throws -> NLTagger.AssetsResult } @available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) diff --git a/iOS/NetworkExtension/NetworkExtension.swift b/iOS/NetworkExtension/NetworkExtension.swift index 810d599..32e0bc4 100644 --- a/iOS/NetworkExtension/NetworkExtension.swift +++ b/iOS/NetworkExtension/NetworkExtension.swift @@ -24,6 +24,8 @@ class NEAppProxyFlow : NSObject { @available(iOS 9.0, *) func open(withLocalEndpoint localEndpoint: NWHostEndpoint?, completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func open(withLocalEndpoint localEndpoint: NWHostEndpoint?) async throws + @available(iOS 9.0, *) func closeReadWithError(_ error: Error?) @available(iOS 9.0, *) func closeWriteWithError(_ error: Error?) @@ -63,6 +65,8 @@ class NEProvider : NSObject { @available(iOS 9.0, *) func sleep(completionHandler: @escaping () -> Void) @available(iOS 9.0, *) + func sleep() async + @available(iOS 9.0, *) func wake() @available(iOS 9.0, *) func createTCPConnection(to remoteEndpoint: NWEndpoint, enableTLS: Bool, tlsParameters TLSParameters: NWTLSParameters?, delegate: Any?) -> NWTCPConnection @@ -70,6 +74,8 @@ class NEProvider : NSObject { func createUDPSession(to remoteEndpoint: NWEndpoint, from localEndpoint: NWHostEndpoint?) -> NWUDPSession @available(iOS, introduced: 10.0, deprecated: 12.0) func displayMessage(_ message: String, completionHandler: @escaping (Bool) -> Void) + @available(iOS, introduced: 10.0, deprecated: 12.0) + func displayMessage(_ message: String) async -> Bool @available(iOS 9.0, *) var defaultPath: NWPath? { get } } @@ -96,8 +102,12 @@ class NETunnelProvider : NEProvider { @available(iOS 9.0, *) func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) @available(iOS 9.0, *) + func handleAppMessage(_ messageData: Data) async -> Data? + @available(iOS 9.0, *) func setTunnelNetworkSettings(_ tunnelNetworkSettings: NETunnelNetworkSettings?, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 9.0, *) + func setTunnelNetworkSettings(_ tunnelNetworkSettings: NETunnelNetworkSettings?) async throws + @available(iOS 9.0, *) var protocolConfiguration: NEVPNProtocol { get } @available(iOS 9.0, *) var appRules: [NEAppRule]? { get } @@ -111,8 +121,12 @@ class NEAppProxyProvider : NETunnelProvider { @available(iOS 9.0, *) func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func startProxy(options: [String : Any]? = nil) async throws + @available(iOS 9.0, *) func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(iOS 9.0, *) + func stopProxy(with reason: NEProviderStopReason) async + @available(iOS 9.0, *) func cancelProxyWithError(_ error: Error?) @available(iOS 9.0, *) func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool @@ -152,10 +166,16 @@ class NEVPNManager : NSObject { @available(iOS 8.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func loadFromPreferences() async throws + @available(iOS 8.0, *) func removeFromPreferences(completionHandler: ((Error?) -> Void)? = nil) @available(iOS 8.0, *) + func removeFromPreferences() async throws + @available(iOS 8.0, *) func saveToPreferences(completionHandler: ((Error?) -> Void)? = nil) @available(iOS 8.0, *) + func saveToPreferences() async throws + @available(iOS 8.0, *) var onDemandRules: [NEOnDemandRule]? @available(iOS 8.0, *) var isOnDemandEnabled: Bool @@ -175,6 +195,8 @@ class NETunnelProviderManager : NEVPNManager { @available(iOS 9.0, *) class func loadAllFromPreferences(completionHandler: @escaping ([NETunnelProviderManager]?, Error?) -> Void) @available(iOS 9.0, *) + class func loadAllFromPreferences() async throws -> [NETunnelProviderManager] + @available(iOS 9.0, *) func copyAppRules() -> [NEAppRule]? @available(iOS 9.0, *) var routingMethod: NETunnelProviderRoutingMethod { get } @@ -187,8 +209,12 @@ class NEAppProxyTCPFlow : NEAppProxyFlow { @available(iOS 9.0, *) func readData(completionHandler: @escaping (Data?, Error?) -> Void) @available(iOS 9.0, *) + func readData() async throws -> Data + @available(iOS 9.0, *) func write(_ data: Data, withCompletionHandler completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func write(_ data: Data) async throws + @available(iOS 9.0, *) var remoteEndpoint: NWEndpoint { get } } @available(iOS 9.0, *) @@ -196,8 +222,12 @@ class NEAppProxyUDPFlow : NEAppProxyFlow { @available(iOS 9.0, *) func readDatagrams(completionHandler: @escaping ([Data]?, [NWEndpoint]?, Error?) -> Void) @available(iOS 9.0, *) + func readDatagrams() async throws -> ([Data], [NWEndpoint]) + @available(iOS 9.0, *) func writeDatagrams(_ datagrams: [Data], sentBy remoteEndpoints: [NWEndpoint], completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func writeDatagrams(_ datagrams: [Data], sentBy remoteEndpoints: [NWEndpoint]) async throws + @available(iOS 9.0, *) var localEndpoint: NWEndpoint? { get } } @available(iOS 9.0, *) @@ -229,10 +259,16 @@ class NEDNSProxyManager : NSObject { @available(iOS 11.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func loadFromPreferences() async throws + @available(iOS 11.0, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func removeFromPreferences() async throws + @available(iOS 11.0, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func saveToPreferences() async throws + @available(iOS 11.0, *) var localizedDescription: String? @available(iOS 11.0, *) var providerProtocol: NEDNSProxyProviderProtocol? @@ -244,8 +280,12 @@ class NEDNSProxyProvider : NEProvider { @available(iOS 11.0, *) func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) @available(iOS 11.0, *) + func startProxy(options: [String : Any]? = nil) async throws + @available(iOS 11.0, *) func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(iOS 11.0, *) + func stopProxy(with reason: NEProviderStopReason) async + @available(iOS 11.0, *) func cancelProxyWithError(_ error: Error?) @available(iOS 11.0, *) func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool @@ -377,10 +417,16 @@ class NEDNSSettingsManager : NSObject { @available(iOS 14.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func loadFromPreferences() async throws + @available(iOS 14.0, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func removeFromPreferences() async throws + @available(iOS 14.0, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func saveToPreferences() async throws + @available(iOS 14.0, *) var localizedDescription: String? @available(iOS 14.0, *) var dnsSettings: NEDNSSettings? @@ -452,8 +498,12 @@ class NEFilterProvider : NEProvider { @available(iOS 9.0, *) func startFilter(completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func startFilter() async throws + @available(iOS 9.0, *) func stopFilter(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(iOS 9.0, *) + func stopFilter(with reason: NEProviderStopReason) async + @available(iOS 9.0, *) var filterConfiguration: NEFilterProviderConfiguration { get } @available(iOS 11.0, *) func handle(_ report: NEFilterReport) @@ -534,8 +584,12 @@ class NEFilterControlProvider : NEFilterProvider { @available(iOS 9.0, *) func handleRemediation(for flow: NEFilterFlow, completionHandler: @escaping (NEFilterControlVerdict) -> Void) @available(iOS 9.0, *) + func handleRemediation(for flow: NEFilterFlow) async -> NEFilterControlVerdict + @available(iOS 9.0, *) func handleNewFlow(_ flow: NEFilterFlow, completionHandler: @escaping (NEFilterControlVerdict) -> Void) @available(iOS 9.0, *) + func handleNewFlow(_ flow: NEFilterFlow) async -> NEFilterControlVerdict + @available(iOS 9.0, *) func notifyRulesChanged() } @available(iOS 9.0, *) @@ -601,10 +655,16 @@ class NEFilterManager : NSObject { @available(iOS 8.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func loadFromPreferences() async throws + @available(iOS 8.0, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func removeFromPreferences() async throws + @available(iOS 8.0, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func saveToPreferences() async throws + @available(iOS 8.0, *) var localizedDescription: String? @available(iOS 9.0, *) var providerConfiguration: NEFilterProviderConfiguration? @@ -647,6 +707,8 @@ class NEHotspotNetwork : NSObject { var bssid: String { get } @available(iOS 14.0, *) class func fetchCurrent(completionHandler: @escaping (NEHotspotNetwork?) -> Void) + @available(iOS 14.0, *) + class func fetchCurrent() async -> NEHotspotNetwork? } @available(iOS 9.0, *) enum NEHotspotHelperCommandType : Int { @@ -859,11 +921,15 @@ class NEHotspotConfigurationManager : NSObject { @available(iOS 11.0, *) func apply(_ configuration: NEHotspotConfiguration, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func apply(_ configuration: NEHotspotConfiguration) async throws + @available(iOS 11.0, *) func removeConfiguration(forSSID SSID: String) @available(iOS 11.0, *) func removeConfiguration(forHS20DomainName domainName: String) @available(iOS 11.0, *) func getConfiguredSSIDs(completionHandler: @escaping ([String]) -> Void) + @available(iOS 11.0, *) + func configuredSSIDs() async -> [String] } @available(iOS 9.0, *) class NEIPv4Settings : NSObject, NSSecureCoding, NSCopying { @@ -1002,10 +1068,14 @@ class NEPacketTunnelFlow : NSObject { @available(iOS 9.0, *) func readPackets(completionHandler: @escaping ([Data], [NSNumber]) -> Void) @available(iOS 9.0, *) + func readPackets() async -> ([Data], [NSNumber]) + @available(iOS 9.0, *) func writePackets(_ packets: [Data], withProtocols protocols: [NSNumber]) -> Bool @available(iOS 10.0, *) func readPacketObjects(completionHandler: @escaping ([NEPacket]) -> Void) @available(iOS 10.0, *) + func readPacketObjects() async -> [NEPacket] + @available(iOS 10.0, *) func writePacketObjects(_ packets: [NEPacket]) -> Bool } @available(iOS 9.0, *) @@ -1035,8 +1105,12 @@ class NEPacketTunnelProvider : NETunnelProvider { @available(iOS 9.0, *) func startTunnel(options: [String : NSObject]? = nil, completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func startTunnel(options: [String : NSObject]? = nil) async throws + @available(iOS 9.0, *) func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(iOS 9.0, *) + func stopTunnel(with reason: NEProviderStopReason) async + @available(iOS 9.0, *) func cancelTunnelWithError(_ error: Error?) @available(iOS 9.0, *) var packetFlow: NEPacketTunnelFlow { get } @@ -1255,12 +1329,20 @@ class NEAppPushManager : NSObject { @available(iOS 14.0, *) class func loadAllFromPreferences(completionHandler: @escaping ([NEAppPushManager]?, Error?) -> Void) @available(iOS 14.0, *) + class func loadAllFromPreferences() async throws -> [NEAppPushManager] + @available(iOS 14.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func loadFromPreferences() async throws + @available(iOS 14.0, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func removeFromPreferences() async throws + @available(iOS 14.0, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func saveToPreferences() async throws + @available(iOS 14.0, *) var localizedDescription: String? @available(iOS 14.0, *) var isEnabled: Bool @@ -1279,8 +1361,12 @@ class NEAppPushProvider : NEProvider { @available(iOS 14.0, *) func start(completionHandler: @escaping (Error?) -> Void) @available(iOS 14.0, *) + func start() async throws + @available(iOS 14.0, *) func stop(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(iOS 14.0, *) + func stop(with reason: NEProviderStopReason) async + @available(iOS 14.0, *) func reportIncomingCall(userInfo: [AnyHashable : Any] = [:]) @available(iOS 14.0, *) func handleTimerEvent() @@ -1366,10 +1452,16 @@ class NWTCPConnection : NSObject { @available(iOS 9.0, *) func readLength(_ length: Int, completionHandler completion: @escaping (Data?, Error?) -> Void) @available(iOS 9.0, *) + func readLength(_ length: Int) async throws -> Data + @available(iOS 9.0, *) func readMinimumLength(_ minimum: Int, maximumLength maximum: Int, completionHandler completion: @escaping (Data?, Error?) -> Void) @available(iOS 9.0, *) + func readMinimumLength(_ minimum: Int, maximumLength maximum: Int) async throws -> Data + @available(iOS 9.0, *) func write(_ data: Data, completionHandler completion: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func write(_ data: Data) async throws + @available(iOS 9.0, *) func writeClose() } @available(iOS 9.0, *) @@ -1379,9 +1471,13 @@ protocol NWTCPConnectionAuthenticationDelegate : NSObjectProtocol { @available(iOS 9.0, *) optional func provideIdentity(for connection: NWTCPConnection, completionHandler completion: @escaping (SecIdentity, [Any]) -> Void) @available(iOS 9.0, *) + optional func provideIdentity(for connection: NWTCPConnection) async -> (SecIdentity, [Any]) + @available(iOS 9.0, *) optional func shouldEvaluateTrust(for connection: NWTCPConnection) -> Bool @available(iOS 9.0, *) optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any], completionHandler completion: @escaping (SecTrust) -> Void) + @available(iOS 9.0, *) + optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any]) async -> SecTrust } @available(iOS 9.0, *) enum NWUDPSessionState : Int { @@ -1419,8 +1515,12 @@ class NWUDPSession : NSObject { @available(iOS 9.0, *) func writeMultipleDatagrams(_ datagramArray: [Data], completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func writeMultipleDatagrams(_ datagramArray: [Data]) async throws + @available(iOS 9.0, *) func writeDatagram(_ datagram: Data, completionHandler: @escaping (Error?) -> Void) @available(iOS 9.0, *) + func writeDatagram(_ datagram: Data) async throws + @available(iOS 9.0, *) func cancel() } class NWTLSParameters : NSObject { diff --git a/iOS/NotificationCenter/NCWidgetProviding.swift b/iOS/NotificationCenter/NCWidgetProviding.swift index 8564c83..be9ede0 100644 --- a/iOS/NotificationCenter/NCWidgetProviding.swift +++ b/iOS/NotificationCenter/NCWidgetProviding.swift @@ -11,6 +11,8 @@ enum NCUpdateResult : UInt { protocol NCWidgetProviding : NSObjectProtocol { @available(iOS, introduced: 8.0, deprecated: 14.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") optional func widgetPerformUpdate(completionHandler: @escaping (NCUpdateResult) -> Void) + @available(iOS, introduced: 8.0, deprecated: 14.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") + optional func widgetPerformUpdate() async -> NCUpdateResult @available(iOS, introduced: 10.0, deprecated: 14.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") optional func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) @available(iOS, introduced: 8.0, deprecated: 10.0, message: "This method will not be called on widgets linked against iOS versions 10.0 and later.") diff --git a/iOS/PassKit/PKAddPaymentPassViewController.swift b/iOS/PassKit/PKAddPaymentPassViewController.swift index 52a730d..195c67e 100644 --- a/iOS/PassKit/PKAddPaymentPassViewController.swift +++ b/iOS/PassKit/PKAddPaymentPassViewController.swift @@ -2,6 +2,7 @@ @available(iOS 9.0, *) protocol PKAddPaymentPassViewControllerDelegate : NSObjectProtocol { func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, generateRequestWithCertificateChain certificates: [Data], nonce: Data, nonceSignature: Data, completionHandler handler: @escaping (PKAddPaymentPassRequest) -> Void) + func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, generateRequestWithCertificateChain certificates: [Data], nonce: Data, nonceSignature: Data) async -> PKAddPaymentPassRequest func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, didFinishAdding pass: PKPaymentPass?, error: Error?) } @available(iOS 9.0, *) diff --git a/iOS/PassKit/PKAddShareablePassConfiguration.swift b/iOS/PassKit/PKAddShareablePassConfiguration.swift index 8565017..0371af6 100644 --- a/iOS/PassKit/PKAddShareablePassConfiguration.swift +++ b/iOS/PassKit/PKAddShareablePassConfiguration.swift @@ -19,6 +19,7 @@ enum PKAddShareablePassConfigurationPrimaryAction : UInt { @available(iOS 14.0, *) class PKAddShareablePassConfiguration : PKAddSecureElementPassConfiguration { class func forPassMetaData(_ passMetadata: [PKShareablePassMetadata], provisioningPolicyIdentifier: String, action: PKAddShareablePassConfigurationPrimaryAction, completion: @escaping (PKAddShareablePassConfiguration?, Error?) -> Void) + class func forPassMetaData(_ passMetadata: [PKShareablePassMetadata], provisioningPolicyIdentifier: String, action: PKAddShareablePassConfigurationPrimaryAction) async throws -> PKAddShareablePassConfiguration var primaryAction: PKAddShareablePassConfigurationPrimaryAction { get } var credentialsMetadata: [PKShareablePassMetadata] { get } var provisioningPolicyIdentifier: String { get } diff --git a/iOS/PassKit/PKDisbursementAuthorizationController.swift b/iOS/PassKit/PKDisbursementAuthorizationController.swift index a1cdba6..d94447a 100644 --- a/iOS/PassKit/PKDisbursementAuthorizationController.swift +++ b/iOS/PassKit/PKDisbursementAuthorizationController.swift @@ -13,5 +13,7 @@ class PKDisbursementAuthorizationController : NSObject { @available(iOS 12.2, *) func authorizeDisbursement(completion: @escaping (Bool, Error?) -> Void) @available(iOS 12.2, *) + func authorizeDisbursement() async throws -> Bool + @available(iOS 12.2, *) class func supportsDisbursements() -> Bool } diff --git a/iOS/PassKit/PKIssuerProvisioningExtensionHandler.swift b/iOS/PassKit/PKIssuerProvisioningExtensionHandler.swift index d2e6609..43e287d 100644 --- a/iOS/PassKit/PKIssuerProvisioningExtensionHandler.swift +++ b/iOS/PassKit/PKIssuerProvisioningExtensionHandler.swift @@ -2,7 +2,11 @@ @available(iOS 14.0, *) class PKIssuerProvisioningExtensionHandler : NSObject { func status(completion: @escaping (PKIssuerProvisioningExtensionStatus) -> Void) + func status() async -> PKIssuerProvisioningExtensionStatus func passEntries(completion: @escaping ([PKIssuerProvisioningExtensionPassEntry]) -> Void) + func passEntries() async -> [PKIssuerProvisioningExtensionPassEntry] func remotePassEntries(completion: @escaping ([PKIssuerProvisioningExtensionPassEntry]) -> Void) + func remotePassEntries() async -> [PKIssuerProvisioningExtensionPassEntry] func generateAddPaymentPassRequestForPassEntryWithIdentifier(_ identifier: String, configuration: PKAddPaymentPassRequestConfiguration, certificateChain certificates: [Data], nonce: Data, nonceSignature: Data, completionHandler completion: @escaping (PKAddPaymentPassRequest?) -> Void) + func generateAddPaymentPassRequestForPassEntryWithIdentifier(_ identifier: String, configuration: PKAddPaymentPassRequestConfiguration, certificateChain certificates: [Data], nonce: Data, nonceSignature: Data) async -> PKAddPaymentPassRequest? } diff --git a/iOS/PassKit/PKPassLibrary.swift b/iOS/PassKit/PKPassLibrary.swift index 93d9885..e26aaf5 100644 --- a/iOS/PassKit/PKPassLibrary.swift +++ b/iOS/PassKit/PKPassLibrary.swift @@ -47,6 +47,8 @@ class PKPassLibrary : NSObject { func replacePass(with pass: PKPass) -> Bool @available(iOS 7.0, *) func addPasses(_ passes: [PKPass], withCompletionHandler completion: ((PKPassLibraryAddPassesStatus) -> Void)? = nil) + @available(iOS 7.0, *) + func addPasses(_ passes: [PKPass]) async -> PKPassLibraryAddPassesStatus @available(iOS 8.3, *) func openPaymentSetup() @available(iOS, introduced: 10.0, deprecated: 100000, message: "Use -[PKPassLibrary presentSecureElementPass:] instead") @@ -61,12 +63,20 @@ class PKPassLibrary : NSObject { func canAddFelicaPass() -> Bool @available(iOS, introduced: 8.0, deprecated: 100000, message: "Use activateSecureElementPass:withActivationData:completion: instead") func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data, completion: ((Bool, Error) -> Void)? = nil) + @available(iOS, introduced: 8.0, deprecated: 100000, message: "Use activateSecureElementPass:withActivationData:completion: instead") + func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data) async -> (Bool, Error) @available(iOS, introduced: 8.0, deprecated: 9.0, message: "Use activatePaymentPass:withActivationData:completion: instead") func activate(_ paymentPass: PKPaymentPass, withActivationCode activationCode: String, completion: ((Bool, Error) -> Void)? = nil) + @available(iOS, introduced: 8.0, deprecated: 9.0, message: "Use activatePaymentPass:withActivationData:completion: instead") + func activate(_ paymentPass: PKPaymentPass, withActivationCode activationCode: String) async -> (Bool, Error) @available(iOS 13.4, *) func activate(_ secureElementPass: PKSecureElementPass, activationData: Data, completion: ((Bool, Error?) -> Void)? = nil) @available(iOS 13.4, *) + func activate(_ secureElementPass: PKSecureElementPass, activationData: Data) async throws -> Bool + @available(iOS 13.4, *) func sign(_ signData: Data, using secureElementPass: PKSecureElementPass, completion: @escaping (Data?, Data?, Error?) -> Void) + @available(iOS 13.4, *) + func sign(_ signData: Data, using secureElementPass: PKSecureElementPass) async throws -> (Data, Data) } struct PKPassLibraryNotificationName : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(_ rawValue: String) diff --git a/iOS/PassKit/PKPaymentAuthorizationController.swift b/iOS/PassKit/PKPaymentAuthorizationController.swift index e3a81a3..9a4e92b 100644 --- a/iOS/PassKit/PKPaymentAuthorizationController.swift +++ b/iOS/PassKit/PKPaymentAuthorizationController.swift @@ -4,8 +4,12 @@ protocol PKPaymentAuthorizationControllerDelegate : NSObjectProtocol { func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) @available(iOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) + @available(iOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationResult @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didAuthorizePayment:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didAuthorizePayment:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationStatus @available(iOS 10.0, *) optional func paymentAuthorizationControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationController) @available(iOS 14.0, *) @@ -13,15 +17,27 @@ protocol PKPaymentAuthorizationControllerDelegate : NSObjectProtocol { @available(iOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) @available(iOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> PKPaymentRequestShippingMethodUpdate + @available(iOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) @available(iOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> PKPaymentRequestShippingContactUpdate + @available(iOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, handler completion: @escaping (PKPaymentRequestPaymentMethodUpdate) -> Void) + @available(iOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectShippingMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, completion: @escaping (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectShippingMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectShippingContact:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectShippingContact:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectPaymentMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, completion: @escaping ([PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 10.0, deprecated: 11.0, message: "Use paymentAuthorizationController:didSelectPaymentMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> [PKPaymentSummaryItem] @available(iOS 14.0, *) optional func presentationWindow(for controller: PKPaymentAuthorizationController) -> UIWindow? } @@ -33,5 +49,7 @@ class PKPaymentAuthorizationController : NSObject { weak var delegate: @sil_weak PKPaymentAuthorizationControllerDelegate? init(paymentRequest request: PKPaymentRequest) func present(completion: ((Bool) -> Void)? = nil) + func present() async -> Bool func dismiss(completion: (() -> Void)? = nil) + func dismiss() async } diff --git a/iOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift b/iOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift index 9076a76..26ba94c 100644 --- a/iOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift +++ b/iOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift @@ -4,6 +4,8 @@ protocol PKPaymentAuthorizationViewControllerDelegate : NSObjectProtocol { func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) @available(iOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) + @available(iOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationResult @available(iOS 8.3, *) optional func paymentAuthorizationViewControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationViewController) @available(iOS 14.0, *) @@ -11,17 +13,33 @@ protocol PKPaymentAuthorizationViewControllerDelegate : NSObjectProtocol { @available(iOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod, handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) @available(iOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod) async -> PKPaymentRequestShippingMethodUpdate + @available(iOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact, handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) @available(iOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact) async -> PKPaymentRequestShippingContactUpdate + @available(iOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod, handler completion: @escaping (PKPaymentRequestPaymentMethodUpdate) -> Void) + @available(iOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate @available(iOS, introduced: 8.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didAuthorizePayment:handler: instead to provide more granular errors") optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) + @available(iOS, introduced: 8.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didAuthorizePayment:handler: instead to provide more granular errors") + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationStatus @available(iOS, introduced: 8.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectShippingMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod, completion: @escaping (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 8.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectShippingMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod) async -> (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) @available(iOS, introduced: 8.0, deprecated: 9.0, message: "ABRecordRef has been deprecated. Please migrate away from this delegate callback as soon as possible.") optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingAddress address: ABRecord, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 8.0, deprecated: 9.0, message: "ABRecordRef has been deprecated. Please migrate away from this delegate callback as soon as possible.") + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingAddress address: ABRecord) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectShippingContact:handler: instead to provide more granular errors") optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectShippingContact:handler: instead to provide more granular errors") + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectPaymentMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod, completion: @escaping ([PKPaymentSummaryItem]) -> Void) + @available(iOS, introduced: 9.0, deprecated: 11.0, message: "Use paymentAuthorizationViewController:didSelectPaymentMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod) async -> [PKPaymentSummaryItem] } diff --git a/iOS/PassKit/PKPaymentInformationEventExtension.swift b/iOS/PassKit/PKPaymentInformationEventExtension.swift index dc1d681..43d4919 100644 --- a/iOS/PassKit/PKPaymentInformationEventExtension.swift +++ b/iOS/PassKit/PKPaymentInformationEventExtension.swift @@ -8,7 +8,13 @@ protocol PKPaymentInformationRequestHandling { @available(iOS 14.0, *) func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest, completion: @escaping PKInformationRequestCompletionBlock) @available(iOS 14.0, *) + func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest) async -> PKBarcodeEventMetadataResponse + @available(iOS 14.0, *) func handle(_ signatureRequest: PKBarcodeEventSignatureRequest, completion: @escaping PKSignatureRequestCompletionBlock) @available(iOS 14.0, *) + func handle(_ signatureRequest: PKBarcodeEventSignatureRequest) async -> PKBarcodeEventSignatureResponse + @available(iOS 14.0, *) func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest, completion: @escaping () -> Void) + @available(iOS 14.0, *) + func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest) async } diff --git a/iOS/Photos/PHAssetResourceManager.swift b/iOS/Photos/PHAssetResourceManager.swift index bb29338..e3550ea 100644 --- a/iOS/Photos/PHAssetResourceManager.swift +++ b/iOS/Photos/PHAssetResourceManager.swift @@ -21,5 +21,7 @@ class PHAssetResourceManager : NSObject { @available(iOS 9, *) func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?, completionHandler: @escaping (Error?) -> Void) @available(iOS 9, *) + func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?) async throws + @available(iOS 9, *) func cancelDataRequest(_ requestID: PHAssetResourceDataRequestID) } diff --git a/iOS/Photos/PHLivePhotoEditingContext.swift b/iOS/Photos/PHLivePhotoEditingContext.swift index a65ca8c..0f9c6fd 100644 --- a/iOS/Photos/PHLivePhotoEditingContext.swift +++ b/iOS/Photos/PHLivePhotoEditingContext.swift @@ -26,8 +26,12 @@ class PHLivePhotoEditingContext : NSObject { @available(iOS 10, *) func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil, completionHandler handler: @escaping (PHLivePhoto?, Error?) -> Void) @available(iOS 10, *) + func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil) async throws -> PHLivePhoto + @available(iOS 10, *) func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil, completionHandler handler: @escaping (Bool, Error?) -> Void) @available(iOS 10, *) + func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil) async throws -> Bool + @available(iOS 10, *) func cancel() } @available(iOS 10, iOS 10, *) diff --git a/iOS/Photos/PHPhotoLibrary.swift b/iOS/Photos/PHPhotoLibrary.swift index 584ff1f..d70a13f 100644 --- a/iOS/Photos/PHPhotoLibrary.swift +++ b/iOS/Photos/PHPhotoLibrary.swift @@ -54,6 +54,8 @@ class PHPhotoLibrary : NSObject { @available(iOS 8, *) func performChanges(_ changeBlock: @escaping () -> Void, completionHandler: ((Bool, Error?) -> Void)? = nil) @available(iOS 8, *) + func performChanges(_ changeBlock: @escaping () -> Void) async throws -> Bool + @available(iOS 8, *) func performChangesAndWait(_ changeBlock: @escaping () -> Void) throws @available(iOS 8, *) func register(_ observer: PHPhotoLibraryChangeObserver) diff --git a/iOS/PhotosUI/PHContentEditingController.swift b/iOS/PhotosUI/PHContentEditingController.swift index deda016..1673584 100644 --- a/iOS/PhotosUI/PHContentEditingController.swift +++ b/iOS/PhotosUI/PHContentEditingController.swift @@ -8,6 +8,8 @@ protocol PHContentEditingController : NSObjectProtocol { @available(iOS 8, *) func finishContentEditing(completionHandler: @escaping (PHContentEditingOutput?) -> Void) @available(iOS 8, *) + func finishContentEditing() async -> PHContentEditingOutput? + @available(iOS 8, *) func cancelContentEditing() @available(iOS 8, *) var shouldShowCancelConfirmation: Bool { get } diff --git a/iOS/PushKit/PKPushRegistry.swift b/iOS/PushKit/PKPushRegistry.swift index 62e19ff..cc9eac2 100644 --- a/iOS/PushKit/PKPushRegistry.swift +++ b/iOS/PushKit/PKPushRegistry.swift @@ -21,6 +21,8 @@ protocol PKPushRegistryDelegate : NSObjectProtocol { optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) @available(iOS 11.0, *) optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) + @available(iOS 11.0, *) + optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async @available(iOS 8.0, *) optional func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) } diff --git a/iOS/QuickLook/QLPreviewingController.swift b/iOS/QuickLook/QLPreviewingController.swift index 9afeb41..0c11cd4 100644 --- a/iOS/QuickLook/QLPreviewingController.swift +++ b/iOS/QuickLook/QLPreviewingController.swift @@ -1,5 +1,7 @@ protocol QLPreviewingController : NSObjectProtocol { optional func preparePreviewOfSearchableItem(identifier: String, queryString: String?, completionHandler handler: @escaping (Error?) -> Void) + optional func preparePreviewOfSearchableItem(identifier: String, queryString: String?) async throws optional func preparePreviewOfFile(at url: URL, completionHandler handler: @escaping (Error?) -> Void) + optional func preparePreviewOfFile(at url: URL) async throws } diff --git a/iOS/QuickLookThumbnailing/QLThumbnailGenerator.swift b/iOS/QuickLookThumbnailing/QLThumbnailGenerator.swift index c2d3c8f..9347397 100644 --- a/iOS/QuickLookThumbnailing/QLThumbnailGenerator.swift +++ b/iOS/QuickLookThumbnailing/QLThumbnailGenerator.swift @@ -3,7 +3,9 @@ class QLThumbnailGenerator : NSObject { class var shared: QLThumbnailGenerator { get } func generateBestRepresentation(for request: QLThumbnailGenerator.Request, completion completionHandler: @escaping (QLThumbnailRepresentation?, Error?) -> Void) + func generateBestRepresentation(for request: QLThumbnailGenerator.Request) async throws -> QLThumbnailRepresentation func generateRepresentations(for request: QLThumbnailGenerator.Request, update updateHandler: ((QLThumbnailRepresentation?, QLThumbnailRepresentation.RepresentationType, Error?) -> Void)? = nil) func cancel(_ request: QLThumbnailGenerator.Request) func saveBestRepresentation(for request: QLThumbnailGenerator.Request, to fileURL: URL, contentType: String, completion completionHandler: @escaping (Error?) -> Void) + func saveBestRepresentation(for request: QLThumbnailGenerator.Request, to fileURL: URL, contentType: String) async throws } diff --git a/iOS/ReplayKit/RPBroadcastExtension.swift b/iOS/ReplayKit/RPBroadcastExtension.swift index bf933a4..f4cc6bd 100644 --- a/iOS/ReplayKit/RPBroadcastExtension.swift +++ b/iOS/ReplayKit/RPBroadcastExtension.swift @@ -1,6 +1,7 @@ extension NSExtensionContext { func loadBroadcastingApplicationInfo(completion handler: @escaping (String, String, UIImage?) -> Void) + func loadBroadcastingApplicationInfo() async -> (String, String, UIImage?) @available(iOS, introduced: 10.0, deprecated: 11.0, message: "No longer supported") func completeRequest(withBroadcast broadcastURL: URL, broadcastConfiguration: RPBroadcastConfiguration, setupInfo: [String : NSCoding & NSObjectProtocol]?) @available(iOS 11.0, *) diff --git a/iOS/ReplayKit/RPScreenRecorder.swift b/iOS/ReplayKit/RPScreenRecorder.swift index 81a4357..9343ae1 100644 --- a/iOS/ReplayKit/RPScreenRecorder.swift +++ b/iOS/ReplayKit/RPScreenRecorder.swift @@ -15,10 +15,14 @@ class RPScreenRecorder : NSObject { func stopRecording(handler: ((RPPreviewViewController?, Error?) -> Void)? = nil) @available(iOS 14.0, *) func stopRecording(withOutput url: URL, completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 14.0, *) + func stopRecording(withOutput url: URL) async throws func discardRecording(handler: @escaping () -> Void) @available(iOS 11.0, *) func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?) async throws + @available(iOS 11.0, *) func stopCapture(handler: ((Error?) -> Void)? = nil) weak var delegate: @sil_weak RPScreenRecorderDelegate? var isAvailable: Bool { get } diff --git a/iOS/SafariServices/SFContentBlockerManager.swift b/iOS/SafariServices/SFContentBlockerManager.swift index 6287490..df93e1c 100644 --- a/iOS/SafariServices/SFContentBlockerManager.swift +++ b/iOS/SafariServices/SFContentBlockerManager.swift @@ -15,6 +15,9 @@ enum SFContentBlockerErrorCode : Int { @available(iOS 9.0, *) class SFContentBlockerManager : NSObject { class func reloadContentBlocker(withIdentifier identifier: String, completionHandler: ((Error?) -> Void)? = nil) + class func reloadContentBlocker(withIdentifier identifier: String) async throws @available(iOS 10.0, *) class func getStateOfContentBlocker(withIdentifier identifier: String, completionHandler: @escaping (SFContentBlockerState?, Error?) -> Void) + @available(iOS 10.0, *) + class func stateOfContentBlocker(withIdentifier identifier: String) async throws -> SFContentBlockerState } diff --git a/iOS/SceneKit/SCNAction.swift b/iOS/SceneKit/SCNAction.swift index faf38d7..702f3f1 100644 --- a/iOS/SceneKit/SCNAction.swift +++ b/iOS/SceneKit/SCNAction.swift @@ -3,8 +3,10 @@ typealias SCNActionTimingFunction = (Float) -> Float protocol SCNActionable : NSObjectProtocol { func runAction(_ action: SCNAction) func runAction(_ action: SCNAction, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction) async func runAction(_ action: SCNAction, forKey key: String?) func runAction(_ action: SCNAction, forKey key: String?, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction, forKey key: String?) async var hasActions: Bool { get } func action(forKey key: String) -> SCNAction? func removeAction(forKey key: String) diff --git a/iOS/SceneKit/SCNSceneRenderer.swift b/iOS/SceneKit/SCNSceneRenderer.swift index 302159c..d7fa230 100644 --- a/iOS/SceneKit/SCNSceneRenderer.swift +++ b/iOS/SceneKit/SCNSceneRenderer.swift @@ -53,6 +53,7 @@ protocol SCNSceneRenderer : NSObjectProtocol { var isTemporalAntialiasingEnabled: Bool { get set } func prepare(_ object: Any, shouldAbortBlock block: (() -> Bool)? = nil) -> Bool func prepare(_ objects: [Any], completionHandler: ((Bool) -> Void)? = nil) + func prepare(_ objects: [Any]) async -> Bool var showsStatistics: Bool { get set } @available(iOS 9.0, *) var debugOptions: SCNDebugOptions { get set } diff --git a/iOS/SensorKit/SensorKit.swift b/iOS/SensorKit/SensorKit.swift index c219244..e0efc84 100644 --- a/iOS/SensorKit/SensorKit.swift +++ b/iOS/SensorKit/SensorKit.swift @@ -99,6 +99,7 @@ class SRSensorReader : NSObject { var sensor: SRSensor { get } weak var delegate: @sil_weak SRSensorReaderDelegate? class func requestAuthorization(sensors: Set, completion: @escaping (Error?) -> Void) + class func requestAuthorization(sensors: Set) async throws } @available(iOS 14.0, *) let SRErrorDomain: String diff --git a/iOS/SoundAnalysis/SNAnalyzer.swift b/iOS/SoundAnalysis/SNAnalyzer.swift index 2103040..120a693 100644 --- a/iOS/SoundAnalysis/SNAnalyzer.swift +++ b/iOS/SoundAnalysis/SNAnalyzer.swift @@ -16,5 +16,6 @@ class SNAudioFileAnalyzer : NSObject { func removeAllRequests() func analyze() func analyze(completionHandler: @escaping (Bool) -> Void) + func analyze() async -> Bool func cancelAnalysis() } diff --git a/iOS/SpriteKit/SKNode.swift b/iOS/SpriteKit/SKNode.swift index 4e86f17..ac24ee2 100644 --- a/iOS/SpriteKit/SKNode.swift +++ b/iOS/SpriteKit/SKNode.swift @@ -65,6 +65,7 @@ class SKNode : UIResponder, NSCopying, NSSecureCoding, UIFocusItem { func inParentHierarchy(_ parent: SKNode) -> Bool func run(_ action: SKAction) func run(_ action: SKAction, completion block: @escaping () -> Void) + func run(_ action: SKAction) async func run(_ action: SKAction, withKey key: String) func hasActions() -> Bool func action(forKey key: String) -> SKAction? diff --git a/iOS/SpriteKit/SKTexture.swift b/iOS/SpriteKit/SKTexture.swift index a487f7e..dc85201 100644 --- a/iOS/SpriteKit/SKTexture.swift +++ b/iOS/SpriteKit/SKTexture.swift @@ -30,7 +30,9 @@ class SKTexture : NSObject, NSCopying, NSSecureCoding { @available(iOS 9.0, *) func cgImage() -> CGImage class func preload(_ textures: [SKTexture], withCompletionHandler completionHandler: @escaping () -> Void) + class func preload(_ textures: [SKTexture]) async func preload(completionHandler: @escaping () -> Void) + func preload() async } extension SKTexture : _CustomPlaygroundQuickLookable { diff --git a/iOS/SpriteKit/SKTextureAtlas.swift b/iOS/SpriteKit/SKTextureAtlas.swift index 200fc95..ab5f507 100644 --- a/iOS/SpriteKit/SKTextureAtlas.swift +++ b/iOS/SpriteKit/SKTextureAtlas.swift @@ -5,9 +5,13 @@ class SKTextureAtlas : NSObject, NSSecureCoding { convenience init(dictionary properties: [String : Any]) func textureNamed(_ name: String) -> SKTexture class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas], withCompletionHandler completionHandler: @escaping () -> Void) + class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas]) async @available(iOS 9.0, *) class func preloadTextureAtlasesNamed(_ atlasNames: [String], withCompletionHandler completionHandler: @escaping (Error?, [SKTextureAtlas]) -> Void) + @available(iOS 9.0, *) + class func preloadTextureAtlasesNamed(_ atlasNames: [String]) async throws -> [SKTextureAtlas] func preload(completionHandler: @escaping () -> Void) + func preload() async var textureNames: [String] { get } } diff --git a/iOS/StoreKit/SKCloudServiceController.swift b/iOS/StoreKit/SKCloudServiceController.swift index 2d21aa5..dea1ad7 100644 --- a/iOS/StoreKit/SKCloudServiceController.swift +++ b/iOS/StoreKit/SKCloudServiceController.swift @@ -25,14 +25,24 @@ class SKCloudServiceController : NSObject { class func requestAuthorization(_ handler: @escaping (SKCloudServiceAuthorizationStatus) -> Void) @available(iOS 9.3, *) func requestCapabilities(completionHandler: @escaping (SKCloudServiceCapability, Error?) -> Void) + @available(iOS 9.3, *) + func requestCapabilities() async throws -> SKCloudServiceCapability @available(iOS 11.0, *) func requestStorefrontCountryCode(completionHandler: @escaping (String?, Error?) -> Void) + @available(iOS 11.0, *) + func requestStorefrontCountryCode() async throws -> String @available(iOS 9.3, *) func requestStorefrontIdentifier(completionHandler: @escaping (String?, Error?) -> Void) + @available(iOS 9.3, *) + func requestStorefrontIdentifier() async throws -> String @available(iOS 11.0, *) func requestUserToken(forDeveloperToken developerToken: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(iOS 11.0, *) + func requestUserToken(forDeveloperToken developerToken: String) async throws -> String @available(iOS, introduced: 10.3, deprecated: 11.0) func requestPersonalizationToken(forClientToken clientToken: String, withCompletionHandler completionHandler: @escaping (String?, Error?) -> Void) + @available(iOS, introduced: 10.3, deprecated: 11.0) + func requestPersonalizationToken(forClientToken clientToken: String) async throws -> String } extension NSNotification.Name { @available(iOS 9.3, *) diff --git a/iOS/StoreKit/SKCloudServiceSetupViewController.swift b/iOS/StoreKit/SKCloudServiceSetupViewController.swift index ee775ff..cd9f669 100644 --- a/iOS/StoreKit/SKCloudServiceSetupViewController.swift +++ b/iOS/StoreKit/SKCloudServiceSetupViewController.swift @@ -20,6 +20,8 @@ class SKCloudServiceSetupViewController : UIViewController { weak var delegate: @sil_weak SKCloudServiceSetupViewControllerDelegate? @available(iOS 10.1, *) func load(options: [SKCloudServiceSetupOptionsKey : Any] = [:], completionHandler: ((Bool, Error?) -> Void)? = nil) + @available(iOS 10.1, *) + func load(options: [SKCloudServiceSetupOptionsKey : Any] = [:]) async throws -> Bool } protocol SKCloudServiceSetupViewControllerDelegate : NSObjectProtocol { @available(iOS 10.1, *) diff --git a/iOS/StoreKit/SKProductStorePromotionController.swift b/iOS/StoreKit/SKProductStorePromotionController.swift index 22d4953..ca1e767 100644 --- a/iOS/StoreKit/SKProductStorePromotionController.swift +++ b/iOS/StoreKit/SKProductStorePromotionController.swift @@ -14,9 +14,17 @@ class SKProductStorePromotionController : NSObject { @available(iOS 11.0, *) func fetchStorePromotionVisibility(for product: SKProduct, completionHandler: ((SKProductStorePromotionVisibility, Error?) -> Void)? = nil) @available(iOS 11.0, *) + func fetchStorePromotionVisibility(for product: SKProduct) async throws -> SKProductStorePromotionVisibility + @available(iOS 11.0, *) func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 11.0, *) + func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct) async throws + @available(iOS 11.0, *) func fetchStorePromotionOrder(completionHandler: (([SKProduct], Error?) -> Void)? = nil) @available(iOS 11.0, *) + func fetchStorePromotionOrder() async throws -> [SKProduct] + @available(iOS 11.0, *) func update(storePromotionOrder: [SKProduct], completionHandler: ((Error?) -> Void)? = nil) + @available(iOS 11.0, *) + func update(storePromotionOrder: [SKProduct]) async throws } diff --git a/iOS/StoreKit/SKStoreProductViewController.swift b/iOS/StoreKit/SKStoreProductViewController.swift index 762ab69..67887bf 100644 --- a/iOS/StoreKit/SKStoreProductViewController.swift +++ b/iOS/StoreKit/SKStoreProductViewController.swift @@ -5,6 +5,8 @@ class SKStoreProductViewController : UIViewController { weak var delegate: @sil_weak SKStoreProductViewControllerDelegate? @available(iOS 6.0, *) func loadProduct(withParameters parameters: [String : Any], completionBlock block: ((Bool, Error?) -> Void)? = nil) + @available(iOS 6.0, *) + func loadProduct(withParameters parameters: [String : Any]) async throws -> Bool } protocol SKStoreProductViewControllerDelegate : NSObjectProtocol { @available(iOS 6.0, *) diff --git a/iOS/SwiftUI/SwiftUI.swift b/iOS/SwiftUI/SwiftUI.swift index 5bde524..9796d12 100644 --- a/iOS/SwiftUI/SwiftUI.swift +++ b/iOS/SwiftUI/SwiftUI.swift @@ -866,7 +866,7 @@ extension Commands { @available(iOS 14.0, macOS 11.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@_functionBuilder struct CommandsBuilder { +@resultBuilder struct CommandsBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyCommands @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : Commands } @@ -3779,7 +3779,7 @@ extension Scene { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct SceneBuilder { +@resultBuilder struct SceneBuilder { static func buildBlock(_ content: Content) -> Content where Content : Scene } @@ -4494,7 +4494,7 @@ extension ToolbarContent { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct ToolbarContentBuilder { +@resultBuilder struct ToolbarContentBuilder { static func buildBlock(_ content: Content) -> some ToolbarContent where Content : ToolbarContent static func buildBlock(_ content: Content) -> some CustomizableToolbarContent where Content : CustomizableToolbarContent @@ -6202,7 +6202,7 @@ extension View { } @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) -@_functionBuilder struct ViewBuilder { +@resultBuilder struct ViewBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyView @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : View } @@ -6361,7 +6361,7 @@ protocol WidgetBundle { @available(iOS 14.0, macOS 11.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@_functionBuilder struct WidgetBundleBuilder { +@resultBuilder struct WidgetBundleBuilder { static func buildBlock() -> some Widget static func buildBlock(_ content: Content) -> some Widget where Content : Widget diff --git a/iOS/UIKit/UIApplication.swift b/iOS/UIKit/UIApplication.swift index 40c639f..0383b3f 100644 --- a/iOS/UIKit/UIApplication.swift +++ b/iOS/UIKit/UIApplication.swift @@ -93,6 +93,8 @@ class UIApplication : UIResponder { func canOpenURL(_ url: URL) -> Bool @available(iOS 10.0, *) func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil) + @available(iOS 10.0, *) + func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:]) async -> Bool func sendEvent(_ event: UIEvent) @available(iOS, introduced: 2.0, deprecated: 13.0, message: "Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes") var keyWindow: UIWindow? { get } @@ -198,6 +200,8 @@ extension UIApplication { @available(iOS 10.3, *) func setAlternateIconName(_ alternateIconName: String?, completionHandler: ((Error?) -> Void)? = nil) @available(iOS 10.3, *) + func setAlternateIconName(_ alternateIconName: String?) async throws + @available(iOS 10.3, *) var alternateIconName: String? { get } } extension UIApplication { @@ -321,22 +325,40 @@ protocol UIApplicationDelegate : NSObjectProtocol { optional func application(_ application: UIApplication, didReceive notification: UILocalNotification) @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, completionHandler: @escaping () -> Void) + @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") + optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification) async @available(iOS, introduced: 9.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) + @available(iOS, introduced: 9.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") + optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any]) async @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) + @available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") + optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any]) async @available(iOS, introduced: 9.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) + @available(iOS, introduced: 9.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]") + optional func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, for notification: UILocalNotification, withResponseInfo responseInfo: [AnyHashable : Any]) async @available(iOS 7.0, *) optional func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) + @available(iOS 7.0, *) + optional func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult @available(iOS, introduced: 7.0, deprecated: 13.0, message: "Use a BGAppRefreshTask in the BackgroundTasks framework instead") optional func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) + @available(iOS, introduced: 7.0, deprecated: 13.0, message: "Use a BGAppRefreshTask in the BackgroundTasks framework instead") + optional func applicationPerformFetch(_ application: UIApplication) async -> UIBackgroundFetchResult @available(iOS 9.0, *) optional func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) + @available(iOS 9.0, *) + optional func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem) async -> Bool @available(iOS 7.0, *) optional func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) + @available(iOS 7.0, *) + optional func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String) async @available(iOS 8.2, *) optional func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?, reply: @escaping ([AnyHashable : Any]?) -> Void) + @available(iOS 8.2, *) + optional func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?) async -> [AnyHashable : Any]? @available(iOS 9.0, *) optional func applicationShouldRequestHealthAuthorization(_ application: UIApplication) @available(iOS 4.0, *) diff --git a/iOS/UIKit/UICollectionView.swift b/iOS/UIKit/UICollectionView.swift index 6870750..5ee8669 100644 --- a/iOS/UIKit/UICollectionView.swift +++ b/iOS/UIKit/UICollectionView.swift @@ -155,6 +155,8 @@ class UICollectionView : UIScrollView, UIDataSourceTranslating { @available(iOS 7.0, *) func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool, completion: ((Bool) -> Void)? = nil) @available(iOS 7.0, *) + func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool) async -> Bool + @available(iOS 7.0, *) func startInteractiveTransition(to layout: UICollectionViewLayout, completion: UICollectionView.LayoutInteractiveTransitionCompletion? = nil) -> UICollectionViewTransitionLayout @available(iOS 7.0, *) func finishInteractiveTransition() @@ -185,6 +187,7 @@ class UICollectionView : UIScrollView, UIDataSourceTranslating { func reloadItems(at indexPaths: [IndexPath]) func moveItem(at indexPath: IndexPath, to newIndexPath: IndexPath) func performBatchUpdates(_ updates: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + func performBatchUpdates(_ updates: (() -> Void)?) async -> Bool @available(iOS 9.0, *) func beginInteractiveMovementForItem(at indexPath: IndexPath) -> Bool @available(iOS 9.0, *) diff --git a/iOS/UIKit/UIContextMenuInteraction.swift b/iOS/UIKit/UIContextMenuInteraction.swift index 6af9530..a8d8f89 100644 --- a/iOS/UIKit/UIContextMenuInteraction.swift +++ b/iOS/UIKit/UIContextMenuInteraction.swift @@ -32,6 +32,7 @@ protocol UIContextMenuInteractionAnimating : NSObjectProtocol { var previewViewController: UIViewController? { get } func addAnimations(_ animations: @escaping () -> Void) func addCompletion(_ completion: @escaping () -> Void) + func addCompletion() async } @available(iOS 13.0, *) protocol UIContextMenuInteractionCommitAnimating : UIContextMenuInteractionAnimating { diff --git a/iOS/UIKit/UIDiffableDataSource.swift b/iOS/UIKit/UIDiffableDataSource.swift index 92e9fca..c06eacf 100644 --- a/iOS/UIKit/UIDiffableDataSource.swift +++ b/iOS/UIKit/UIDiffableDataSource.swift @@ -64,6 +64,7 @@ class UICollectionViewDiffableDataSourceReference : NSObject, UICollectionViewDa func snapshot() -> NSDiffableDataSourceSnapshotReference func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool, completion: (() -> Void)? = nil) + func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) async func itemIdentifier(for indexPath: IndexPath) -> Any? func indexPath(forItemIdentifier identifier: Any) -> IndexPath? @available(iOS 14.0, *) @@ -73,6 +74,8 @@ class UICollectionViewDiffableDataSourceReference : NSObject, UICollectionViewDa @available(iOS 14.0, *) func applySnapshot(_ snapshot: NSDiffableDataSourceSectionSnapshotReference, toSection sectionIdentifier: Any, animatingDifferences: Bool, completion: (() -> Void)? = nil) @available(iOS 14.0, *) + func applySnapshot(_ snapshot: NSDiffableDataSourceSectionSnapshotReference, toSection sectionIdentifier: Any, animatingDifferences: Bool) async + @available(iOS 14.0, *) func snapshot(forSection section: Any) -> NSDiffableDataSourceSectionSnapshotReference @available(iOS 14.0, *) @NSCopying var sectionSnapshotHandlers: __UICollectionViewDiffableDataSourceSectionSnapshotHandlers @@ -84,6 +87,7 @@ class UITableViewDiffableDataSourceReference : NSObject, UITableViewDataSource { func snapshot() -> NSDiffableDataSourceSnapshotReference func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool, completion: (() -> Void)? = nil) + func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) async func itemIdentifier(for indexPath: IndexPath) -> Any? func indexPath(forItemIdentifier identifier: Any) -> IndexPath? var defaultRowAnimation: UITableView.RowAnimation diff --git a/iOS/UIKit/UIDocument.swift b/iOS/UIKit/UIDocument.swift index 4222389..76c25e3 100644 --- a/iOS/UIKit/UIDocument.swift +++ b/iOS/UIKit/UIDocument.swift @@ -8,7 +8,9 @@ class UIDocument : NSObject, NSFilePresenter, ProgressReporting { var fileModificationDate: Date? var documentState: UIDocument.State { get } func open(completionHandler: ((Bool) -> Void)? = nil) + func open() async -> Bool func close(completionHandler: ((Bool) -> Void)? = nil) + func close() async -> Bool func load(fromContents contents: Any, ofType typeName: String?) throws func contents(forType typeName: String) throws -> Any func disableEditing() @@ -19,7 +21,9 @@ class UIDocument : NSObject, NSFilePresenter, ProgressReporting { func changeCountToken(for saveOperation: UIDocument.SaveOperation) -> Any func updateChangeCount(withToken changeCountToken: Any, for saveOperation: UIDocument.SaveOperation) func save(to url: URL, for saveOperation: UIDocument.SaveOperation, completionHandler: ((Bool) -> Void)? = nil) + func save(to url: URL, for saveOperation: UIDocument.SaveOperation) async -> Bool func autosave(completionHandler: ((Bool) -> Void)? = nil) + func autosave() async -> Bool var savingFileType: String? { get } func fileNameExtension(forType typeName: String?, saveOperation: UIDocument.SaveOperation) -> String func writeContents(_ contents: Any, andAttributes additionalFileAttributes: [AnyHashable : Any]? = nil, safelyTo url: URL, for saveOperation: UIDocument.SaveOperation) throws @@ -31,6 +35,7 @@ class UIDocument : NSObject, NSFilePresenter, ProgressReporting { func finishedHandlingError(_ error: Error, recovered: Bool) func userInteractionNoLongerPermitted(forError error: Error) func revert(toContentsOf url: URL, completionHandler: ((Bool) -> Void)? = nil) + func revert(toContentsOf url: URL) async -> Bool } extension UIDocument { @available(iOS 8.0, *) diff --git a/iOS/UIKit/UIDocumentBrowserViewController.swift b/iOS/UIKit/UIDocumentBrowserViewController.swift index 896ead6..83984a6 100644 --- a/iOS/UIKit/UIDocumentBrowserViewController.swift +++ b/iOS/UIKit/UIDocumentBrowserViewController.swift @@ -44,7 +44,9 @@ class UIDocumentBrowserViewController : UIViewController, NSCoding { var additionalLeadingNavigationBarButtonItems: [UIBarButtonItem] var additionalTrailingNavigationBarButtonItems: [UIBarButtonItem] func revealDocument(at url: URL, importIfNeeded: Bool, completion: ((URL?, Error?) -> Void)? = nil) + func revealDocument(at url: URL, importIfNeeded: Bool) async throws -> URL func importDocument(at documentURL: URL, nextToDocumentAt neighbourURL: URL, mode importMode: UIDocumentBrowserViewController.ImportMode, completionHandler completion: @escaping (URL?, Error?) -> Void) + func importDocument(at documentURL: URL, nextToDocumentAt neighbourURL: URL, mode importMode: UIDocumentBrowserViewController.ImportMode) async throws -> URL @available(iOS 12.0, *) func transitionController(forDocumentAt documentURL: URL) -> UIDocumentBrowserTransitionController @available(iOS, introduced: 11.0, deprecated: 12.0) diff --git a/iOS/UIKit/UIDragInteraction.swift b/iOS/UIKit/UIDragInteraction.swift index a760272..c5d103c 100644 --- a/iOS/UIKit/UIDragInteraction.swift +++ b/iOS/UIKit/UIDragInteraction.swift @@ -3,6 +3,7 @@ protocol UIDragAnimating : NSObjectProtocol { func addAnimations(_ animations: @escaping () -> Void) func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void) + func addCompletion() async -> UIViewAnimatingPosition } @available(iOS 11.0, *) class UIDragInteraction : NSObject, UIInteraction { diff --git a/iOS/UIKit/UIFocusAnimationCoordinator.swift b/iOS/UIKit/UIFocusAnimationCoordinator.swift index 55d9169..f81caf5 100644 --- a/iOS/UIKit/UIFocusAnimationCoordinator.swift +++ b/iOS/UIKit/UIFocusAnimationCoordinator.swift @@ -6,8 +6,13 @@ protocol UIFocusAnimationContext : NSObjectProtocol { @available(iOS 9.0, *) class UIFocusAnimationCoordinator : NSObject { func addCoordinatedAnimations(_ animations: (() -> Void)?, completion: (() -> Void)? = nil) + func addCoordinatedAnimations(_ animations: (() -> Void)?) async @available(iOS 11.0, *) func addCoordinatedFocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?, completion: (() -> Void)? = nil) @available(iOS 11.0, *) + func addCoordinatedFocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?) async + @available(iOS 11.0, *) func addCoordinatedUnfocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?, completion: (() -> Void)? = nil) + @available(iOS 11.0, *) + func addCoordinatedUnfocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?) async } diff --git a/iOS/UIKit/UIIndirectScribbleInteraction.swift b/iOS/UIKit/UIIndirectScribbleInteraction.swift index 3654cef..56f445a 100644 --- a/iOS/UIKit/UIIndirectScribbleInteraction.swift +++ b/iOS/UIKit/UIIndirectScribbleInteraction.swift @@ -9,9 +9,11 @@ typealias __UIScribbleElementIdentifier = NSCopying & NSObjectProtocol @available(iOS 14.0, *) protocol __UIIndirectScribbleInteractionDelegate : NSObjectProtocol { func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, requestElementsIn rect: CGRect, completion: @escaping ([__UIScribbleElementIdentifier]) -> Void) + func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, requestElementsIn rect: CGRect) async -> [__UIScribbleElementIdentifier] func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, isElementFocused elementIdentifier: __UIScribbleElementIdentifier) -> Bool func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, frameForElement elementIdentifier: __UIScribbleElementIdentifier) -> CGRect func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, focusElementIfNeeded elementIdentifier: __UIScribbleElementIdentifier, referencePoint focusReferencePoint: CGPoint, completion: @escaping ((UIResponder & UITextInput)?) -> Void) + func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, focusElementIfNeeded elementIdentifier: __UIScribbleElementIdentifier, referencePoint focusReferencePoint: CGPoint) async -> (UIResponder & UITextInput)? optional func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, shouldDelayFocusForElement elementIdentifier: __UIScribbleElementIdentifier) -> Bool optional func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, willBeginWritingInElement elementIdentifier: __UIScribbleElementIdentifier) optional func indirectScribbleInteraction(_ interaction: __UIIndirectScribbleInteraction, didFinishWritingInElement elementIdentifier: __UIScribbleElementIdentifier) diff --git a/iOS/UIKit/UIInputViewController.swift b/iOS/UIKit/UIInputViewController.swift index c77dd19..9fc1c62 100644 --- a/iOS/UIKit/UIInputViewController.swift +++ b/iOS/UIKit/UIInputViewController.swift @@ -28,4 +28,5 @@ class UIInputViewController : UIViewController, UITextInputDelegate { @available(iOS 10.0, *) func handleInputModeList(from view: UIView, with event: UIEvent) func requestSupplementaryLexicon(completion completionHandler: @escaping (UILexicon) -> Void) + func requestSupplementaryLexicon() async -> UILexicon } diff --git a/iOS/UIKit/UIPageViewController.swift b/iOS/UIKit/UIPageViewController.swift index c9fea8e..b3540fb 100644 --- a/iOS/UIKit/UIPageViewController.swift +++ b/iOS/UIKit/UIPageViewController.swift @@ -49,6 +49,7 @@ class UIPageViewController : UIViewController { var gestureRecognizers: [UIGestureRecognizer] { get } var viewControllers: [UIViewController]? { get } func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) + func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool) async -> Bool } protocol UIPageViewControllerDelegate : NSObjectProtocol { @available(iOS 6.0, *) diff --git a/iOS/UIKit/UIPasteboard.swift b/iOS/UIKit/UIPasteboard.swift index dccb7bd..7c0b5b5 100644 --- a/iOS/UIKit/UIPasteboard.swift +++ b/iOS/UIKit/UIPasteboard.swift @@ -66,11 +66,19 @@ class UIPasteboard : NSObject { @available(iOS 14.0, *) func __detectPatterns(forPatterns patterns: Set, completionHandler: @escaping (Set?, Error?) -> Void) @available(iOS 14.0, *) + func __detectPatterns(forPatterns patterns: Set) async throws -> Set + @available(iOS 14.0, *) func __detectPatterns(forPatterns patterns: Set, inItemSet itemSet: IndexSet?, completionHandler: @escaping ([Set]?, Error?) -> Void) @available(iOS 14.0, *) + func __detectPatterns(forPatterns patterns: Set, inItemSet itemSet: IndexSet?) async throws -> [Set] + @available(iOS 14.0, *) func __detectValues(forPatterns patterns: Set, completionHandler: @escaping ([UIPasteboard.DetectionPattern : Any]?, Error?) -> Void) @available(iOS 14.0, *) + func __detectValues(forPatterns patterns: Set) async throws -> [UIPasteboard.DetectionPattern : Any] + @available(iOS 14.0, *) func __detectValues(forPatterns patterns: Set, inItemSet itemSet: IndexSet?, completionHandler: @escaping ([[UIPasteboard.DetectionPattern : Any]]?, Error?) -> Void) + @available(iOS 14.0, *) + func __detectValues(forPatterns patterns: Set, inItemSet itemSet: IndexSet?) async throws -> [[UIPasteboard.DetectionPattern : Any]] } extension UIPasteboard { diff --git a/iOS/UIKit/UIPointerInteraction.swift b/iOS/UIKit/UIPointerInteraction.swift index 6dadb14..68ae25c 100644 --- a/iOS/UIKit/UIPointerInteraction.swift +++ b/iOS/UIKit/UIPointerInteraction.swift @@ -22,4 +22,5 @@ class UIPointerRegionRequest : NSObject { protocol UIPointerInteractionAnimating : NSObjectProtocol { func addAnimations(_ animations: @escaping () -> Void) func addCompletion(_ completion: @escaping (Bool) -> Void) + func addCompletion() async -> Bool } diff --git a/iOS/UIKit/UIPrinter.swift b/iOS/UIKit/UIPrinter.swift index dbd4fbc..0747864 100644 --- a/iOS/UIKit/UIPrinter.swift +++ b/iOS/UIKit/UIPrinter.swift @@ -10,6 +10,7 @@ class UIPrinter : NSObject { var supportsColor: Bool { get } var supportsDuplex: Bool { get } func contactPrinter(_ completionHandler: ((Bool) -> Void)? = nil) + func contactPrinter() async -> Bool } extension UIPrinter { @available(iOS 8.0, *) diff --git a/iOS/UIKit/UIScene.swift b/iOS/UIKit/UIScene.swift index 2ea0214..2bf554a 100644 --- a/iOS/UIKit/UIScene.swift +++ b/iOS/UIKit/UIScene.swift @@ -6,6 +6,7 @@ class UIScene : UIResponder { var delegate: UISceneDelegate? var activationState: UIScene.ActivationState { get } func open(_ url: URL, options: UIScene.OpenExternalURLOptions?, completionHandler completion: ((Bool) -> Void)? = nil) + func open(_ url: URL, options: UIScene.OpenExternalURLOptions?) async -> Bool var title: String! var activationConditions: UISceneActivationConditions } diff --git a/iOS/UIKit/UIScreenshotService.swift b/iOS/UIKit/UIScreenshotService.swift index 4149a4e..6ef6b05 100644 --- a/iOS/UIKit/UIScreenshotService.swift +++ b/iOS/UIKit/UIScreenshotService.swift @@ -11,4 +11,6 @@ extension UIWindowScene { protocol UIScreenshotServiceDelegate : NSObjectProtocol { @available(iOS 13.0, *) optional func screenshotService(_ screenshotService: UIScreenshotService, generatePDFRepresentationWithCompletion completionHandler: @escaping (Data?, Int, CGRect) -> Void) + @available(iOS 13.0, *) + optional func screenshotServiceGeneratePDFRepresentation(_ screenshotService: UIScreenshotService) async -> (Data?, Int, CGRect) } diff --git a/iOS/UIKit/UITableView.swift b/iOS/UIKit/UITableView.swift index eb16a6c..98e0f2c 100644 --- a/iOS/UIKit/UITableView.swift +++ b/iOS/UIKit/UITableView.swift @@ -210,6 +210,8 @@ class UITableView : UIScrollView, NSCoding, UIDataSourceTranslating { func scrollToNearestSelectedRow(at scrollPosition: UITableView.ScrollPosition, animated: Bool) @available(iOS 11.0, *) func performBatchUpdates(_ updates: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + @available(iOS 11.0, *) + func performBatchUpdates(_ updates: (() -> Void)?) async -> Bool func beginUpdates() func endUpdates() func insertSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) diff --git a/iOS/UIKit/UIView.swift b/iOS/UIKit/UIView.swift index b0f83d2..c945d61 100644 --- a/iOS/UIKit/UIView.swift +++ b/iOS/UIKit/UIView.swift @@ -247,17 +247,29 @@ extension UIView { @available(iOS 4.0, *) class func animate(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(iOS 4.0, *) + class func animate(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.AnimationOptions = [], animations: @escaping () -> Void) async -> Bool + @available(iOS 4.0, *) class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(iOS 4.0, *) + class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void) async -> Bool + @available(iOS 4.0, *) class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void) @available(iOS 7.0, *) class func animate(withDuration duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping dampingRatio: CGFloat, initialSpringVelocity velocity: CGFloat, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) + @available(iOS 7.0, *) + class func animate(withDuration duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping dampingRatio: CGFloat, initialSpringVelocity velocity: CGFloat, options: UIView.AnimationOptions = [], animations: @escaping () -> Void) async -> Bool @available(iOS 4.0, *) class func transition(with view: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) @available(iOS 4.0, *) + class func transition(with view: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?) async -> Bool + @available(iOS 4.0, *) class func transition(from fromView: UIView, to toView: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], completion: ((Bool) -> Void)? = nil) + @available(iOS 4.0, *) + class func transition(from fromView: UIView, to toView: UIView, duration: TimeInterval, options: UIView.AnimationOptions = []) async -> Bool @available(iOS 7.0, *) class func perform(_ animation: UIView.SystemAnimation, on views: [UIView], options: UIView.AnimationOptions = [], animations parallelAnimations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + @available(iOS 7.0, *) + class func perform(_ animation: UIView.SystemAnimation, on views: [UIView], options: UIView.AnimationOptions = [], animations parallelAnimations: (() -> Void)?) async -> Bool @available(iOS 12.0, *) class func modifyAnimations(withRepeatCount count: CGFloat, autoreverses: Bool, animations: () -> Void) } @@ -265,6 +277,8 @@ extension UIView { @available(iOS 7.0, *) class func animateKeyframes(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.KeyframeAnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(iOS 7.0, *) + class func animateKeyframes(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.KeyframeAnimationOptions = [], animations: @escaping () -> Void) async -> Bool + @available(iOS 7.0, *) class func addKeyframe(withRelativeStartTime frameStartTime: Double, relativeDuration frameDuration: Double, animations: @escaping () -> Void) } extension UIView { diff --git a/iOS/UIKit/UIViewAnimating.swift b/iOS/UIKit/UIViewAnimating.swift index ddb6341..56048d1 100644 --- a/iOS/UIKit/UIViewAnimating.swift +++ b/iOS/UIKit/UIViewAnimating.swift @@ -33,5 +33,7 @@ protocol UIViewImplicitlyAnimating : UIViewAnimating { optional func addAnimations(_ animation: @escaping () -> Void) @available(iOS 10.0, *) optional func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void) + @available(iOS 10.0, *) + optional func addCompletion() async -> UIViewAnimatingPosition optional func continueAnimation(withTimingParameters parameters: UITimingCurveProvider?, durationFactor: CGFloat) } diff --git a/iOS/UIKit/UIViewController.swift b/iOS/UIKit/UIViewController.swift index 053a09f..8c5ad6c 100644 --- a/iOS/UIKit/UIViewController.swift +++ b/iOS/UIKit/UIViewController.swift @@ -119,7 +119,11 @@ class UIViewController : UIResponder, NSCoding, UIAppearanceContainer, UITraitEn @available(iOS 5.0, *) func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) @available(iOS 5.0, *) + func present(_ viewControllerToPresent: UIViewController, animated flag: Bool) async + @available(iOS 5.0, *) func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) + @available(iOS 5.0, *) + func dismiss(animated flag: Bool) async @available(iOS 3.0, *) var modalTransitionStyle: UIModalTransitionStyle @available(iOS 3.2, *) @@ -192,6 +196,8 @@ extension UIViewController { @available(iOS 5.0, *) func transition(from fromViewController: UIViewController, to toViewController: UIViewController, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) @available(iOS 5.0, *) + func transition(from fromViewController: UIViewController, to toViewController: UIViewController, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?) async -> Bool + @available(iOS 5.0, *) func beginAppearanceTransition(_ isAppearing: Bool, animated: Bool) @available(iOS 5.0, *) func endAppearanceTransition() diff --git a/iOS/UIKit/UIWindowScene.swift b/iOS/UIKit/UIWindowScene.swift index 88049c7..53a9c49 100644 --- a/iOS/UIKit/UIWindowScene.swift +++ b/iOS/UIKit/UIWindowScene.swift @@ -14,6 +14,7 @@ protocol UIWindowSceneDelegate : UISceneDelegate { optional var window: UIWindow? { get set } optional func windowScene(_ windowScene: UIWindowScene, didUpdate previousCoordinateSpace: UICoordinateSpace, interfaceOrientation previousInterfaceOrientation: UIInterfaceOrientation, traitCollection previousTraitCollection: UITraitCollection) optional func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) + optional func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem) async -> Bool } extension UISceneSession.Role { @available(iOS 13.0, *) diff --git a/iOS/UserNotifications/UNUserNotificationCenter.swift b/iOS/UserNotifications/UNUserNotificationCenter.swift index ae103f2..90216ee 100644 --- a/iOS/UserNotifications/UNUserNotificationCenter.swift +++ b/iOS/UserNotifications/UNUserNotificationCenter.swift @@ -22,14 +22,20 @@ class UNUserNotificationCenter : NSObject { var supportsContentExtensions: Bool { get } class func current() -> UNUserNotificationCenter func requestAuthorization(options: UNAuthorizationOptions = [], completionHandler: @escaping (Bool, Error?) -> Void) + func requestAuthorization(options: UNAuthorizationOptions = []) async throws -> Bool func setNotificationCategories(_ categories: Set) func getNotificationCategories(completionHandler: @escaping (Set) -> Void) + func notificationCategories() async -> Set func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void) + func notificationSettings() async -> UNNotificationSettings func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func add(_ request: UNNotificationRequest) async throws func getPendingNotificationRequests(completionHandler: @escaping ([UNNotificationRequest]) -> Void) + func pendingNotificationRequests() async -> [UNNotificationRequest] func removePendingNotificationRequests(withIdentifiers identifiers: [String]) func removeAllPendingNotificationRequests() func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) -> Void) + func deliveredNotifications() async -> [UNNotification] func removeDeliveredNotifications(withIdentifiers identifiers: [String]) func removeAllDeliveredNotifications() } @@ -51,7 +57,11 @@ protocol UNUserNotificationCenterDelegate : NSObjectProtocol { @available(iOS 10.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) @available(iOS 10.0, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions + @available(iOS 10.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) + @available(iOS 10.0, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async @available(iOS 12.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification?) } diff --git a/iOS/UserNotificationsUI/UNNotificationContentExtension.swift b/iOS/UserNotificationsUI/UNNotificationContentExtension.swift index 98c46b3..c5b5af0 100644 --- a/iOS/UserNotificationsUI/UNNotificationContentExtension.swift +++ b/iOS/UserNotificationsUI/UNNotificationContentExtension.swift @@ -19,6 +19,7 @@ enum UNNotificationContentExtensionResponseOption : UInt { protocol UNNotificationContentExtension : NSObjectProtocol { func didReceive(_ notification: UNNotification) optional func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) + optional func didReceive(_ response: UNNotificationResponse) async -> UNNotificationContentExtensionResponseOption optional var mediaPlayPauseButtonType: UNNotificationContentExtensionMediaPlayPauseButtonType { get } optional var mediaPlayPauseButtonFrame: CGRect { get } @NSCopying optional var mediaPlayPauseButtonTintColor: UIColor { get } diff --git a/iOS/VideoSubscriberAccount/VSAccountManager.swift b/iOS/VideoSubscriberAccount/VSAccountManager.swift index d311acb..f792cea 100644 --- a/iOS/VideoSubscriberAccount/VSAccountManager.swift +++ b/iOS/VideoSubscriberAccount/VSAccountManager.swift @@ -24,6 +24,7 @@ extension VSCheckAccessOption { class VSAccountManager : NSObject { weak var delegate: @sil_weak VSAccountManagerDelegate? func checkAccessStatus(options: [VSCheckAccessOption : Any] = [:], completionHandler: @escaping (VSAccountAccessStatus, Error?) -> Void) + func checkAccessStatus(options: [VSCheckAccessOption : Any] = [:]) async throws -> VSAccountAccessStatus func enqueue(_ request: VSAccountMetadataRequest, completionHandler: @escaping (VSAccountMetadata?, Error?) -> Void) -> VSAccountManagerResult } @available(iOS 10.0, *) diff --git a/iOS/WebKit/NSAttributedString.swift b/iOS/WebKit/NSAttributedString.swift index 19b0962..3724ea2 100644 --- a/iOS/WebKit/NSAttributedString.swift +++ b/iOS/WebKit/NSAttributedString.swift @@ -11,9 +11,17 @@ extension NSAttributedString { @available(iOS 13.0, *) class func loadFromHTML(request: URLRequest, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(iOS 13.0, *) + class func loadFromHTML(request: URLRequest, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(iOS 13.0, *) class func loadFromHTML(fileURL: URL, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(iOS 13.0, *) + class func loadFromHTML(fileURL: URL, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(iOS 13.0, *) class func loadFromHTML(string: String, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(iOS 13.0, *) + class func loadFromHTML(string: String, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(iOS 13.0, *) class func loadFromHTML(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) + @available(iOS 13.0, *) + class func loadFromHTML(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) } diff --git a/iOS/WebKit/WKContentRuleListStore.swift b/iOS/WebKit/WKContentRuleListStore.swift index 25110b1..3df2b56 100644 --- a/iOS/WebKit/WKContentRuleListStore.swift +++ b/iOS/WebKit/WKContentRuleListStore.swift @@ -4,7 +4,11 @@ class WKContentRuleListStore : NSObject { class func `default`() -> Self! convenience init!(url: URL!) func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!, completionHandler: ((WKContentRuleList?, Error?) -> Void)!) + func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!) async throws -> WKContentRuleList? func lookUpContentRuleList(forIdentifier identifier: String!, completionHandler: ((WKContentRuleList?, Error?) -> Void)!) + func lookUpContentRuleList(forIdentifier identifier: String!) async throws -> WKContentRuleList? func removeContentRuleList(forIdentifier identifier: String!, completionHandler: ((Error?) -> Void)!) + func removeContentRuleList(forIdentifier identifier: String!) async throws func getAvailableContentRuleListIdentifiers(_ completionHandler: (([String]?) -> Void)!) + func availableContentRuleListIdentifiers() async -> [String]? } diff --git a/iOS/WebKit/WKHTTPCookieStore.swift b/iOS/WebKit/WKHTTPCookieStore.swift index d951ea7..7e6795f 100644 --- a/iOS/WebKit/WKHTTPCookieStore.swift +++ b/iOS/WebKit/WKHTTPCookieStore.swift @@ -6,8 +6,11 @@ protocol WKHTTPCookieStoreObserver : NSObjectProtocol { @available(iOS 11.0, *) class WKHTTPCookieStore : NSObject { func getAllCookies(_ completionHandler: @escaping ([HTTPCookie]) -> Void) + func allCookies() async -> [HTTPCookie] func setCookie(_ cookie: HTTPCookie, completionHandler: (() -> Void)? = nil) + func setCookie(_ cookie: HTTPCookie) async func delete(_ cookie: HTTPCookie, completionHandler: (() -> Void)? = nil) + func delete(_ cookie: HTTPCookie) async func add(_ observer: WKHTTPCookieStoreObserver) func remove(_ observer: WKHTTPCookieStoreObserver) } diff --git a/iOS/WebKit/WKNavigationDelegate.swift b/iOS/WebKit/WKNavigationDelegate.swift index 5ebea85..f49f9fd 100644 --- a/iOS/WebKit/WKNavigationDelegate.swift +++ b/iOS/WebKit/WKNavigationDelegate.swift @@ -34,6 +34,8 @@ protocol WKNavigationDelegate : NSObjectProtocol { optional func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) @available(iOS 8.0, *) optional func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + @available(iOS 8.0, *) + optional func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(iOS 9.0, *) optional func webViewWebContentProcessDidTerminate(_ webView: WKWebView) @available(iOS 14.0, *) diff --git a/iOS/WebKit/WKUIDelegate.swift b/iOS/WebKit/WKUIDelegate.swift index aef90b2..2c56689 100644 --- a/iOS/WebKit/WKUIDelegate.swift +++ b/iOS/WebKit/WKUIDelegate.swift @@ -7,9 +7,15 @@ protocol WKUIDelegate : NSObjectProtocol { @available(iOS 8.0, *) optional func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) @available(iOS 8.0, *) + optional func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async + @available(iOS 8.0, *) optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) @available(iOS 8.0, *) + optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async -> Bool + @available(iOS 8.0, *) optional func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) + @available(iOS 8.0, *) + optional func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo) async -> String? @available(iOS, introduced: 10.0, deprecated: 13.0) optional func webView(_ webView: WKWebView, shouldPreviewElement elementInfo: WKPreviewElementInfo) -> Bool @available(iOS, introduced: 10.0, deprecated: 13.0) @@ -19,6 +25,8 @@ protocol WKUIDelegate : NSObjectProtocol { @available(iOS 13.0, *) optional func webView(_ webView: WKWebView, contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo, completionHandler: @escaping (UIContextMenuConfiguration?) -> Void) @available(iOS 13.0, *) + optional func webView(_ webView: WKWebView, contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo) async -> UIContextMenuConfiguration? + @available(iOS 13.0, *) optional func webView(_ webView: WKWebView, contextMenuWillPresentForElement elementInfo: WKContextMenuElementInfo) @available(iOS 13.0, *) optional func webView(_ webView: WKWebView, contextMenuForElement elementInfo: WKContextMenuElementInfo, willCommitWithAnimator animator: UIContextMenuInteractionCommitAnimating) diff --git a/iOS/WebKit/WKWebView.swift b/iOS/WebKit/WKWebView.swift index c74e7b1..da35286 100644 --- a/iOS/WebKit/WKWebView.swift +++ b/iOS/WebKit/WKWebView.swift @@ -28,16 +28,27 @@ class WKWebView : UIView { func reloadFromOrigin() -> WKNavigation? func stopLoading() func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil) + func evaluateJavaScript(_ javaScriptString: String) async throws -> Any @available(iOS 14.0, *) func __evaluateJavaScript(_ javaScriptString: String, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld, completionHandler: ((Any?, Error?) -> Void)? = nil) @available(iOS 14.0, *) + func __evaluateJavaScript(_ javaScriptString: String, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld) async throws -> Any + @available(iOS 14.0, *) func __callAsyncJavaScript(_ functionBody: String, arguments: [String : Any]?, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld, completionHandler: ((Any?, Error?) -> Void)? = nil) + @available(iOS 14.0, *) + func __callAsyncJavaScript(_ functionBody: String, arguments: [String : Any]?, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld) async throws -> Any @available(iOS 11.0, *) func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (UIImage?, Error?) -> Void) + @available(iOS 11.0, *) + func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?) async throws -> UIImage @available(iOS 14.0, *) func __createPDF(with pdfConfiguration: WKPDFConfiguration?, completionHandler: @escaping (Data?, Error?) -> Void) @available(iOS 14.0, *) + func __createPDF(with pdfConfiguration: WKPDFConfiguration?) async throws -> Data + @available(iOS 14.0, *) func __createWebArchiveData(completionHandler: @escaping (Data, Error) -> Void) + @available(iOS 14.0, *) + func __createWebArchiveData() async -> (Data, Error) var allowsBackForwardNavigationGestures: Bool @available(iOS 9.0, *) var customUserAgent: String? @@ -48,6 +59,8 @@ class WKWebView : UIView { var pageZoom: CGFloat @available(iOS 14.0, *) func __find(_ string: String, with configuration: WKFindConfiguration?, completionHandler: @escaping (WKFindResult) -> Void) + @available(iOS 14.0, *) + func __find(_ string: String, with configuration: WKFindConfiguration?) async -> WKFindResult @available(iOS 11.0, *) class func handlesURLScheme(_ urlScheme: String) -> Bool @available(iOS 14.0, *) diff --git a/iOS/WebKit/WKWebsiteDataStore.swift b/iOS/WebKit/WKWebsiteDataStore.swift index 95488f3..aaab218 100644 --- a/iOS/WebKit/WKWebsiteDataStore.swift +++ b/iOS/WebKit/WKWebsiteDataStore.swift @@ -6,8 +6,11 @@ class WKWebsiteDataStore : NSObject, NSSecureCoding { var isPersistent: Bool { get } class func allWebsiteDataTypes() -> Set func fetchDataRecords(ofTypes dataTypes: Set, completionHandler: @escaping ([WKWebsiteDataRecord]) -> Void) + func fetchDataRecords(ofTypes dataTypes: Set) async -> [WKWebsiteDataRecord] func removeData(ofTypes dataTypes: Set, for dataRecords: [WKWebsiteDataRecord], completionHandler: @escaping () -> Void) + func removeData(ofTypes dataTypes: Set, for dataRecords: [WKWebsiteDataRecord]) async func removeData(ofTypes dataTypes: Set, modifiedSince date: Date, completionHandler: @escaping () -> Void) + func removeData(ofTypes dataTypes: Set, modifiedSince date: Date) async @available(iOS 11.0, *) var httpCookieStore: WKHTTPCookieStore { get } } diff --git a/iOS/iAd/ADClient.swift b/iOS/iAd/ADClient.swift index 6c2158e..7cf78ca 100644 --- a/iOS/iAd/ADClient.swift +++ b/iOS/iAd/ADClient.swift @@ -24,10 +24,16 @@ class ADClient : NSObject { class func shared() -> ADClient @available(iOS, introduced: 7.1, deprecated: 9.0, message: "Use requestAttributionDetailsWithBlock instead.") func determineAppInstallationAttribution(completionHandler: @escaping (Bool) -> Void) + @available(iOS, introduced: 7.1, deprecated: 9.0, message: "Use requestAttributionDetailsWithBlock instead.") + func determineAppInstallationAttribution() async -> Bool @available(iOS, introduced: 8.0, deprecated: 9.0, message: "Use requestAttributionDetailsWithBlock instead.") func lookupAdConversionDetails(_ completionHandler: @escaping (Date?, Date?) -> Void) + @available(iOS, introduced: 8.0, deprecated: 9.0, message: "Use requestAttributionDetailsWithBlock instead.") + func lookupAdConversionDetails() async -> (Date?, Date?) @available(iOS 9.0, *) func requestAttributionDetails(_ completionHandler: @escaping ([String : NSObject]?, Error?) -> Void) + @available(iOS 9.0, *) + func requestAttributionDetailsWithBlock() async throws -> [String : NSObject] @available(iOS, introduced: 8.0, deprecated: 13.0) func add(toSegments segmentIdentifiers: [String], replaceExisting: Bool) } diff --git a/iOS/iAd/AVPlayerViewController_iAdPreroll.swift b/iOS/iAd/AVPlayerViewController_iAdPreroll.swift index 3d7a1fc..82c69fd 100644 --- a/iOS/iAd/AVPlayerViewController_iAdPreroll.swift +++ b/iOS/iAd/AVPlayerViewController_iAdPreroll.swift @@ -6,5 +6,7 @@ extension AVPlayerViewController { @available(iOS 8.0, *) func playPrerollAd(completionHandler: @escaping (Error?) -> Void) @available(iOS 8.0, *) + func playPrerollAd() async throws + @available(iOS 8.0, *) func cancelPreroll() } diff --git a/macOS/AVFoundation/AVAssetExportSession.swift b/macOS/AVFoundation/AVAssetExportSession.swift index 697989b..a7a680c 100644 --- a/macOS/AVFoundation/AVAssetExportSession.swift +++ b/macOS/AVFoundation/AVAssetExportSession.swift @@ -73,6 +73,7 @@ class AVAssetExportSession : NSObject { var status: AVAssetExportSession.Status { get } var error: Error? { get } func exportAsynchronously(completionHandler handler: @escaping () -> Void) + func export() async var progress: Float { get } func cancelExport() } @@ -81,11 +82,15 @@ extension AVAssetExportSession { class func exportPresets(compatibleWith asset: AVAsset) -> [String] @available(macOS 10.9, *) class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?, completionHandler handler: @escaping (Bool) -> Void) + @available(macOS 10.9, *) + class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?) async -> Bool } extension AVAssetExportSession { var supportedFileTypes: [AVFileType] { get } @available(macOS 10.9, *) func determineCompatibleFileTypes(completionHandler handler: @escaping ([AVFileType]) -> Void) + @available(macOS 10.9, *) + func determineCompatibleFileTypes() async -> [AVFileType] } extension AVAssetExportSession { var timeRange: CMTimeRange @@ -98,7 +103,11 @@ extension AVAssetExportSession { @available(macOS 10.15, *) func estimateMaximumDuration(completionHandler handler: @escaping (CMTime, Error?) -> Void) @available(macOS 10.15, *) + func estimateMaximumDuration() async throws -> CMTime + @available(macOS 10.15, *) func estimateOutputFileLength(completionHandler handler: @escaping (Int64, Error?) -> Void) + @available(macOS 10.15, *) + func estimateOutputFileLength() async throws -> Int64 } extension AVAssetExportSession { var metadata: [AVMetadataItem]? diff --git a/macOS/AVFoundation/AVAssetImageGenerator.swift b/macOS/AVFoundation/AVAssetImageGenerator.swift index e0d9069..4b97542 100644 --- a/macOS/AVFoundation/AVAssetImageGenerator.swift +++ b/macOS/AVFoundation/AVAssetImageGenerator.swift @@ -38,6 +38,7 @@ class AVAssetImageGenerator : NSObject { init(asset: AVAsset) func copyCGImage(at requestedTime: CMTime, actualTime: UnsafeMutablePointer?) throws -> CGImage func generateCGImagesAsynchronously(forTimes requestedTimes: [NSValue], completionHandler handler: @escaping AVAssetImageGeneratorCompletionHandler) + func generateCGImages(forTimes requestedTimes: [NSValue]) async throws -> (CMTime, CGImage, CMTime, AVAssetImageGenerator.Result) func cancelAllCGImageGeneration() } typealias AVAssetImageGeneratorCompletionHandler = (CMTime, CGImage?, CMTime, AVAssetImageGenerator.Result, Error?) -> Void diff --git a/macOS/AVFoundation/AVAssetWriter.swift b/macOS/AVFoundation/AVAssetWriter.swift index 5502595..8576157 100644 --- a/macOS/AVFoundation/AVAssetWriter.swift +++ b/macOS/AVFoundation/AVAssetWriter.swift @@ -35,6 +35,8 @@ class AVAssetWriter : NSObject { func cancelWriting() @available(macOS 10.9, *) func finishWriting(completionHandler handler: @escaping () -> Void) + @available(macOS 10.9, *) + func finishWriting() async } extension AVAssetWriter { var movieFragmentInterval: CMTime diff --git a/macOS/AVFoundation/AVAsynchronousKeyValueLoading.swift b/macOS/AVFoundation/AVAsynchronousKeyValueLoading.swift index a340868..22888c5 100644 --- a/macOS/AVFoundation/AVAsynchronousKeyValueLoading.swift +++ b/macOS/AVFoundation/AVAsynchronousKeyValueLoading.swift @@ -11,4 +11,5 @@ enum AVKeyValueStatus : Int { protocol AVAsynchronousKeyValueLoading { func statusOfValue(forKey key: String, error outError: NSErrorPointer) -> AVKeyValueStatus func loadValuesAsynchronously(forKeys keys: [String], completionHandler handler: (() -> Void)? = nil) + func loadValues(forKeys keys: [String]) async } diff --git a/macOS/AVFoundation/AVCaptureDevice.swift b/macOS/AVFoundation/AVCaptureDevice.swift index 01b1bfe..3646514 100644 --- a/macOS/AVFoundation/AVCaptureDevice.swift +++ b/macOS/AVFoundation/AVCaptureDevice.swift @@ -206,6 +206,8 @@ extension AVCaptureDevice { class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus @available(macOS 10.14, *) class func requestAccess(for mediaType: AVMediaType, completionHandler handler: @escaping (Bool) -> Void) + @available(macOS 10.14, *) + class func requestAccess(for mediaType: AVMediaType) async -> Bool } extension AVCaptureDevice { var transportControlsSupported: Bool { get } diff --git a/macOS/AVFoundation/AVCaptureStillImageOutput.swift b/macOS/AVFoundation/AVCaptureStillImageOutput.swift index df3244d..c5e82fa 100644 --- a/macOS/AVFoundation/AVCaptureStillImageOutput.swift +++ b/macOS/AVFoundation/AVCaptureStillImageOutput.swift @@ -9,6 +9,7 @@ class AVCaptureStillImageOutput : AVCaptureOutput { @available(macOS 10.8, *) var isCapturingStillImage: Bool { get } func captureStillImageAsynchronously(from connection: AVCaptureConnection, completionHandler handler: @escaping (CMSampleBuffer?, Error?) -> Void) + func captureStillImage(from connection: AVCaptureConnection) async throws -> CMSampleBuffer class func jpegStillImageNSDataRepresentation(_ jpegSampleBuffer: CMSampleBuffer) -> Data? } extension AVCaptureStillImageOutput { diff --git a/macOS/AVFoundation/AVContentKeySession.swift b/macOS/AVFoundation/AVContentKeySession.swift index 0b760e3..5a2294b 100644 --- a/macOS/AVFoundation/AVContentKeySession.swift +++ b/macOS/AVFoundation/AVContentKeySession.swift @@ -30,9 +30,15 @@ class AVContentKeySession : NSObject { @available(macOS 10.15, *) func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data, completionHandler handler: @escaping (Data?, Error?) -> Void) @available(macOS 10.15, *) + func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data) async throws -> Data + @available(macOS 10.15, *) func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) @available(macOS 10.15, *) + func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data + @available(macOS 10.15, *) func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + @available(macOS 10.15, *) + func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data } struct AVContentKeySessionServerPlaybackContextOption : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(rawValue: String) @@ -106,6 +112,7 @@ class AVContentKeyRequest : NSObject { var options: [String : Any] { get } var canProvidePersistableContentKey: Bool { get } func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil) async throws -> Data func processContentKeyResponse(_ keyResponse: AVContentKeyResponse) func processContentKeyResponseError(_ error: Error) @available(macOS 10.15, *) diff --git a/macOS/AVFoundation/AVPlayer.swift b/macOS/AVFoundation/AVPlayer.swift index 6f75389..c476504 100644 --- a/macOS/AVFoundation/AVPlayer.swift +++ b/macOS/AVFoundation/AVPlayer.swift @@ -66,12 +66,18 @@ extension AVPlayer { func seek(to date: Date) @available(macOS 10.7, *) func seek(to date: Date, completionHandler: @escaping (Bool) -> Void) + @available(macOS 10.7, *) + func seek(to date: Date) async -> Bool func seek(to time: CMTime) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) @available(macOS 10.7, *) func seek(to time: CMTime, completionHandler: @escaping (Bool) -> Void) @available(macOS 10.7, *) + func seek(to time: CMTime) async -> Bool + @available(macOS 10.7, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: @escaping (Bool) -> Void) + @available(macOS 10.7, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool } extension AVPlayer { @available(macOS 10.12, *) @@ -81,6 +87,8 @@ extension AVPlayer { @available(macOS 10.8, *) func preroll(atRate rate: Float, completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.8, *) + func preroll(atRate rate: Float) async -> Bool + @available(macOS 10.8, *) func cancelPendingPrerolls() @available(macOS 10.8, *) var masterClock: CMClock? diff --git a/macOS/AVFoundation/AVPlayerItem.swift b/macOS/AVFoundation/AVPlayerItem.swift index 470d6a9..cc18e2a 100644 --- a/macOS/AVFoundation/AVPlayerItem.swift +++ b/macOS/AVFoundation/AVPlayerItem.swift @@ -85,8 +85,12 @@ extension AVPlayerItem { @available(macOS 10.7, *) func seek(to time: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.7, *) + func seek(to time: CMTime) async -> Bool + @available(macOS 10.7, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.7, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool + @available(macOS 10.7, *) func cancelPendingSeeks() func currentDate() -> Date? @available(macOS 10.9, *) diff --git a/macOS/AVFoundation/AVPlayerItemProtectedContentAdditions.swift b/macOS/AVFoundation/AVPlayerItemProtectedContentAdditions.swift index 0f7e23b..0742d13 100644 --- a/macOS/AVFoundation/AVPlayerItemProtectedContentAdditions.swift +++ b/macOS/AVFoundation/AVPlayerItemProtectedContentAdditions.swift @@ -20,6 +20,8 @@ extension AVPlayerItem { @available(macOS 10.7, *) func requestContentAuthorizationAsynchronously(withTimeoutInterval timeoutInterval: TimeInterval, completionHandler handler: @escaping () -> Void) @available(macOS 10.7, *) + func requestContentAuthorization(withTimeoutInterval timeoutInterval: TimeInterval) async + @available(macOS 10.7, *) func cancelContentAuthorizationRequest() @available(macOS 10.7, *) var contentAuthorizationRequestStatus: AVContentAuthorizationStatus { get } diff --git a/macOS/AVFoundation/AVSampleBufferAudioRenderer.swift b/macOS/AVFoundation/AVSampleBufferAudioRenderer.swift index dfe5c63..9af9401 100644 --- a/macOS/AVFoundation/AVSampleBufferAudioRenderer.swift +++ b/macOS/AVFoundation/AVSampleBufferAudioRenderer.swift @@ -13,6 +13,7 @@ extension AVSampleBufferAudioRenderer { } extension AVSampleBufferAudioRenderer { func flush(fromSourceTime time: CMTime, completionHandler: @escaping (Bool) -> Void) + func flush(fromSourceTime time: CMTime) async -> Bool } extension NSNotification.Name { @available(macOS 10.13, *) diff --git a/macOS/AVFoundation/AVSampleBufferGenerator.swift b/macOS/AVFoundation/AVSampleBufferGenerator.swift index 4f6d3ca..abb2756 100644 --- a/macOS/AVFoundation/AVSampleBufferGenerator.swift +++ b/macOS/AVFoundation/AVSampleBufferGenerator.swift @@ -4,6 +4,7 @@ class AVSampleBufferGenerator : NSObject { init(asset: AVAsset, timebase: CMTimebase?) func createSampleBuffer(for request: AVSampleBufferRequest) -> CMSampleBuffer? class func notifyOfDataReady(for sbuf: CMSampleBuffer, completionHandler: @escaping (Bool, Error) -> Void) + class func notifyOfDataReady(for sbuf: CMSampleBuffer) async -> (Bool, Error) } extension AVSampleBufferRequest { enum Direction : Int { diff --git a/macOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift b/macOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift index 7eb6884..27b6813 100644 --- a/macOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift +++ b/macOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift @@ -15,6 +15,7 @@ extension AVSampleBufferRenderSynchronizer { var renderers: [AVQueuedSampleBufferRendering] { get } func addRenderer(_ renderer: AVQueuedSampleBufferRendering) func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime, completionHandler: ((Bool) -> Void)? = nil) + func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime) async -> Bool } extension AVSampleBufferRenderSynchronizer { func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any diff --git a/macOS/AVKit/AVPictureInPictureController.swift b/macOS/AVKit/AVPictureInPictureController.swift index ca41f6a..0f6f72e 100644 --- a/macOS/AVKit/AVPictureInPictureController.swift +++ b/macOS/AVKit/AVPictureInPictureController.swift @@ -23,4 +23,5 @@ protocol AVPictureInPictureControllerDelegate : NSObjectProtocol { optional func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController) async -> Bool } diff --git a/macOS/AVKit/AVPlayerView.swift b/macOS/AVKit/AVPlayerView.swift index e11042e..e9a3dc0 100644 --- a/macOS/AVKit/AVPlayerView.swift +++ b/macOS/AVKit/AVPlayerView.swift @@ -35,6 +35,7 @@ extension AVPlayerView { extension AVPlayerView { var canBeginTrimming: Bool { get } func beginTrimming(completionHandler handler: ((AVPlayerViewTrimResult) -> Void)? = nil) + func beginTrimming() async -> AVPlayerViewTrimResult } @available(macOS 10.9, *) enum AVPlayerViewTrimResult : Int { @@ -60,5 +61,6 @@ protocol AVPlayerViewPictureInPictureDelegate : NSObjectProtocol { optional func playerViewWillStopPicture(inPicture playerView: AVPlayerView) optional func playerViewDidStopPicture(inPicture playerView: AVPlayerView) optional func playerView(_ playerView: AVPlayerView, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + optional func playerViewRestoreUserInterfaceForPictureInPictureStop(_ playerView: AVPlayerView) async -> Bool optional func playerViewShouldAutomaticallyDismissAtPicture(inPictureStart playerView: AVPlayerView) -> Bool } diff --git a/macOS/Accounts/ACAccountStore.swift b/macOS/Accounts/ACAccountStore.swift index ad6fdad..b0c67e0 100644 --- a/macOS/Accounts/ACAccountStore.swift +++ b/macOS/Accounts/ACAccountStore.swift @@ -17,9 +17,13 @@ class ACAccountStore : NSObject { func accountType(withAccountTypeIdentifier typeIdentifier: String!) -> ACAccountType! func accounts(with accountType: ACAccountType!) -> [Any]! func saveAccount(_ account: ACAccount!, withCompletionHandler completionHandler: ACAccountStoreSaveCompletionHandler!) + func saveAccount(_ account: ACAccount!) async throws -> Bool func requestAccessToAccounts(with accountType: ACAccountType!, options: [AnyHashable : Any]! = [:], completion: ACAccountStoreRequestAccessCompletionHandler!) + func requestAccessToAccounts(with accountType: ACAccountType!, options: [AnyHashable : Any]! = [:]) async throws -> Bool func renewCredentials(for account: ACAccount!, completion completionHandler: ACAccountStoreCredentialRenewalHandler!) + func renewCredentials(for account: ACAccount!) async throws -> ACAccountCredentialRenewResult func removeAccount(_ account: ACAccount!, withCompletionHandler completionHandler: ACAccountStoreRemoveCompletionHandler!) + func removeAccount(_ account: ACAccount!) async throws -> Bool } extension NSNotification.Name { @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Public notification deprecated. Internal clients, see private header for replacement") diff --git a/macOS/AppKit/NSAlert.swift b/macOS/AppKit/NSAlert.swift index e382267..747c919 100644 --- a/macOS/AppKit/NSAlert.swift +++ b/macOS/AppKit/NSAlert.swift @@ -35,6 +35,8 @@ class NSAlert : NSObject { func runModal() -> NSApplication.ModalResponse @available(macOS 10.9, *) func beginSheetModal(for sheetWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil) + @available(macOS 10.9, *) + func beginSheetModal(for sheetWindow: NSWindow) async -> NSApplication.ModalResponse var window: NSWindow { get } } protocol NSAlertDelegate : NSObjectProtocol { diff --git a/macOS/AppKit/NSAnimationContext.swift b/macOS/AppKit/NSAnimationContext.swift index b9c3f05..4c91a48 100644 --- a/macOS/AppKit/NSAnimationContext.swift +++ b/macOS/AppKit/NSAnimationContext.swift @@ -3,6 +3,8 @@ class NSAnimationContext : NSObject { @available(macOS 10.7, *) class func runAnimationGroup(_ changes: (NSAnimationContext) -> Void, completionHandler: (() -> Void)? = nil) + @available(macOS 10.7, *) + class func runAnimationGroup(_ changes: (NSAnimationContext) -> Void) async @available(macOS 10.12, *) class func runAnimationGroup(_ changes: (NSAnimationContext) -> Void) class func beginGrouping() diff --git a/macOS/AppKit/NSCollectionView.swift b/macOS/AppKit/NSCollectionView.swift index 6740e32..90451e9 100644 --- a/macOS/AppKit/NSCollectionView.swift +++ b/macOS/AppKit/NSCollectionView.swift @@ -153,6 +153,8 @@ class NSCollectionView : NSView, NSDraggingSource, NSDraggingDestination { func moveItem(at indexPath: IndexPath, to newIndexPath: IndexPath) @available(macOS 10.11, *) func performBatchUpdates(_ updates: (() -> Void)?, completionHandler: ((Bool) -> Void)? = nil) + @available(macOS 10.11, *) + func performBatchUpdates(_ updates: (() -> Void)?) async -> Bool @available(macOS 10.12, *) @IBAction func toggleSectionCollapse(_ sender: Any) @available(macOS 10.11, *) diff --git a/macOS/AppKit/NSDocument.swift b/macOS/AppKit/NSDocument.swift index 34d16d0..2423b14 100644 --- a/macOS/AppKit/NSDocument.swift +++ b/macOS/AppKit/NSDocument.swift @@ -81,6 +81,8 @@ class NSDocument : NSObject, NSEditorRegistration, NSFilePresenter, NSMenuItemVa @available(macOS 10.7, *) func save(to url: URL, ofType typeName: String, for saveOperation: NSDocument.SaveOperationType, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.7, *) + func save(to url: URL, ofType typeName: String, for saveOperation: NSDocument.SaveOperationType) async throws + @available(macOS 10.7, *) func canAsynchronouslyWrite(to url: URL, ofType typeName: String, for saveOperation: NSDocument.SaveOperationType) -> Bool @available(macOS 10.7, *) func checkAutosavingSafety() throws @@ -91,6 +93,8 @@ class NSDocument : NSObject, NSEditorRegistration, NSFilePresenter, NSMenuItemVa @available(macOS 10.7, *) func autosave(withImplicitCancellability autosavingIsImplicitlyCancellable: Bool, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.7, *) + func autosave(withImplicitCancellability autosavingIsImplicitlyCancellable: Bool) async throws + @available(macOS 10.7, *) class var autosavesInPlace: Bool { get } @available(macOS 10.7, *) class var preservesVersions: Bool { get } @@ -100,6 +104,8 @@ class NSDocument : NSObject, NSEditorRegistration, NSFilePresenter, NSMenuItemVa var isBrowsingVersions: Bool { get } @available(macOS 10.12, *) func stopBrowsingVersions(completionHandler: (() -> Void)? = nil) + @available(macOS 10.12, *) + func stopBrowsingVersions() async @available(macOS 10.8, *) class var autosavesDrafts: Bool { get } var autosavingFileType: String? { get } @@ -121,20 +127,32 @@ class NSDocument : NSObject, NSEditorRegistration, NSFilePresenter, NSMenuItemVa @available(macOS 10.8, *) func move(completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.8, *) + func move() async -> Bool + @available(macOS 10.8, *) func move(to url: URL, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.8, *) + func move(to url: URL) async throws + @available(macOS 10.8, *) @IBAction func lock(_ sender: Any?) @available(macOS 10.8, *) @IBAction func unlock(_ sender: Any?) @available(macOS 10.8, *) func lock(completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.8, *) + func lock() async -> Bool + @available(macOS 10.8, *) func lock(completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.8, *) + func lock() async throws + @available(macOS 10.8, *) func unlock(completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.8, *) + func unlock() async -> Bool + @available(macOS 10.8, *) func unlock(completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.8, *) + func unlock() async throws + @available(macOS 10.8, *) var isLocked: Bool { get } @IBAction func runPageLayout(_ sender: Any?) func runModalPageLayout(with printInfo: NSPrintInfo, delegate: Any?, didRun didRunSelector: Selector?, contextInfo: UnsafeMutableRawPointer?) @@ -154,6 +172,8 @@ class NSDocument : NSObject, NSEditorRegistration, NSFilePresenter, NSMenuItemVa @available(macOS 10.13, *) func share(with sharingService: NSSharingService, completionHandler: ((Bool) -> Void)? = nil) @available(macOS 10.13, *) + func share(with sharingService: NSSharingService) async -> Bool + @available(macOS 10.13, *) func prepare(_ sharingServicePicker: NSSharingServicePicker) var isDocumentEdited: Bool { get } @available(macOS 10.7, *) diff --git a/macOS/AppKit/NSDocumentController.swift b/macOS/AppKit/NSDocumentController.swift index 8d72bec..8ee7874 100644 --- a/macOS/AppKit/NSDocumentController.swift +++ b/macOS/AppKit/NSDocumentController.swift @@ -17,12 +17,20 @@ class NSDocumentController : NSObject, NSCoding, NSMenuItemValidation, NSUserInt @available(macOS 10.8, *) func beginOpenPanel(completionHandler: @escaping ([URL]?) -> Void) @available(macOS 10.8, *) + func beginOpenPanel() async -> [URL]? + @available(macOS 10.8, *) func beginOpenPanel(_ openPanel: NSOpenPanel, forTypes inTypes: [String]?, completionHandler: @escaping (Int) -> Void) + @available(macOS 10.8, *) + func beginOpenPanel(_ openPanel: NSOpenPanel, forTypes inTypes: [String]?) async -> Int @available(macOS 10.7, *) func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) + @available(macOS 10.7, *) + func openDocument(withContentsOf url: URL, display displayDocument: Bool) async throws -> (NSDocument, Bool) func makeDocument(withContentsOf url: URL, ofType typeName: String) throws -> NSDocument @available(macOS 10.7, *) func reopenDocument(for urlOrNil: URL?, withContentsOf contentsURL: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) + @available(macOS 10.7, *) + func reopenDocument(for urlOrNil: URL?, withContentsOf contentsURL: URL, display displayDocument: Bool) async throws -> (NSDocument, Bool) func makeDocument(for urlOrNil: URL?, withContentsOf contentsURL: URL, ofType typeName: String) throws -> NSDocument var autosavingDelay: TimeInterval @IBAction func saveAllDocuments(_ sender: Any?) diff --git a/macOS/AppKit/NSFilePromiseProvider.swift b/macOS/AppKit/NSFilePromiseProvider.swift index 4118ac9..91ec4b4 100644 --- a/macOS/AppKit/NSFilePromiseProvider.swift +++ b/macOS/AppKit/NSFilePromiseProvider.swift @@ -12,5 +12,7 @@ protocol NSFilePromiseProviderDelegate : NSObjectProtocol { @available(macOS 10.12, *) func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.12, *) + func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL) async throws + @available(macOS 10.12, *) optional func operationQueue(for filePromiseProvider: NSFilePromiseProvider) -> OperationQueue } diff --git a/macOS/AppKit/NSPDFPanel.swift b/macOS/AppKit/NSPDFPanel.swift index f9117ec..2fcf067 100644 --- a/macOS/AppKit/NSPDFPanel.swift +++ b/macOS/AppKit/NSPDFPanel.swift @@ -15,4 +15,5 @@ class NSPDFPanel : NSObject { var options: NSPDFPanel.Options var defaultFileName: String func beginSheet(with pdfInfo: NSPDFInfo, modalFor docWindow: NSWindow?, completionHandler: @escaping (Int) -> Void) + func beginSheet(with pdfInfo: NSPDFInfo, modalFor docWindow: NSWindow?) async -> Int } diff --git a/macOS/AppKit/NSSavePanel.swift b/macOS/AppKit/NSSavePanel.swift index 55bb5ff..6346f2f 100644 --- a/macOS/AppKit/NSSavePanel.swift +++ b/macOS/AppKit/NSSavePanel.swift @@ -30,7 +30,11 @@ class NSSavePanel : NSPanel { @available(macOS 10.6, *) func beginSheetModal(for window: NSWindow, completionHandler handler: @escaping (NSApplication.ModalResponse) -> Void) @available(macOS 10.6, *) + func beginSheetModal(for window: NSWindow) async -> NSApplication.ModalResponse + @available(macOS 10.6, *) func begin(completionHandler handler: @escaping (NSApplication.ModalResponse) -> Void) + @available(macOS 10.6, *) + func begin() async -> NSApplication.ModalResponse func runModal() -> NSApplication.ModalResponse } protocol NSOpenSavePanelDelegate : NSObjectProtocol { diff --git a/macOS/AppKit/NSSpellChecker.swift b/macOS/AppKit/NSSpellChecker.swift index d5b74c7..15e3721 100644 --- a/macOS/AppKit/NSSpellChecker.swift +++ b/macOS/AppKit/NSSpellChecker.swift @@ -69,6 +69,8 @@ class NSSpellChecker : NSObject { @available(macOS 10.7, *) func showCorrectionIndicator(of type: NSSpellChecker.CorrectionIndicatorType, primaryString: String, alternativeStrings: [String], forStringIn rectOfTypedString: NSRect, view: NSView, completionHandler completionBlock: ((String?) -> Void)? = nil) @available(macOS 10.7, *) + func showCorrectionIndicator(of type: NSSpellChecker.CorrectionIndicatorType, primaryString: String, alternativeStrings: [String], forStringIn rectOfTypedString: NSRect, view: NSView) async -> String? + @available(macOS 10.7, *) func dismissCorrectionIndicator(for view: NSView) @available(macOS 10.12, *) func preventsAutocorrection(before string: String, language: String?) -> Bool diff --git a/macOS/AppKit/NSTableViewDiffableDataSource.swift b/macOS/AppKit/NSTableViewDiffableDataSource.swift index be871d0..86544b8 100644 --- a/macOS/AppKit/NSTableViewDiffableDataSource.swift +++ b/macOS/AppKit/NSTableViewDiffableDataSource.swift @@ -5,6 +5,7 @@ class NSTableViewDiffableDataSourceReference NSDiffableDataSourceSnapshotReference func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool, completion: (() -> Void)? = nil) + func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) async func itemIdentifier(forRow row: Int) -> ItemIdentifierType? func row(forItemIdentifier identifier: ItemIdentifierType) -> Int func sectionIdentifier(forRow row: Int) -> SectionIdentifierType? diff --git a/macOS/AppKit/NSViewController.swift b/macOS/AppKit/NSViewController.swift index b5026df..e6d2f59 100644 --- a/macOS/AppKit/NSViewController.swift +++ b/macOS/AppKit/NSViewController.swift @@ -65,6 +65,8 @@ extension NSViewController { func present(_ viewController: NSViewController, asPopoverRelativeTo positioningRect: NSRect, of positioningView: NSView, preferredEdge: NSRectEdge, behavior: NSPopover.Behavior) @available(macOS 10.10, *) func transition(from fromViewController: NSViewController, to toViewController: NSViewController, options: NSViewController.TransitionOptions = [], completionHandler completion: (() -> Void)? = nil) + @available(macOS 10.10, *) + func transition(from fromViewController: NSViewController, to toViewController: NSViewController, options: NSViewController.TransitionOptions = []) async } extension NSViewController { @available(macOS 10.10, *) diff --git a/macOS/AppKit/NSWindow.swift b/macOS/AppKit/NSWindow.swift index 195d9ba..1c5eed2 100644 --- a/macOS/AppKit/NSWindow.swift +++ b/macOS/AppKit/NSWindow.swift @@ -413,8 +413,12 @@ class NSWindow : NSResponder, NSAnimatablePropertyContainer, NSMenuItemValidatio @available(macOS 10.9, *) func beginSheet(_ sheetWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil) @available(macOS 10.9, *) + func beginSheet(_ sheetWindow: NSWindow) async -> NSApplication.ModalResponse + @available(macOS 10.9, *) func beginCriticalSheet(_ sheetWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil) @available(macOS 10.9, *) + func beginCriticalSheet(_ sheetWindow: NSWindow) async -> NSApplication.ModalResponse + @available(macOS 10.9, *) func endSheet(_ sheetWindow: NSWindow) @available(macOS 10.9, *) func endSheet(_ sheetWindow: NSWindow, returnCode: NSApplication.ModalResponse) diff --git a/macOS/AppKit/NSWindowRestoration.swift b/macOS/AppKit/NSWindowRestoration.swift index be02b24..4637f55 100644 --- a/macOS/AppKit/NSWindowRestoration.swift +++ b/macOS/AppKit/NSWindowRestoration.swift @@ -2,6 +2,8 @@ protocol NSWindowRestoration : NSObjectProtocol { @available(macOS 10.7, *) static func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: @escaping (NSWindow?, Error?) -> Void) + @available(macOS 10.7, *) + static func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder) async throws -> NSWindow } extension NSDocumentController : NSWindowRestoration { } @@ -43,6 +45,8 @@ extension NSDocument { @available(macOS 10.7, *) func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: @escaping (NSWindow?, Error?) -> Void) @available(macOS 10.7, *) + func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder) async throws -> NSWindow + @available(macOS 10.7, *) func encodeRestorableState(with coder: NSCoder) @available(macOS 10.13, *) func encodeRestorableState(with coder: NSCoder, backgroundQueue queue: OperationQueue) diff --git a/macOS/AppKit/NSWorkspace.swift b/macOS/AppKit/NSWorkspace.swift index 56adf0d..fe04084 100644 --- a/macOS/AppKit/NSWorkspace.swift +++ b/macOS/AppKit/NSWorkspace.swift @@ -6,9 +6,15 @@ class NSWorkspace : NSObject { @available(macOS 10.15, *) func open(_ url: URL, configuration: NSWorkspace.OpenConfiguration, completionHandler: ((NSRunningApplication?, Error?) -> Void)? = nil) @available(macOS 10.15, *) + func open(_ url: URL, configuration: NSWorkspace.OpenConfiguration) async throws -> NSRunningApplication + @available(macOS 10.15, *) func open(_ urls: [URL], withApplicationAt applicationURL: URL, configuration: NSWorkspace.OpenConfiguration, completionHandler: ((NSRunningApplication?, Error?) -> Void)? = nil) @available(macOS 10.15, *) + func open(_ urls: [URL], withApplicationAt applicationURL: URL, configuration: NSWorkspace.OpenConfiguration) async throws -> NSRunningApplication + @available(macOS 10.15, *) func openApplication(at applicationURL: URL, configuration: NSWorkspace.OpenConfiguration, completionHandler: ((NSRunningApplication?, Error?) -> Void)? = nil) + @available(macOS 10.15, *) + func openApplication(at applicationURL: URL, configuration: NSWorkspace.OpenConfiguration) async throws -> NSRunningApplication func selectFile(_ fullPath: String?, inFileViewerRootedAtPath rootFullPath: String) -> Bool @available(macOS 10.6, *) func activateFileViewerSelecting(_ fileURLs: [URL]) @@ -26,7 +32,11 @@ class NSWorkspace : NSObject { @available(macOS 10.6, *) func recycle(_ URLs: [URL], completionHandler handler: (([URL : URL], Error?) -> Void)? = nil) @available(macOS 10.6, *) + func recycle(_ URLs: [URL]) async throws -> [URL : URL] + @available(macOS 10.6, *) func duplicate(_ URLs: [URL], completionHandler handler: (([URL : URL], Error?) -> Void)? = nil) + @available(macOS 10.6, *) + func duplicate(_ URLs: [URL]) async throws -> [URL : URL] func getFileSystemInfo(forPath fullPath: String, isRemovable removableFlag: UnsafeMutablePointer?, isWritable writableFlag: UnsafeMutablePointer?, isUnmountable unmountableFlag: UnsafeMutablePointer?, description: AutoreleasingUnsafeMutablePointer?, type fileSystemType: AutoreleasingUnsafeMutablePointer?) -> Bool func unmountAndEjectDevice(atPath path: String) -> Bool @available(macOS 10.6, *) @@ -182,6 +192,8 @@ extension NSWorkspace { extension NSWorkspace { @available(macOS 10.14, *) func requestAuthorization(to type: NSWorkspace.AuthorizationType, completionHandler: @escaping (NSWorkspace.Authorization?, Error?) -> Void) + @available(macOS 10.14, *) + func requestAuthorization(to type: NSWorkspace.AuthorizationType) async throws -> NSWorkspace.Authorization } extension FileManager { @available(macOS 10.14, *) diff --git a/macOS/AppTrackingTransparency/AppTrackingTransparency.swift b/macOS/AppTrackingTransparency/AppTrackingTransparency.swift index 77eeb83..001b32c 100644 --- a/macOS/AppTrackingTransparency/AppTrackingTransparency.swift +++ b/macOS/AppTrackingTransparency/AppTrackingTransparency.swift @@ -14,5 +14,6 @@ extension ATTrackingManager { class ATTrackingManager : NSObject { class var trackingAuthorizationStatus: ATTrackingManager.AuthorizationStatus { get } class func requestTrackingAuthorization(completionHandler completion: @escaping (ATTrackingManager.AuthorizationStatus) -> Void) + class func requestTrackingAuthorization() async -> ATTrackingManager.AuthorizationStatus } var AppTrackingTransparencyVersionNumber: Double diff --git a/macOS/AudioToolbox/AUAudioUnit.swift b/macOS/AudioToolbox/AUAudioUnit.swift index e53f655..c2728fa 100644 --- a/macOS/AudioToolbox/AUAudioUnit.swift +++ b/macOS/AudioToolbox/AUAudioUnit.swift @@ -33,6 +33,7 @@ class AUAudioUnit : NSObject { init(componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) throws convenience init(componentDescription: AudioComponentDescription) throws class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = [], completionHandler: @escaping (AUAudioUnit?, Error?) -> Void) + class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) async throws -> AUAudioUnit var componentDescription: AudioComponentDescription { get } var component: AudioComponent { get } var componentName: String? { get } diff --git a/macOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift b/macOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift index 5f33d66..1dca871 100644 --- a/macOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift +++ b/macOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift @@ -16,4 +16,5 @@ extension ASAuthorizationAppleIDProvider { class ASAuthorizationAppleIDProvider : NSObject, ASAuthorizationProvider { func createRequest() -> ASAuthorizationAppleIDRequest func getCredentialState(forUserID userID: String, completion: @escaping (ASAuthorizationAppleIDProvider.CredentialState, Error?) -> Void) + func credentialState(forUserID userID: String) async throws -> ASAuthorizationAppleIDProvider.CredentialState } diff --git a/macOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift b/macOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift index d1ea0b1..f8d7caf 100644 --- a/macOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift +++ b/macOS/AuthenticationServices/ASAuthorizationProviderExtensionAuthorizationRequest.swift @@ -24,6 +24,7 @@ class ASAuthorizationProviderExtensionAuthorizationRequest : NSObject { func complete(httpResponse: HTTPURLResponse, httpBody: Data?) func complete(error: Error) func presentAuthorizationViewController(completion: @escaping (Bool, Error?) -> Void) + func presentAuthorizationViewController() async throws -> Bool var url: URL { get } var requestedOperation: ASAuthorizationProviderAuthorizationOperation { get } var httpHeaders: [String : String] { get } diff --git a/macOS/AuthenticationServices/ASCredentialIdentityStore.swift b/macOS/AuthenticationServices/ASCredentialIdentityStore.swift index 2c67bd6..6097700 100644 --- a/macOS/AuthenticationServices/ASCredentialIdentityStore.swift +++ b/macOS/AuthenticationServices/ASCredentialIdentityStore.swift @@ -14,8 +14,13 @@ struct ASCredentialIdentityStoreError : _BridgedStoredNSError { class ASCredentialIdentityStore : NSObject { class var shared: ASCredentialIdentityStore { get } func getState(_ completion: @escaping (ASCredentialIdentityStoreState) -> Void) + func getState() async -> ASCredentialIdentityStoreState func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool func removeCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func removeCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool func removeAllCredentialIdentities(_ completion: ((Bool, Error?) -> Void)? = nil) + func removeAllCredentialIdentities() async throws -> Bool func replaceCredentialIdentities(with newCredentialIdentities: [ASPasswordCredentialIdentity], completion: ((Bool, Error?) -> Void)? = nil) + func replaceCredentialIdentities(with newCredentialIdentities: [ASPasswordCredentialIdentity]) async throws -> Bool } diff --git a/macOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift b/macOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift index 825cf95..3f85764 100644 --- a/macOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift +++ b/macOS/AuthenticationServices/ASCredentialProviderExtensionContext.swift @@ -2,5 +2,6 @@ @available(macOS 11.0, *) class ASCredentialProviderExtensionContext : NSExtensionContext { func completeRequest(withSelectedCredential credential: ASPasswordCredential, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(withSelectedCredential credential: ASPasswordCredential) async -> Bool func completeExtensionConfigurationRequest() } diff --git a/macOS/CallKit/CXCallController.swift b/macOS/CallKit/CXCallController.swift index ecea656..42f06a4 100644 --- a/macOS/CallKit/CXCallController.swift +++ b/macOS/CallKit/CXCallController.swift @@ -4,6 +4,9 @@ class CXCallController : NSObject { init(queue: DispatchQueue) var callObserver: CXCallObserver { get } func request(_ transaction: CXTransaction, completion: @escaping (Error?) -> Void) + func request(_ transaction: CXTransaction) async throws func requestTransaction(with actions: [CXAction], completion: @escaping (Error?) -> Void) + func requestTransaction(with actions: [CXAction]) async throws func requestTransaction(with action: CXAction, completion: @escaping (Error?) -> Void) + func requestTransaction(with action: CXAction) async throws } diff --git a/macOS/CallKit/CXProvider.swift b/macOS/CallKit/CXProvider.swift index 160fbf1..bd30525 100644 --- a/macOS/CallKit/CXProvider.swift +++ b/macOS/CallKit/CXProvider.swift @@ -28,6 +28,7 @@ class CXProvider : NSObject { init(configuration: CXProviderConfiguration) func setDelegate(_ delegate: CXProviderDelegate?, queue: DispatchQueue?) func reportNewIncomingCall(with UUID: UUID, update: CXCallUpdate, completion: @escaping (Error?) -> Void) + func reportNewIncomingCall(with UUID: UUID, update: CXCallUpdate) async throws func reportCall(with UUID: UUID, updated update: CXCallUpdate) func reportCall(with UUID: UUID, endedAt dateEnded: Date?, reason endedReason: CXCallEndedReason) func reportOutgoingCall(with UUID: UUID, startedConnectingAt dateStartedConnecting: Date?) diff --git a/macOS/ClassKit/CLSContext.swift b/macOS/ClassKit/CLSContext.swift index 1456c9c..88ce6f6 100644 --- a/macOS/ClassKit/CLSContext.swift +++ b/macOS/ClassKit/CLSContext.swift @@ -89,4 +89,5 @@ extension CLSContext { func removeFromParent() func addChildContext(_ child: CLSContext) func descendant(matchingIdentifierPath identifierPath: [String], completion: @escaping (CLSContext?, Error?) -> Void) + func descendant(matchingIdentifierPath identifierPath: [String]) async throws -> CLSContext } diff --git a/macOS/ClassKit/CLSContextProvider.swift b/macOS/ClassKit/CLSContextProvider.swift index a9d7137..c50a927 100644 --- a/macOS/ClassKit/CLSContextProvider.swift +++ b/macOS/ClassKit/CLSContextProvider.swift @@ -2,4 +2,5 @@ @available(macOS 11.0, *) protocol CLSContextProvider { func updateDescendants(of context: CLSContext, completion: @escaping (Error?) -> Void) + func updateDescendants(of context: CLSContext) async throws } diff --git a/macOS/ClassKit/CLSDataStore.swift b/macOS/ClassKit/CLSDataStore.swift index cf9bec9..2b8e711 100644 --- a/macOS/ClassKit/CLSDataStore.swift +++ b/macOS/ClassKit/CLSDataStore.swift @@ -11,12 +11,15 @@ class CLSDataStore : NSObject { var runningActivity: CLSActivity? { get } weak var delegate: @sil_weak CLSDataStoreDelegate? func save(completion: ((Error?) -> Void)? = nil) + func save() async throws @available(macOS 11.0, *) func completeAllAssignedActivities(matching contextPath: [String]) } @available(macOS 11.0, *) extension CLSDataStore { func contexts(matching predicate: NSPredicate, completion: @escaping ([CLSContext], Error?) -> Void) + func contexts(matching predicate: NSPredicate) async throws -> [CLSContext] func contexts(matchingIdentifierPath identifierPath: [String], completion: @escaping ([CLSContext], Error?) -> Void) + func contexts(matchingIdentifierPath identifierPath: [String]) async throws -> [CLSContext] func remove(_ context: CLSContext) } diff --git a/macOS/ClockKit/ClockKit.swift b/macOS/ClockKit/ClockKit.swift new file mode 100644 index 0000000..e69de29 diff --git a/macOS/CloudKit/CKContainer.swift b/macOS/CloudKit/CKContainer.swift index 76c41dd..832cee7 100644 --- a/macOS/CloudKit/CKContainer.swift +++ b/macOS/CloudKit/CKContainer.swift @@ -51,6 +51,7 @@ extension NSNotification.Name { } extension CKContainer { func accountStatus(completionHandler: @escaping (CKAccountStatus, Error?) -> Void) + func accountStatus() async throws -> CKAccountStatus } @available(macOS 10.10, *) struct CKContainer_Application_Permissions : OptionSet { @@ -70,34 +71,59 @@ enum CKContainer_Application_PermissionStatus : Int { typealias CKContainer_Application_PermissionBlock = (CKContainer_Application_PermissionStatus, Error?) -> Void extension CKContainer { func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus } extension CKContainer { func fetchUserRecordID(completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func fetchUserRecordID() async throws -> CKRecord.ID @available(macOS 10.12, *) func discoverAllIdentities(completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Void) @available(macOS 10.12, *) + func discoverAllIdentities() async throws -> [CKUserIdentity] + @available(macOS 10.12, *) func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(macOS 10.12, *) + func discoverUserIdentity(withEmailAddress email: String) async throws -> CKUserIdentity + @available(macOS 10.12, *) func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(macOS 10.12, *) + func discoverUserIdentity(withPhoneNumber phoneNumber: String) async throws -> CKUserIdentity + @available(macOS 10.12, *) func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) + @available(macOS 10.12, *) + func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity } extension CKContainer { @available(macOS 10.12, *) func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(macOS 10.12, *) + func fetchShareParticipant(withEmailAddress emailAddress: String) async throws -> CKShare.Participant + @available(macOS 10.12, *) func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(macOS 10.12, *) + func fetchShareParticipant(withPhoneNumber phoneNumber: String) async throws -> CKShare.Participant + @available(macOS 10.12, *) func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(macOS 10.12, *) + func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant + @available(macOS 10.12, *) func fetchShareMetadata(with url: URL, completionHandler: @escaping (CKShare.Metadata?, Error?) -> Void) @available(macOS 10.12, *) + func fetchShareMetadata(with url: URL) async throws -> CKShare.Metadata + @available(macOS 10.12, *) func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping (CKShare?, Error?) -> Void) + @available(macOS 10.12, *) + func accept(_ metadata: CKShare.Metadata) async throws -> CKShare } extension CKContainer { @available(macOS 10.12, *) func __fetchAllLongLivedOperationIDs(completionHandler: @escaping ([String]?, Error?) -> Void) @available(macOS 10.12, *) + func __fetchAllLongLivedOperationIDs() async throws -> [String] + @available(macOS 10.12, *) func __fetchLongLivedOperation(withID operationID: String, completionHandler: @escaping (CKOperation?, Error?) -> Void) + @available(macOS 10.12, *) + func __fetchLongLivedOperation(withID operationID: String) async throws -> CKOperation } diff --git a/macOS/CloudKit/CKDatabase.swift b/macOS/CloudKit/CKDatabase.swift index 19dabc3..b0d5367 100644 --- a/macOS/CloudKit/CKDatabase.swift +++ b/macOS/CloudKit/CKDatabase.swift @@ -25,19 +25,35 @@ class CKDatabase : NSObject { } extension CKDatabase { func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func fetch(withRecordID recordID: CKRecord.ID) async throws -> CKRecord func save(_ record: CKRecord, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func save(_ record: CKRecord) async throws -> CKRecord func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func delete(withRecordID recordID: CKRecord.ID) async throws -> CKRecord.ID func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?, completionHandler: @escaping ([CKRecord]?, Error?) -> Void) + func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?) async throws -> [CKRecord] func fetchAllRecordZones(completionHandler: @escaping ([CKRecordZone]?, Error?) -> Void) + func fetchAllRecordZones() async throws -> [CKRecordZone] func fetch(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func fetch(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone func save(_ zone: CKRecordZone, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func save(_ zone: CKRecordZone) async throws -> CKRecordZone func delete(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone.ID?, Error?) -> Void) + func delete(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone.ID @available(macOS 10.10, *) func __fetch(withSubscriptionID subscriptionID: String, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(macOS 10.10, *) + func __fetch(withSubscriptionID subscriptionID: String) async throws -> CKSubscription + @available(macOS 10.10, *) func fetchAllSubscriptions(completionHandler: @escaping ([CKSubscription]?, Error?) -> Void) @available(macOS 10.10, *) + func fetchAllSubscriptions() async throws -> [CKSubscription] + @available(macOS 10.10, *) func save(_ subscription: CKSubscription, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(macOS 10.10, *) + func save(_ subscription: CKSubscription) async throws -> CKSubscription + @available(macOS 10.10, *) func __delete(withSubscriptionID subscriptionID: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(macOS 10.10, *) + func __delete(withSubscriptionID subscriptionID: String) async throws -> String } diff --git a/macOS/Collaboration/CBIdentityPicker.swift b/macOS/Collaboration/CBIdentityPicker.swift index 7e5f534..3fc556b 100644 --- a/macOS/Collaboration/CBIdentityPicker.swift +++ b/macOS/Collaboration/CBIdentityPicker.swift @@ -7,5 +7,6 @@ class CBIdentityPicker : NSObject { @available(macOS, introduced: 10.5, deprecated: 10.11, message: "Use runModalForWindow:completionHandler: instead.") func runModal(for window: NSWindow, modalDelegate delegate: Any?, didEnd didEndSelector: Selector?, contextInfo: UnsafeMutableRawPointer?) func runModal(for window: NSWindow, completionHandler: ((NSApplication.ModalResponse) -> Void)? = nil) + func runModal(for window: NSWindow) async -> NSApplication.ModalResponse var identities: [CBIdentity] { get } } diff --git a/macOS/Contacts/CNContactStore.swift b/macOS/Contacts/CNContactStore.swift index 36b3f01..5769b82 100644 --- a/macOS/Contacts/CNContactStore.swift +++ b/macOS/Contacts/CNContactStore.swift @@ -18,6 +18,7 @@ enum CNAuthorizationStatus : Int { class CNContactStore : NSObject { class func authorizationStatus(for entityType: CNEntityType) -> CNAuthorizationStatus func requestAccess(for entityType: CNEntityType, completionHandler: @escaping (Bool, Error?) -> Void) + func requestAccess(for entityType: CNEntityType) async throws -> Bool func unifiedContacts(matching predicate: NSPredicate, keysToFetch keys: [CNKeyDescriptor]) throws -> [CNContact] func unifiedContact(withIdentifier identifier: String, keysToFetch keys: [CNKeyDescriptor]) throws -> CNContact @available(macOS 10.11, *) diff --git a/macOS/CoreAudioKit/AUViewController.swift b/macOS/CoreAudioKit/AUViewController.swift index ed44695..fca58d4 100644 --- a/macOS/CoreAudioKit/AUViewController.swift +++ b/macOS/CoreAudioKit/AUViewController.swift @@ -12,6 +12,7 @@ class AUAudioUnitViewConfiguration : NSObject, NSSecureCoding { @available(macOS 10.12, *) extension AUAudioUnit { func requestViewController(completionHandler: @escaping (NSViewController?) -> Void) + func requestViewController() async -> NSViewController? @available(macOS 10.13, *) func supportedViewConfigurations(_ availableViewConfigurations: [AUAudioUnitViewConfiguration]) -> IndexSet @available(macOS 10.13, *) diff --git a/macOS/CoreData/NSPersistentContainer.swift b/macOS/CoreData/NSPersistentContainer.swift index 5f47ab2..4affc56 100644 --- a/macOS/CoreData/NSPersistentContainer.swift +++ b/macOS/CoreData/NSPersistentContainer.swift @@ -10,6 +10,7 @@ class NSPersistentContainer : NSObject { convenience init(name: String) init(name: String, managedObjectModel model: NSManagedObjectModel) func loadPersistentStores(completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + func loadPersistentStores() async throws -> NSPersistentStoreDescription func newBackgroundContext() -> NSManagedObjectContext func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void) } diff --git a/macOS/CoreData/NSPersistentStoreCoordinator.swift b/macOS/CoreData/NSPersistentStoreCoordinator.swift index b3dd8c3..cad3010d 100644 --- a/macOS/CoreData/NSPersistentStoreCoordinator.swift +++ b/macOS/CoreData/NSPersistentStoreCoordinator.swift @@ -105,6 +105,8 @@ class NSPersistentStoreCoordinator : NSObject, NSLocking { func addPersistentStore(ofType storeType: String, configurationName configuration: String?, at storeURL: URL?, options: [AnyHashable : Any]? = nil) throws -> NSPersistentStore @available(macOS 10.12, *) func addPersistentStore(with storeDescription: NSPersistentStoreDescription, completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + @available(macOS 10.12, *) + func addPersistentStore(with storeDescription: NSPersistentStoreDescription) async throws -> NSPersistentStoreDescription func remove(_ store: NSPersistentStore) throws func setMetadata(_ metadata: [String : Any]?, for store: NSPersistentStore) func metadata(for store: NSPersistentStore) -> [String : Any] diff --git a/macOS/CoreFoundation/CFError.swift b/macOS/CoreFoundation/CFError.swift index 379007c..23df644 100644 --- a/macOS/CoreFoundation/CFError.swift +++ b/macOS/CoreFoundation/CFError.swift @@ -2,9 +2,6 @@ typealias CFErrorDomain = CFString class CFError : _CFObject { } - -extension CFError : Error { -} @available(macOS 10.5, *) func CFErrorGetTypeID() -> CFTypeID @available(macOS 10.5, *) diff --git a/macOS/CoreGraphics/CGAffineTransform.swift b/macOS/CoreGraphics/CGAffineTransform.swift index 0f9b482..43175ef 100644 --- a/macOS/CoreGraphics/CGAffineTransform.swift +++ b/macOS/CoreGraphics/CGAffineTransform.swift @@ -19,9 +19,6 @@ extension CGAffineTransform { extension CGAffineTransform : Codable { } - -extension CGAffineTransform : _ObjectiveCBridgeable { -} extension CGAffineTransform { @available(macOS 10.0, *) /*not inherited*/ init(translationX tx: CGFloat, y ty: CGFloat) diff --git a/macOS/CoreGraphics/CGGeometry.swift b/macOS/CoreGraphics/CGGeometry.swift index c4ec132..19ce78e 100644 --- a/macOS/CoreGraphics/CGGeometry.swift +++ b/macOS/CoreGraphics/CGGeometry.swift @@ -27,9 +27,6 @@ extension CGPoint : Equatable { extension CGPoint : Codable { } - -extension CGPoint : _ObjectiveCBridgeable { -} struct CGSize { var width: CGFloat var height: CGFloat @@ -58,9 +55,6 @@ extension CGSize : Equatable { extension CGSize : Codable { } - -extension CGSize : _ObjectiveCBridgeable { -} struct CGVector { var dx: CGFloat var dy: CGFloat @@ -82,9 +76,6 @@ extension CGVector : CustomDebugStringConvertible { extension CGVector : Codable { } - -extension CGVector : _ObjectiveCBridgeable { -} struct CGRect { var origin: CGPoint var size: CGSize @@ -115,9 +106,6 @@ extension CGRect : Equatable { extension CGRect : Codable { } - -extension CGRect : _ObjectiveCBridgeable { -} @frozen enum CGRectEdge : UInt32 { init?(rawValue: UInt32) var rawValue: UInt32 { get } @@ -126,10 +114,6 @@ extension CGRect : _ObjectiveCBridgeable { case maxXEdge case maxYEdge } - -extension CGRectEdge { - @inlinable init(rectEdge: NSRectEdge) -} extension CGPoint { @available(macOS 10.0, *) func equalTo(_ point2: CGPoint) -> Bool diff --git a/macOS/CoreGraphics/CoreGraphics.swift b/macOS/CoreGraphics/CoreGraphics.swift index 359a694..6ae746b 100644 --- a/macOS/CoreGraphics/CoreGraphics.swift +++ b/macOS/CoreGraphics/CoreGraphics.swift @@ -39,13 +39,6 @@ extension CGFloat : _CVarArgPassedAsDouble, _CVarArgAligned { extension CGFloat : Codable { } -extension CGFloat : _ObjectiveCBridgeable { - @available(swift, deprecated: 4, renamed: "init(truncating:)") - init(_ number: __shared NSNumber) - init(truncating number: __shared NSNumber) - init?(exactly number: __shared NSNumber) -} - func CGGetLastMouseDelta() -> (x: Int32, y: Int32) enum CGPathFillRule : Int { diff --git a/macOS/CoreHaptics/CHHapticEngine.swift b/macOS/CoreHaptics/CHHapticEngine.swift index 53c55cb..52f49b9 100644 --- a/macOS/CoreHaptics/CHHapticEngine.swift +++ b/macOS/CoreHaptics/CHHapticEngine.swift @@ -35,8 +35,10 @@ class CHHapticEngine : NSObject { var isAutoShutdownEnabled: Bool init() throws func start(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func start() async throws func start() throws func stop(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func stop() async throws func notifyWhenPlayersFinished(finishedHandler: @escaping CHHapticEngine.FinishedHandler) func makePlayer(with pattern: CHHapticPattern) throws -> CHHapticPatternPlayer func makeAdvancedPlayer(with pattern: CHHapticPattern) throws -> CHHapticAdvancedPatternPlayer diff --git a/macOS/CoreLocation/CLGeocoder.swift b/macOS/CoreLocation/CLGeocoder.swift index 2e0c2cc..49d6c34 100644 --- a/macOS/CoreLocation/CLGeocoder.swift +++ b/macOS/CoreLocation/CLGeocoder.swift @@ -4,14 +4,23 @@ typealias CLGeocodeCompletionHandler = ([CLPlacemark]?, Error?) -> Void class CLGeocoder : NSObject { var isGeocoding: Bool { get } func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CLGeocodeCompletionHandler) + func reverseGeocodeLocation(_ location: CLLocation) async throws -> [CLPlacemark] @available(macOS 10.13, *) func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(macOS 10.13, *) + func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?) async throws -> [CLPlacemark] @available(macOS, introduced: 10.8, deprecated: 10.13, message: "Use -geocodePostalAddress:completionHandler:") func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: @escaping CLGeocodeCompletionHandler) + @available(macOS, introduced: 10.8, deprecated: 10.13, message: "Use -geocodePostalAddress:completionHandler:") + func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any]) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, in region: CLRegion?, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String, in region: CLRegion?) async throws -> [CLPlacemark] @available(macOS 10.13, *) func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(macOS 10.13, *) + func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?) async throws -> [CLPlacemark] func cancelGeocode() } extension CLGeocoder { diff --git a/macOS/CoreLocation/CLLocationManager.swift b/macOS/CoreLocation/CLLocationManager.swift index 0b193bc..156334a 100644 --- a/macOS/CoreLocation/CLLocationManager.swift +++ b/macOS/CoreLocation/CLLocationManager.swift @@ -98,6 +98,8 @@ class CLLocationManager : NSObject { @available(macOS 11.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil) @available(macOS 11.0, *) + func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) async throws + @available(macOS 11.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) func startUpdatingLocation() func stopUpdatingLocation() diff --git a/macOS/CoreML/MLModel.swift b/macOS/CoreML/MLModel.swift index e729247..cba63d5 100644 --- a/macOS/CoreML/MLModel.swift +++ b/macOS/CoreML/MLModel.swift @@ -9,6 +9,8 @@ class MLModel : NSObject { convenience init(contentsOf url: URL, configuration: MLModelConfiguration) throws @available(macOS 11.0, *) class func __loadContents(of url: URL, configuration: MLModelConfiguration, completionHandler handler: @escaping (MLModel?, Error?) -> Void) + @available(macOS 11.0, *) + class func __loadContents(of url: URL, configuration: MLModelConfiguration) async throws -> MLModel func prediction(from input: MLFeatureProvider) throws -> MLFeatureProvider func prediction(from input: MLFeatureProvider, options: MLPredictionOptions) throws -> MLFeatureProvider @available(macOS 10.14, *) diff --git a/macOS/CoreML/MLModelCollection.swift b/macOS/CoreML/MLModelCollection.swift index c529d15..bbe58ec 100644 --- a/macOS/CoreML/MLModelCollection.swift +++ b/macOS/CoreML/MLModelCollection.swift @@ -6,6 +6,7 @@ class MLModelCollection : NSObject { var deploymentID: String { get } class func __beginAccessingModelCollection(withIdentifier identifier: String, completionHandler: @escaping (MLModelCollection?, Error?) -> Void) -> Progress class func __endAccessingModelCollection(withIdentifier identifier: String, completionHandler: @escaping (Bool, Error?) -> Void) + class func __endAccessingModelCollection(withIdentifier identifier: String) async throws -> Bool } @available(macOS 11.0, iOS 14.0, *) diff --git a/macOS/CoreSpotlight/CSSearchableIndex.swift b/macOS/CoreSpotlight/CSSearchableIndex.swift index d57a84d..0216b00 100644 --- a/macOS/CoreSpotlight/CSSearchableIndex.swift +++ b/macOS/CoreSpotlight/CSSearchableIndex.swift @@ -22,14 +22,20 @@ class CSSearchableIndex : NSObject { init(name: String) init(name: String, protectionClass: FileProtectionType?) func indexSearchableItems(_ items: [CSSearchableItem], completionHandler: ((Error?) -> Void)? = nil) + func indexSearchableItems(_ items: [CSSearchableItem]) async throws func deleteSearchableItems(withIdentifiers identifiers: [String], completionHandler: ((Error?) -> Void)? = nil) + func deleteSearchableItems(withIdentifiers identifiers: [String]) async throws func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String], completionHandler: ((Error?) -> Void)? = nil) + func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String]) async throws func deleteAllSearchableItems(completionHandler: ((Error?) -> Void)? = nil) + func deleteAllSearchableItems() async throws } extension CSSearchableIndex { func beginBatch() func endBatch(withClientState clientState: Data, completionHandler: ((Error?) -> Void)? = nil) + func endBatch(withClientState clientState: Data) async throws func fetchLastClientState(completionHandler: @escaping (Data?, Error?) -> Void) + func fetchLastClientState() async throws -> Data } @available(macOS 10.11, *) protocol CSSearchableIndexDelegate : NSObjectProtocol { diff --git a/macOS/CryptoTokenKit/TKSmartCard.swift b/macOS/CryptoTokenKit/TKSmartCard.swift index ab63f8e..cddabde 100644 --- a/macOS/CryptoTokenKit/TKSmartCard.swift +++ b/macOS/CryptoTokenKit/TKSmartCard.swift @@ -4,6 +4,7 @@ class TKSmartCardSlotManager : NSObject { class var `default`: TKSmartCardSlotManager? { get } var slotNames: [String] { get } func getSlot(withName name: String, reply: @escaping (TKSmartCardSlot?) -> Void) + func getSlot(withName name: String) async -> TKSmartCardSlot? @available(macOS 10.13, *) func slotNamed(_ name: String) -> TKSmartCardSlot? } @@ -91,6 +92,7 @@ class TKSmartCardUserInteraction : NSObject { var initialTimeout: TimeInterval var interactionTimeout: TimeInterval func run(reply: @escaping (Bool, Error?) -> Void) + func run() async throws -> Bool func cancel() -> Bool } @available(macOS 10.11, *) @@ -126,7 +128,9 @@ class TKSmartCard : NSObject { var isSensitive: Bool var context: Any? func beginSession(reply: @escaping (Bool, Error?) -> Void) + func beginSession() async throws -> Bool func transmit(_ request: Data, reply: @escaping (Data?, Error?) -> Void) + func transmit(_ request: Data) async throws -> Data func endSession() @available(macOS 10.11, *) func userInteractionForSecurePINVerification(_ PINFormat: TKSmartCardPINFormat, apdu APDU: Data, pinByteOffset PINByteOffset: Int) -> TKSmartCardUserInteractionForSecurePINVerification? @@ -151,6 +155,8 @@ extension TKSmartCard { var useCommandChaining: Bool @available(macOS 10.10, *) func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?, reply: @escaping (Data?, UInt16, Error?) -> Void) + @available(macOS 10.10, *) + func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?) async throws -> (Data, UInt16) @available(macOS 10.12, *) func __inSession(executeBlock block: @escaping (NSErrorPointer) -> Bool) throws @available(macOS 10.12, *) diff --git a/macOS/DeveloperToolsSupport/DeveloperToolsSupport.swift b/macOS/DeveloperToolsSupport/DeveloperToolsSupport.swift index e434a46..83f4ea3 100644 --- a/macOS/DeveloperToolsSupport/DeveloperToolsSupport.swift +++ b/macOS/DeveloperToolsSupport/DeveloperToolsSupport.swift @@ -1,6 +1,6 @@ @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct LibraryContentBuilder { +@resultBuilder struct LibraryContentBuilder { static func buildBlock(_ segments: [LibraryItem]...) -> [LibraryItem] static func buildExpression(_ item: LibraryItem) -> [LibraryItem] static func buildExpression(_ items: [LibraryItem]) -> [LibraryItem] diff --git a/macOS/DeviceCheck/DCDevice.swift b/macOS/DeviceCheck/DCDevice.swift index 861d6a6..4a49f47 100644 --- a/macOS/DeviceCheck/DCDevice.swift +++ b/macOS/DeviceCheck/DCDevice.swift @@ -4,4 +4,5 @@ class DCDevice : NSObject { class var current: DCDevice { get } var isSupported: Bool { get } func generateToken(completionHandler completion: @escaping (Data?, Error?) -> Void) + func generateToken() async throws -> Data } diff --git a/macOS/EventKit/EKEventStore.swift b/macOS/EventKit/EKEventStore.swift index a1fba95..ae124c0 100644 --- a/macOS/EventKit/EKEventStore.swift +++ b/macOS/EventKit/EKEventStore.swift @@ -14,6 +14,8 @@ class EKEventStore : NSObject { init(sources: [EKSource]) @available(macOS 10.9, *) func requestAccess(to entityType: EKEntityType, completion: @escaping EKEventStoreRequestAccessCompletionHandler) + @available(macOS 10.9, *) + func requestAccess(to entityType: EKEntityType) async throws -> Bool var eventStoreIdentifier: String { get } @available(macOS 10.11, *) var delegateSources: [EKSource] { get } diff --git a/macOS/ExecutionPolicy/EPDeveloperTool.swift b/macOS/ExecutionPolicy/EPDeveloperTool.swift index db275ca..498b20c 100644 --- a/macOS/ExecutionPolicy/EPDeveloperTool.swift +++ b/macOS/ExecutionPolicy/EPDeveloperTool.swift @@ -12,4 +12,5 @@ enum EPDeveloperToolStatus : Int { class EPDeveloperTool : NSObject { var authorizationStatus: EPDeveloperToolStatus { get } func requestAccess(completionHandler handler: @escaping (Bool) -> Void) + func requestAccess() async -> Bool } diff --git a/macOS/FileProvider/Extension.swift b/macOS/FileProvider/Extension.swift index 0850470..f029b0c 100644 --- a/macOS/FileProvider/Extension.swift +++ b/macOS/FileProvider/Extension.swift @@ -5,19 +5,31 @@ extension NSFileProviderExtension { class NSFileProviderManager : NSObject { convenience init?(for domain: NSFileProviderDomain) func signalEnumerator(for containerItemIdentifier: NSFileProviderItemIdentifier, completionHandler completion: @escaping (Error?) -> Void) + func signalEnumerator(for containerItemIdentifier: NSFileProviderItemIdentifier) async throws @available(macOS 11.0, *) func getUserVisibleURL(for itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (URL?, Error?) -> Void) @available(macOS 11.0, *) + func getUserVisibleURL(for itemIdentifier: NSFileProviderItemIdentifier) async throws -> URL + @available(macOS 11.0, *) class func getIdentifierForUserVisibleFile(at url: URL, completionHandler: @escaping (NSFileProviderItemIdentifier?, NSFileProviderDomainIdentifier?, Error?) -> Void) + @available(macOS 11.0, *) + class func identifierForUserVisibleFile(at url: URL) async throws -> (NSFileProviderItemIdentifier, NSFileProviderDomainIdentifier) func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier, completionHandler completion: @escaping (Error?) -> Void) + func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier) async throws @available(macOS 11.0, *) func temporaryDirectoryURL() throws -> URL class func add(_ domain: NSFileProviderDomain, completionHandler: @escaping (Error?) -> Void) + class func add(_ domain: NSFileProviderDomain) async throws class func remove(_ domain: NSFileProviderDomain, completionHandler: @escaping (Error?) -> Void) + class func remove(_ domain: NSFileProviderDomain) async throws class func getDomainsWithCompletionHandler(_ completionHandler: @escaping ([NSFileProviderDomain], Error?) -> Void) + class func domains() async throws -> [NSFileProviderDomain] class func removeAllDomains(completionHandler: @escaping (Error?) -> Void) + class func removeAllDomains() async throws @available(macOS 11.0, *) func signalErrorResolved(_ error: Error, completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func signalErrorResolved(_ error: Error) async throws } extension NSFileProviderManager { @available(macOS 11.0, *) @@ -27,19 +39,29 @@ extension NSFileProviderManager { @available(macOS 11.0, *) class func `import`(_ domain: NSFileProviderDomain, fromDirectoryAt url: URL, completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + class func `import`(_ domain: NSFileProviderDomain, fromDirectoryAt url: URL) async throws + @available(macOS 11.0, *) func reimportItems(below itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func reimportItems(below itemIdentifier: NSFileProviderItemIdentifier) async throws } extension NSFileProviderManager { @available(macOS 11.0, *) func evictItem(identifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func evictItem(identifier itemIdentifier: NSFileProviderItemIdentifier) async throws } extension NSFileProviderManager { @available(macOS 11.0, *) func waitForChanges(below itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func waitForChanges(below itemIdentifier: NSFileProviderItemIdentifier) async throws } extension NSFileProviderManager { @available(macOS 11.0, *) func waitForStabilization(completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func waitForStabilization() async throws } extension NSFileProviderManager { @available(macOS 11.0, *) @@ -53,5 +75,9 @@ extension NSFileProviderManager { @available(macOS 11.0, *) func disconnect(reason localizedReason: String, options: NSFileProviderManager.DisconnectionOptions = [], completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + func disconnect(reason localizedReason: String, options: NSFileProviderManager.DisconnectionOptions = []) async throws + @available(macOS 11.0, *) func reconnect(completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func reconnect() async throws } diff --git a/macOS/FileProvider/NSFileProviderActions.swift b/macOS/FileProvider/NSFileProviderActions.swift index ef5d73f..8cfd09d 100644 --- a/macOS/FileProvider/NSFileProviderActions.swift +++ b/macOS/FileProvider/NSFileProviderActions.swift @@ -7,13 +7,23 @@ struct NSFileProviderExtensionActionIdentifier : _ObjectiveCBridgeable, Hashable } extension NSFileProviderExtension { func importDocument(at fileURL: URL, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func importDocument(at fileURL: URL, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem func createDirectory(withName directoryName: String, inParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func createDirectory(withName directoryName: String, inParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem func renameItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toName itemName: String, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func renameItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toName itemName: String) async throws -> NSFileProviderItem func reparentItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemWithIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, newName: String?, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func reparentItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemWithIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, newName: String?) async throws -> NSFileProviderItem func trashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func trashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem func untrashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier?, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func untrashItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier?) async throws -> NSFileProviderItem func deleteItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (Error?) -> Void) + func deleteItem(withIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws func setLastUsedDate(_ lastUsedDate: Date?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func setLastUsedDate(_ lastUsedDate: Date?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem func setTagData(_ tagData: Data?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func setTagData(_ tagData: Data?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem func setFavoriteRank(_ favoriteRank: NSNumber?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) + func setFavoriteRank(_ favoriteRank: NSNumber?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async throws -> NSFileProviderItem } diff --git a/macOS/FileProvider/NSFileProviderEnumerating.swift b/macOS/FileProvider/NSFileProviderEnumerating.swift index 3a5db23..491e615 100644 --- a/macOS/FileProvider/NSFileProviderEnumerating.swift +++ b/macOS/FileProvider/NSFileProviderEnumerating.swift @@ -37,6 +37,7 @@ protocol NSFileProviderEnumerator : NSObjectProtocol { func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) optional func enumerateChanges(for observer: NSFileProviderChangeObserver, from syncAnchor: NSFileProviderSyncAnchor) optional func currentSyncAnchor(completionHandler: @escaping (NSFileProviderSyncAnchor?) -> Void) + optional func currentSyncAnchor() async -> NSFileProviderSyncAnchor? } extension NSFileProviderExtension { func enumerator(for containerItemIdentifier: NSFileProviderItemIdentifier) throws -> NSFileProviderEnumerator diff --git a/macOS/FileProvider/NSFileProviderReplicatedExtension.swift b/macOS/FileProvider/NSFileProviderReplicatedExtension.swift index de053ad..30d1674 100644 --- a/macOS/FileProvider/NSFileProviderReplicatedExtension.swift +++ b/macOS/FileProvider/NSFileProviderReplicatedExtension.swift @@ -46,7 +46,9 @@ protocol NSFileProviderReplicatedExtension : NSFileProviderEnumerating { func modifyItem(_ item: NSFileProviderItem, baseVersion version: NSFileProviderItemVersion, changedFields: NSFileProviderItemFields, contents newContents: URL?, options: NSFileProviderModifyItemOptions = [], request: NSFileProviderRequest, completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, Error?) -> Void) -> Progress func deleteItem(identifier: NSFileProviderItemIdentifier, baseVersion version: NSFileProviderItemVersion, options: NSFileProviderDeleteItemOptions = [], request: NSFileProviderRequest, completionHandler: @escaping (Error?) -> Void) -> Progress optional func importDidFinish(completionHandler: @escaping () -> Void) + optional func importDidFinish() async optional func materializedItemsDidChange(completionHandler: @escaping () -> Void) + optional func materializedItemsDidChange() async } @available(macOS 11.0, *) protocol NSFileProviderIncrementalContentFetching : NSObjectProtocol { diff --git a/macOS/FinderSync/FinderSync.swift b/macOS/FinderSync/FinderSync.swift index 8bf4e9e..fe360c3 100644 --- a/macOS/FinderSync/FinderSync.swift +++ b/macOS/FinderSync/FinderSync.swift @@ -8,8 +8,10 @@ class FIFinderSyncController : NSExtensionContext { func selectedItemURLs() -> [URL]? func lastUsedDateForItem(with itemURL: URL) -> Date? func setLastUsedDate(_ lastUsedDate: Date, forItemWith itemURL: URL, completion: @escaping (Error) -> Void) + func setLastUsedDate(_ lastUsedDate: Date, forItemWith itemURL: URL) async -> Error func tagDataForItem(with itemURL: URL) -> Data? func setTagData(_ tagData: Data?, forItemWith itemURL: URL, completion: @escaping (Error) -> Void) + func setTagData(_ tagData: Data?, forItemWith itemURL: URL) async -> Error @available(macOS 10.14, *) class var isExtensionEnabled: Bool { get } @available(macOS 10.14, *) @@ -35,6 +37,7 @@ protocol FIFinderSyncProtocol { @available(macOS 10.8, *) optional func makeListenerEndpoint(forServiceName serviceName: NSFileProviderServiceName, itemURL: URL) throws -> NSXPCListenerEndpoint optional func values(forAttributes attributes: [URLResourceKey], forItemWith itemURL: URL, completion: @escaping ([URLResourceKey : Any], Error?) -> Void) + optional func values(forAttributes attributes: [URLResourceKey], forItemWith itemURL: URL) async throws -> [URLResourceKey : Any] } class FIFinderSync : NSObject, FIFinderSyncProtocol, NSExtensionRequestHandling { } diff --git a/macOS/Foundation/NSExtensionContext.swift b/macOS/Foundation/NSExtensionContext.swift index e0bddfe..c8c8408 100644 --- a/macOS/Foundation/NSExtensionContext.swift +++ b/macOS/Foundation/NSExtensionContext.swift @@ -3,8 +3,10 @@ class NSExtensionContext : NSObject { var inputItems: [Any] { get } func completeRequest(returningItems items: [Any]?, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(returningItems items: [Any]?) async -> Bool func cancelRequest(withError error: Error) func open(_ URL: URL, completionHandler: ((Bool) -> Void)? = nil) + func open(_ URL: URL) async -> Bool } @available(macOS 10.10, *) let NSExtensionItemsAndErrorsKey: String diff --git a/macOS/Foundation/NSFileManager.swift b/macOS/Foundation/NSFileManager.swift index 01e2ad3..f5b55c6 100644 --- a/macOS/Foundation/NSFileManager.swift +++ b/macOS/Foundation/NSFileManager.swift @@ -34,6 +34,8 @@ class FileManager : NSObject { func mountedVolumeURLs(includingResourceValuesForKeys propertyKeys: [URLResourceKey]?, options: FileManager.VolumeEnumerationOptions = []) -> [URL]? @available(macOS 10.11, *) func unmountVolume(at url: URL, options mask: FileManager.UnmountOptions = [], completionHandler: @escaping (Error?) -> Void) + @available(macOS 10.11, *) + func unmountVolume(at url: URL, options mask: FileManager.UnmountOptions = []) async throws @available(macOS 10.6, *) func contentsOfDirectory(at url: URL, includingPropertiesForKeys keys: [URLResourceKey]?, options mask: FileManager.DirectoryEnumerationOptions = []) throws -> [URL] @available(macOS 10.6, *) @@ -121,6 +123,8 @@ class FileManager : NSObject { @NSCopying var ubiquityIdentityToken: (NSCoding & NSCopying & NSObjectProtocol)? { get } @available(macOS 10.13, *) func getFileProviderServicesForItem(at url: URL, completionHandler: @escaping ([NSFileProviderServiceName : NSFileProviderService]?, Error?) -> Void) + @available(macOS 10.13, *) + func fileProviderServicesForItem(at url: URL) async throws -> [NSFileProviderServiceName : NSFileProviderService] @available(macOS 10.8, *) func containerURL(forSecurityApplicationGroupIdentifier groupIdentifier: String) -> URL? } @@ -227,6 +231,7 @@ extension FileManager { @available(macOS 10.13, *) class NSFileProviderService : NSObject { func getFileProviderConnection(completionHandler: @escaping (NSXPCConnection?, Error?) -> Void) + func fileProviderConnection() async throws -> NSXPCConnection var name: NSFileProviderServiceName { get } } extension FileAttributeKey { diff --git a/macOS/Foundation/NSFilePresenter.swift b/macOS/Foundation/NSFilePresenter.swift index 76854f0..2079b93 100644 --- a/macOS/Foundation/NSFilePresenter.swift +++ b/macOS/Foundation/NSFilePresenter.swift @@ -8,7 +8,9 @@ protocol NSFilePresenter : NSObjectProtocol { optional func relinquishPresentedItem(toReader reader: @escaping ((() -> Void)?) -> Void) optional func relinquishPresentedItem(toWriter writer: @escaping ((() -> Void)?) -> Void) optional func savePresentedItemChanges(completionHandler: @escaping (Error?) -> Void) + optional func savePresentedItemChanges() async throws optional func accommodatePresentedItemDeletion(completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedItemDeletion() async throws optional func presentedItemDidMove(to newURL: URL) optional func presentedItemDidChange() @available(macOS 10.13, *) @@ -22,6 +24,7 @@ protocol NSFilePresenter : NSObjectProtocol { @available(macOS 10.7, *) optional func presentedItemDidResolveConflict(_ version: NSFileVersion) optional func accommodatePresentedSubitemDeletion(at url: URL, completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedSubitemDeletion(at url: URL) async throws optional func presentedSubitemDidAppear(at url: URL) optional func presentedSubitem(at oldURL: URL, didMoveTo newURL: URL) optional func presentedSubitemDidChange(at url: URL) diff --git a/macOS/Foundation/NSFileVersion.swift b/macOS/Foundation/NSFileVersion.swift index 30b3229..970284a 100644 --- a/macOS/Foundation/NSFileVersion.swift +++ b/macOS/Foundation/NSFileVersion.swift @@ -18,6 +18,8 @@ class NSFileVersion : NSObject { class func unresolvedConflictVersionsOfItem(at url: URL) -> [NSFileVersion]? @available(macOS 10.10, *) class func getNonlocalVersionsOfItem(at url: URL, completionHandler: @escaping ([NSFileVersion]?, Error?) -> Void) + @available(macOS 10.10, *) + class func nonlocalVersionsOfItem(at url: URL) async throws -> [NSFileVersion] class func version(itemAt url: URL, forPersistentIdentifier persistentIdentifier: Any) -> NSFileVersion? @available(macOS 10.7, *) class func addOfItem(at url: URL, withContentsOf contentsURL: URL, options: NSFileVersion.AddingOptions = []) throws -> NSFileVersion diff --git a/macOS/Foundation/NSHTTPCookieStorage.swift b/macOS/Foundation/NSHTTPCookieStorage.swift index a21d975..e5ca7c8 100644 --- a/macOS/Foundation/NSHTTPCookieStorage.swift +++ b/macOS/Foundation/NSHTTPCookieStorage.swift @@ -29,6 +29,8 @@ extension HTTPCookieStorage { func storeCookies(_ cookies: [HTTPCookie], for task: URLSessionTask) @available(macOS 10.10, *) func getCookiesFor(_ task: URLSessionTask, completionHandler: @escaping ([HTTPCookie]?) -> Void) + @available(macOS 10.10, *) + func cookies(for task: URLSessionTask) async -> [HTTPCookie]? } extension NSNotification.Name { @available(macOS 10.2, *) diff --git a/macOS/Foundation/NSItemProvider.swift b/macOS/Foundation/NSItemProvider.swift index cf6f510..5a4b910 100644 --- a/macOS/Foundation/NSItemProvider.swift +++ b/macOS/Foundation/NSItemProvider.swift @@ -77,6 +77,7 @@ class NSItemProvider : NSObject, NSCopying { convenience init?(contentsOf fileURL: URL!) func registerItem(forTypeIdentifier typeIdentifier: String, loadHandler: @escaping NSItemProvider.LoadHandler) func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil, completionHandler: NSItemProvider.CompletionHandler? = nil) + func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil) async throws -> NSSecureCoding } @available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) @@ -95,6 +96,8 @@ extension NSItemProvider { var previewImageHandler: NSItemProvider.LoadHandler? @available(macOS 10.10, *) func loadPreviewImage(options: [AnyHashable : Any]! = [:], completionHandler: NSItemProvider.CompletionHandler!) + @available(macOS 10.10, *) + func loadPreviewImage(options: [AnyHashable : Any]! = [:]) async throws -> NSSecureCoding } @available(macOS 10.10, *) let NSExtensionJavaScriptPreprocessingResultsKey: String diff --git a/macOS/Foundation/NSURLCache.swift b/macOS/Foundation/NSURLCache.swift index bfb2dda..cb86856 100644 --- a/macOS/Foundation/NSURLCache.swift +++ b/macOS/Foundation/NSURLCache.swift @@ -46,5 +46,7 @@ extension URLCache { @available(macOS 10.10, *) func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -> Void) @available(macOS 10.10, *) + func cachedResponse(for dataTask: URLSessionDataTask) async -> CachedURLResponse? + @available(macOS 10.10, *) func removeCachedResponse(for dataTask: URLSessionDataTask) } diff --git a/macOS/Foundation/NSURLConnection.swift b/macOS/Foundation/NSURLConnection.swift index 8df5aee..17d3da7 100644 --- a/macOS/Foundation/NSURLConnection.swift +++ b/macOS/Foundation/NSURLConnection.swift @@ -55,4 +55,6 @@ extension NSURLConnection { extension NSURLConnection { @available(macOS, introduced: 10.7, deprecated: 10.11, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue, completionHandler handler: @escaping (URLResponse?, Data?, Error?) -> Void) + @available(macOS, introduced: 10.7, deprecated: 10.11, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") + class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue) async throws -> (URLResponse, Data) } diff --git a/macOS/Foundation/NSURLCredentialStorage.swift b/macOS/Foundation/NSURLCredentialStorage.swift index 8d15410..5a8b4ee 100644 --- a/macOS/Foundation/NSURLCredentialStorage.swift +++ b/macOS/Foundation/NSURLCredentialStorage.swift @@ -15,12 +15,16 @@ extension URLCredentialStorage { @available(macOS 10.10, *) func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping ([String : URLCredential]?) -> Void) @available(macOS 10.10, *) + func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask) async -> [String : URLCredential]? + @available(macOS 10.10, *) func set(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) @available(macOS 10.10, *) func remove(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, options: [String : Any]? = nil, task: URLSessionTask) @available(macOS 10.10, *) func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping (URLCredential?) -> Void) @available(macOS 10.10, *) + func defaultCredential(for space: URLProtectionSpace, task: URLSessionTask) async -> URLCredential? + @available(macOS 10.10, *) func setDefaultCredential(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) } extension NSNotification.Name { diff --git a/macOS/Foundation/NSURLSession.swift b/macOS/Foundation/NSURLSession.swift index 3ce6089..e7c11ec 100644 --- a/macOS/Foundation/NSURLSession.swift +++ b/macOS/Foundation/NSURLSession.swift @@ -13,10 +13,15 @@ class URLSession : NSObject { func finishTasksAndInvalidate() func invalidateAndCancel() func reset(completionHandler: @escaping () -> Void) + func reset() async func flush(completionHandler: @escaping () -> Void) + func flush() async func getTasksWithCompletionHandler(_ completionHandler: @escaping ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) -> Void) + func tasks() async -> ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) @available(macOS 10.11, *) func getAllTasks(completionHandler: @escaping ([URLSessionTask]) -> Void) + @available(macOS 10.11, *) + func allTasks() async -> [URLSessionTask] func dataTask(with request: URLRequest) -> URLSessionDataTask func dataTask(with url: URL) -> URLSessionDataTask func uploadTask(with request: URLRequest, fromFile fileURL: URL) -> URLSessionUploadTask @@ -119,11 +124,14 @@ class URLSessionUploadTask : URLSessionDataTask { @available(macOS 10.9, *) class URLSessionDownloadTask : URLSessionTask { func cancel(byProducingResumeData completionHandler: @escaping (Data?) -> Void) + func cancelByProducingResumeData() async -> Data? } @available(macOS 10.11, *) class URLSessionStreamTask : URLSessionTask { func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) + func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval) async throws -> (Data, Bool) func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) + func write(_ data: Data, timeout: TimeInterval) async throws func captureStreams() func closeWrite() func closeRead() @@ -169,7 +177,9 @@ extension URLSessionWebSocketTask { @available(macOS 10.15, *) class URLSessionWebSocketTask : URLSessionTask { func __send(_ message: __NSURLSessionWebSocketMessage, completionHandler: @escaping (Error?) -> Void) + func __send(_ message: __NSURLSessionWebSocketMessage) async throws func __receiveMessage(completionHandler: @escaping (__NSURLSessionWebSocketMessage?, Error?) -> Void) + func __receiveMessage() async throws -> __NSURLSessionWebSocketMessage func sendPing(pongReceiveHandler: @escaping (Error?) -> Void) func cancel(with closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) var maximumMessageSize: Int @@ -266,6 +276,7 @@ extension URLSession { protocol URLSessionDelegate : NSObjectProtocol { optional func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(macOS 11.0, *) optional func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) } @@ -274,10 +285,15 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(macOS 10.13, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest, completionHandler: @escaping (URLSession.DelayedRequestDisposition, URLRequest?) -> Void) @available(macOS 10.13, *) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest) async -> (URLSession.DelayedRequestDisposition, URLRequest?) + @available(macOS 10.13, *) optional func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> URLRequest? optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) optional func urlSession(_ session: URLSession, task: URLSessionTask, needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask) async -> InputStream? optional func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) @available(macOS 10.12, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) @@ -286,11 +302,13 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(macOS 10.9, *) protocol URLSessionDataDelegate : URLSessionTaskDelegate { optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse) async -> URLSession.ResponseDisposition optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome downloadTask: URLSessionDownloadTask) @available(macOS 10.11, *) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome streamTask: URLSessionStreamTask) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse, completionHandler: @escaping (CachedURLResponse?) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) async -> CachedURLResponse? } @available(macOS 10.9, *) protocol URLSessionDownloadDelegate : URLSessionTaskDelegate { diff --git a/macOS/Foundation/NSUserActivity.swift b/macOS/Foundation/NSUserActivity.swift index e4ef975..bbd6a5f 100644 --- a/macOS/Foundation/NSUserActivity.swift +++ b/macOS/Foundation/NSUserActivity.swift @@ -26,6 +26,7 @@ class NSUserActivity : NSObject { func resignCurrent() func invalidate() func getContinuationStreams(completionHandler: @escaping (InputStream?, OutputStream?, Error?) -> Void) + func continuationStreams() async throws -> (InputStream, OutputStream) @available(macOS 10.11, *) var isEligibleForHandoff: Bool @available(macOS 10.11, *) @@ -37,7 +38,11 @@ class NSUserActivity : NSObject { @available(macOS 10.15, *) class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier], completionHandler handler: @escaping () -> Void) @available(macOS 10.15, *) + class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier]) async + @available(macOS 10.15, *) class func deleteAllSavedUserActivities(completionHandler handler: @escaping () -> Void) + @available(macOS 10.15, *) + class func deleteAllSavedUserActivities() async } let NSUserActivityTypeBrowsingWeb: String @available(macOS 10.10, *) diff --git a/macOS/Foundation/NSUserScriptTask.swift b/macOS/Foundation/NSUserScriptTask.swift index a5fb140..1486d8f 100644 --- a/macOS/Foundation/NSUserScriptTask.swift +++ b/macOS/Foundation/NSUserScriptTask.swift @@ -4,6 +4,7 @@ class NSUserScriptTask : NSObject { init(url: URL) throws var scriptURL: URL { get } func execute(completionHandler handler: NSUserScriptTask.CompletionHandler? = nil) + func execute() async throws } extension NSUserScriptTask { typealias CompletionHandler = (Error?) -> Void @@ -14,6 +15,7 @@ class NSUserUnixTask : NSUserScriptTask { var standardOutput: FileHandle? var standardError: FileHandle? func execute(withArguments arguments: [String]?, completionHandler handler: NSUserUnixTask.CompletionHandler? = nil) + func execute(withArguments arguments: [String]?) async throws } extension NSUserUnixTask { typealias CompletionHandler = (Error?) -> Void @@ -21,6 +23,7 @@ extension NSUserUnixTask { @available(macOS 10.8, *) class NSUserAppleScriptTask : NSUserScriptTask { func execute(withAppleEvent event: NSAppleEventDescriptor?, completionHandler handler: NSUserAppleScriptTask.CompletionHandler? = nil) + func execute(withAppleEvent event: NSAppleEventDescriptor?) async throws -> NSAppleEventDescriptor } extension NSUserAppleScriptTask { typealias CompletionHandler = (NSAppleEventDescriptor?, Error?) -> Void @@ -29,6 +32,7 @@ extension NSUserAppleScriptTask { class NSUserAutomatorTask : NSUserScriptTask { var variables: [String : Any]? func execute(withInput input: NSSecureCoding?, completionHandler handler: NSUserAutomatorTask.CompletionHandler? = nil) + func execute(withInput input: NSSecureCoding?) async throws -> Any } extension NSUserAutomatorTask { typealias CompletionHandler = (Any?, Error?) -> Void diff --git a/macOS/GLKit/GLKTextureLoader.swift b/macOS/GLKit/GLKTextureLoader.swift index 1937755..7c08fe9 100644 --- a/macOS/GLKit/GLKTextureLoader.swift +++ b/macOS/GLKit/GLKTextureLoader.swift @@ -82,11 +82,19 @@ class GLKTextureLoader : NSObject { class func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil) throws -> GLKTextureInfo init(share context: NSOpenGLContext) func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo } diff --git a/macOS/GameController/GCController.swift b/macOS/GameController/GCController.swift index 4153998..e483be9 100644 --- a/macOS/GameController/GCController.swift +++ b/macOS/GameController/GCController.swift @@ -44,6 +44,7 @@ class GCController : NSObject, GCDevice { func capture() -> GCController class func controllers() -> [GCController] class func startWirelessControllerDiscovery(completionHandler: (() -> Void)? = nil) + class func startWirelessControllerDiscovery() async class func stopWirelessControllerDiscovery() @available(macOS 10.15, *) class func withMicroGamepad() -> GCController diff --git a/macOS/GameKit/GKAchievement.swift b/macOS/GameKit/GKAchievement.swift index d803f80..ad0ab2a 100644 --- a/macOS/GameKit/GKAchievement.swift +++ b/macOS/GameKit/GKAchievement.swift @@ -2,12 +2,16 @@ @available(macOS 10.8, *) class GKAchievement : NSObject, NSCoding, NSSecureCoding { class func loadAchievements(completionHandler: (([GKAchievement]?, Error?) -> Void)? = nil) + class func loadAchievements() async throws -> [GKAchievement] class func resetAchievements(completionHandler: ((Error?) -> Void)? = nil) + class func resetAchievements() async throws init(identifier: String) @available(macOS 10.10, *) init(identifier: String, player: GKPlayer) @available(macOS 10.8, *) class func report(_ achievements: [GKAchievement], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.8, *) + class func report(_ achievements: [GKAchievement]) async throws var identifier: String var percentComplete: Double var isCompleted: Bool { get } @@ -20,6 +24,8 @@ class GKAchievement : NSObject, NSCoding, NSSecureCoding { extension GKAchievement { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use +reportAchievements:withCompletionHandler:") func report(completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use +reportAchievements:withCompletionHandler:") + func report() async throws @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use isHidden on the GKAchievementDescription class instead") var isHidden: Bool { get } } diff --git a/macOS/GameKit/GKAchievementDescription.swift b/macOS/GameKit/GKAchievementDescription.swift index 52b9249..b4ddfd4 100644 --- a/macOS/GameKit/GKAchievementDescription.swift +++ b/macOS/GameKit/GKAchievementDescription.swift @@ -2,6 +2,7 @@ @available(macOS 10.8, *) class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { class func loadAchievementDescriptions(completionHandler: (([GKAchievementDescription]?, Error?) -> Void)? = nil) + class func loadAchievementDescriptions() async throws -> [GKAchievementDescription] var identifier: String { get } @available(macOS 10.8, *) var groupIdentifier: String? { get } @@ -17,6 +18,7 @@ extension GKAchievementDescription { @available(macOS 10.8, *) var image: NSImage? { get } func loadImage(completionHandler: ((NSImage?, Error?) -> Void)? = nil) + func loadImage() async throws -> NSImage class func incompleteAchievementImage() -> NSImage class func placeholderCompletedAchievementImage() -> NSImage } diff --git a/macOS/GameKit/GKChallenge.swift b/macOS/GameKit/GKChallenge.swift index a457c78..eab199e 100644 --- a/macOS/GameKit/GKChallenge.swift +++ b/macOS/GameKit/GKChallenge.swift @@ -10,6 +10,7 @@ enum GKChallengeState : Int { @available(macOS 10.8, *) class GKChallenge : NSObject, NSCoding, NSSecureCoding { class func loadReceivedChallenges(completionHandler: (([GKChallenge]?, Error?) -> Void)? = nil) + class func loadReceivedChallenges() async throws -> [GKChallenge] func decline() @available(macOS 10.10, *) @NSCopying var issuingPlayer: GKPlayer? { get } @@ -37,14 +38,22 @@ class GKAchievementChallenge : GKChallenge { extension GKScore { @available(macOS, introduced: 10.10, deprecated: 11.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.10, deprecated: 11.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") + class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge]) async throws @available(macOS 11.0, *) class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 11.0, *) + class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKAchievement { @available(macOS 10.10, *) func selectChallengeablePlayers(_ players: [GKPlayer], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) @available(macOS 10.10, *) + func selectChallengeablePlayers(_ players: [GKPlayer]) async throws -> [GKPlayer] + @available(macOS 10.10, *) class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.10, *) + class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKScore { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, pass GKPlayers to challengeComposeControllerWithMessage:players:completionHandler: and present the view controller instead") @@ -55,6 +64,8 @@ extension GKAchievement { func issueChallenge(toPlayers playerIDs: [String]?, message: String?) @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, pass GKPlayers to selectChallengeablePlayers:") func selectChallengeablePlayerIDs(_ playerIDs: [String]?, withCompletionHandler completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, pass GKPlayers to selectChallengeablePlayers:") + func selectChallengeablePlayerIDs(_ playerIDs: [String]?) async throws -> [String] } typealias GKChallengeComposeCompletionBlock = (NSViewController, Bool, [String]?) -> Void extension GKScore { diff --git a/macOS/GameKit/GKCloudPlayer.swift b/macOS/GameKit/GKCloudPlayer.swift index b3dcf7e..6e33f74 100644 --- a/macOS/GameKit/GKCloudPlayer.swift +++ b/macOS/GameKit/GKCloudPlayer.swift @@ -2,4 +2,5 @@ @available(macOS, introduced: 10.12, deprecated: 10.14, message: "GKGameSession is deprecated. Use GKPlayer for both real-time and turn-based matchmaking APIs.") class GKCloudPlayer : GKBasePlayer { class func getCurrentSignedInPlayer(forContainer containerName: String?, completionHandler handler: @escaping (GKCloudPlayer?, Error?) -> Void) + class func currentSignedInPlayer(forContainer containerName: String?) async throws -> GKCloudPlayer } diff --git a/macOS/GameKit/GKGameSession.swift b/macOS/GameKit/GKGameSession.swift index 59a73ba..10a9785 100644 --- a/macOS/GameKit/GKGameSession.swift +++ b/macOS/GameKit/GKGameSession.swift @@ -22,15 +22,26 @@ class GKGameSession : NSObject { var maxNumberOfConnectedPlayers: Int { get } var badgedPlayers: [GKCloudPlayer] { get } class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int) async throws -> GKGameSession class func loadSessions(inContainer containerName: String?, completionHandler: @escaping ([GKGameSession]?, Error?) -> Void) + class func loadSessions(inContainer containerName: String?) async throws -> [GKGameSession] class func load(withIdentifier identifier: String, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func load(withIdentifier identifier: String) async throws -> GKGameSession class func remove(withIdentifier identifier: String, completionHandler: @escaping (Error?) -> Void) + class func remove(withIdentifier identifier: String) async throws func getShareURL(completionHandler: @escaping (URL?, Error?) -> Void) + func shareURL() async throws -> URL func loadData(completionHandler: @escaping (Data?, Error?) -> Void) + func loadData() async throws -> Data func save(_ data: Data, completionHandler: @escaping (Data?, Error?) -> Void) + func save(_ data: Data) async throws -> Data func setConnectionState(_ state: GKConnectionState, completionHandler: @escaping (Error?) -> Void) + func setConnectionState(_ state: GKConnectionState) async throws func players(with state: GKConnectionState) -> [GKCloudPlayer] func send(_ data: Data, with transport: GKTransportType, completionHandler: @escaping (Error?) -> Void) + func send(_ data: Data, with transport: GKTransportType) async throws func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool, completionHandler: @escaping (Error?) -> Void) + func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool) async throws func clearBadge(for players: [GKCloudPlayer], completionHandler: @escaping (Error?) -> Void) + func clearBadge(for players: [GKCloudPlayer]) async throws } diff --git a/macOS/GameKit/GKLeaderboard.swift b/macOS/GameKit/GKLeaderboard.swift index 0b63518..3715ae5 100644 --- a/macOS/GameKit/GKLeaderboard.swift +++ b/macOS/GameKit/GKLeaderboard.swift @@ -39,15 +39,27 @@ class GKLeaderboard : NSObject { @available(macOS 11.0, *) class func loadLeaderboards(IDs leaderboardIDs: [String]?, completionHandler: @escaping ([GKLeaderboard]?, Error?) -> Void) @available(macOS 11.0, *) + class func loadLeaderboards(IDs leaderboardIDs: [String]?) async throws -> [GKLeaderboard] + @available(macOS 11.0, *) func loadPreviousOccurrence(completionHandler: @escaping (GKLeaderboard?, Error?) -> Void) @available(macOS 11.0, *) + func loadPreviousOccurrence() async throws -> GKLeaderboard + @available(macOS 11.0, *) class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String], completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String]) async throws + @available(macOS 11.0, *) func submitScore(_ score: Int, context: Int, player: GKPlayer, completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + func submitScore(_ score: Int, context: Int, player: GKPlayer) async throws + @available(macOS 11.0, *) func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Int, Error?) -> Void) @available(macOS 11.0, *) + func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry], Int) + @available(macOS 11.0, *) func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Error?) -> Void) + @available(macOS 11.0, *) + func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry]) } extension GKLeaderboard { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use identifier instead") @@ -56,6 +68,8 @@ extension GKLeaderboard { init?(playerIDs: [String]?) @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use setDefaultLeaderboardIdentifier:completionHandler: on GKLocalPlayer instead") class func setDefault(_ leaderboardIdentifier: String?, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use setDefaultLeaderboardIdentifier:completionHandler: on GKLocalPlayer instead") + class func setDefault(_ leaderboardIdentifier: String?) async throws @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler: instead.") var timeScope: GKLeaderboard.TimeScope @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler: instead.") @@ -76,10 +90,16 @@ extension GKLeaderboard { init(players: [GKPlayer]) @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") func loadScores(completionHandler: (([GKScore]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") + func loadScores() async throws -> [GKScore] @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") class func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 11.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") + class func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboard { @available(macOS 10.8, *) func loadImage(completionHandler: ((NSImage?, Error?) -> Void)? = nil) + @available(macOS 10.8, *) + func loadImage() async throws -> NSImage } diff --git a/macOS/GameKit/GKLeaderboardSet.swift b/macOS/GameKit/GKLeaderboardSet.swift index 8f64b6b..ab21acf 100644 --- a/macOS/GameKit/GKLeaderboardSet.swift +++ b/macOS/GameKit/GKLeaderboardSet.swift @@ -6,13 +6,18 @@ class GKLeaderboardSet : NSObject, NSCoding, NSSecureCoding { var identifier: String? @available(macOS 10.10, *) class func loadLeaderboardSets(completionHandler: (([GKLeaderboardSet]?, Error?) -> Void)? = nil) + @available(macOS 10.10, *) + class func loadLeaderboardSets() async throws -> [GKLeaderboardSet] @available(macOS 11.0, *) func loadLeaderboards(handler: @escaping ([GKLeaderboard]?, Error?) -> Void) } extension GKLeaderboardSet { @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use loadLeaderboardsWithHandler: instead.") func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use loadLeaderboardsWithHandler: instead.") + func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboardSet { func loadImage(completionHandler: ((NSImage?, Error?) -> Void)? = nil) + func loadImage() async throws -> NSImage } diff --git a/macOS/GameKit/GKLocalPlayer.swift b/macOS/GameKit/GKLocalPlayer.swift index c38200b..723bfde 100644 --- a/macOS/GameKit/GKLocalPlayer.swift +++ b/macOS/GameKit/GKLocalPlayer.swift @@ -12,13 +12,22 @@ class GKLocalPlayer : GKPlayer { var isPersonalizedCommunicationRestricted: Bool { get } @available(macOS 10.11, *) func loadRecentPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(macOS 10.11, *) + func loadRecentPlayers() async throws -> [GKPlayer] func loadChallengableFriends(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + func loadChallengableFriends() async throws -> [GKPlayer] @available(macOS 10.10, *) func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.10, *) + func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String) async throws + @available(macOS 10.10, *) func loadDefaultLeaderboardIdentifier(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func loadDefaultLeaderboardIdentifier() async throws -> String @available(macOS 10.15.5, *) func fetchItems(forIdentityVerificationSignature completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(macOS 10.15.5, *) + func fetchItemsForIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } protocol GKLocalPlayerListener : GKChallengeListener, GKInviteEventListener, GKSavedGameListener, GKTurnBasedEventListener { } @@ -37,16 +46,26 @@ extension NSNotification.Name { extension GKLocalPlayer { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use setDefaultLeaderboardIdentifier:completionHandler: instead") func setDefaultLeaderboardCategoryID(_ categoryID: String?, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use setDefaultLeaderboardIdentifier:completionHandler: instead") + func setDefaultLeaderboardCategoryID(_ categoryID: String?) async throws @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use loadDefaultLeaderboardIdentifierWithCompletionHandler: instead") func loadDefaultLeaderboardCategoryID(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use loadDefaultLeaderboardIdentifierWithCompletionHandler: instead") + func loadDefaultLeaderboardCategoryID() async throws -> String @available(macOS, introduced: 10.10, deprecated: 10.11) func loadFriendPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.10, deprecated: 10.11) + func loadFriendPlayers() async throws -> [GKPlayer] @available(macOS, introduced: 10.10, deprecated: 10.15.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") func generateIdentityVerificationSignature(completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.10, deprecated: 10.15.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") + func generateIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } extension GKLocalPlayer { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") func loadFriends(completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") + func loadFriends() async throws -> [String] @available(macOS, introduced: 10.8, deprecated: 10.10, message: " This property is obsolete, Use loadFriendPlayersWithCompletionHandler: instead") var friends: [String]? { get } } diff --git a/macOS/GameKit/GKMatch.swift b/macOS/GameKit/GKMatch.swift index f46119a..352ae7c 100644 --- a/macOS/GameKit/GKMatch.swift +++ b/macOS/GameKit/GKMatch.swift @@ -27,8 +27,12 @@ class GKMatch : NSObject { func voiceChat(withName name: String) -> GKVoiceChat? @available(macOS 10.10, *) func chooseBestHostingPlayer(completionHandler: @escaping (GKPlayer?) -> Void) + @available(macOS 10.10, *) + func chooseBestHostingPlayer() async -> GKPlayer? @available(macOS 10.9, *) func rematch(completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(macOS 10.9, *) + func rematch() async throws -> GKMatch } protocol GKMatchDelegate : NSObjectProtocol { @available(macOS 10.10, *) @@ -49,6 +53,8 @@ protocol GKMatchDelegate : NSObjectProtocol { extension GKMatch { @available(macOS, introduced: 10.9, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") func chooseBestHostPlayer(completionHandler: @escaping (String?) -> Void) + @available(macOS, introduced: 10.9, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") + func chooseBestHostPlayer() async -> String? @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use sendData:toPlayers:dataMode:error:") func send(_ data: Data, toPlayers playerIDs: [String], with mode: GKMatch.SendDataMode) throws @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use players instead.") diff --git a/macOS/GameKit/GKMatchmaker.swift b/macOS/GameKit/GKMatchmaker.swift index 045c89a..2bab19a 100644 --- a/macOS/GameKit/GKMatchmaker.swift +++ b/macOS/GameKit/GKMatchmaker.swift @@ -69,17 +69,25 @@ class GKMatchmaker : NSObject { class func shared() -> GKMatchmaker @available(macOS 10.9, *) func match(for invite: GKInvite, completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(macOS 10.9, *) + func match(for invite: GKInvite) async throws -> GKMatch func findMatch(for request: GKMatchRequest, withCompletionHandler completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + func findMatch(for request: GKMatchRequest) async throws -> GKMatch @available(macOS 10.10, *) func findPlayers(forHostedRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func findPlayers(forHostedRequest request: GKMatchRequest) async throws -> [GKPlayer] func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest, completionHandler: ((Error?) -> Void)? = nil) + func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest) async throws func cancel() @available(macOS 10.10, *) func cancelPendingInvite(to player: GKPlayer) @available(macOS 10.9, *) func finishMatchmaking(for match: GKMatch) func queryPlayerGroupActivity(_ playerGroup: Int, withCompletionHandler completionHandler: ((Int, Error?) -> Void)? = nil) + func queryPlayerGroupActivity(_ playerGroup: Int) async throws -> Int func queryActivity(completionHandler: ((Int, Error?) -> Void)? = nil) + func queryActivity() async throws -> Int @available(macOS 10.10, *) func startBrowsingForNearbyPlayers(handler reachableHandler: ((GKPlayer, Bool) -> Void)? = nil) @available(macOS 10.9, *) @@ -96,4 +104,6 @@ extension GKMatchmaker { func cancelInvite(toPlayer playerID: String) @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") func findPlayers(forHostedMatchRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") + func findPlayers(forHostedMatchRequest request: GKMatchRequest) async throws -> [String] } diff --git a/macOS/GameKit/GKNotificationBanner.swift b/macOS/GameKit/GKNotificationBanner.swift index b96efe8..5372f83 100644 --- a/macOS/GameKit/GKNotificationBanner.swift +++ b/macOS/GameKit/GKNotificationBanner.swift @@ -4,5 +4,9 @@ class GKNotificationBanner : NSObject { @available(macOS 10.8, *) class func show(withTitle title: String?, message: String?, completionHandler: (() -> Void)? = nil) @available(macOS 10.8, *) + class func show(withTitle title: String?, message: String?) async + @available(macOS 10.8, *) class func show(withTitle title: String?, message: String?, duration: TimeInterval, completionHandler: (() -> Void)? = nil) + @available(macOS 10.8, *) + class func show(withTitle title: String?, message: String?, duration: TimeInterval) async } diff --git a/macOS/GameKit/GKPlayer.swift b/macOS/GameKit/GKPlayer.swift index 516b75f..6aa9b2a 100644 --- a/macOS/GameKit/GKPlayer.swift +++ b/macOS/GameKit/GKPlayer.swift @@ -4,6 +4,7 @@ let GKPlayerIDNoLongerAvailable: String @available(macOS 10.8, *) class GKPlayer : GKBasePlayer { class func loadPlayers(forIdentifiers identifiers: [String], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + class func loadPlayers(forIdentifiers identifiers: [String]) async throws -> [GKPlayer] @available(macOS 10.15, *) func scopedIDsArePersistent() -> Bool @available(macOS 10.14.6, *) @@ -21,6 +22,8 @@ class GKPlayer : GKBasePlayer { extension GKPlayer { @available(macOS 10.8, *) func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: ((NSImage?, Error?) -> Void)? = nil) + @available(macOS 10.8, *) + func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> NSImage } extension GKPlayer { enum PhotoSize : Int { diff --git a/macOS/GameKit/GKSavedGame.swift b/macOS/GameKit/GKSavedGame.swift index b3243a3..c8a723d 100644 --- a/macOS/GameKit/GKSavedGame.swift +++ b/macOS/GameKit/GKSavedGame.swift @@ -9,14 +9,24 @@ class GKSavedGame : NSObject, NSCopying { var modificationDate: Date? { get } @available(macOS 10.10, *) func loadData(completionHandler handler: ((Data?, Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func loadData() async throws -> Data } extension GKLocalPlayer : GKSavedGameListener { @available(macOS 10.10, *) func fetchSavedGames(completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil) @available(macOS 10.10, *) + func fetchSavedGames() async throws -> [GKSavedGame] + @available(macOS 10.10, *) func saveGameData(_ data: Data, withName name: String, completionHandler handler: ((GKSavedGame?, Error?) -> Void)? = nil) @available(macOS 10.10, *) + func saveGameData(_ data: Data, withName name: String) async throws -> GKSavedGame + @available(macOS 10.10, *) func deleteSavedGames(withName name: String, completionHandler handler: ((Error?) -> Void)? = nil) @available(macOS 10.10, *) + func deleteSavedGames(withName name: String) async throws + @available(macOS 10.10, *) func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data, completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data) async throws -> [GKSavedGame] } diff --git a/macOS/GameKit/GKScore.swift b/macOS/GameKit/GKScore.swift index 49bf53e..f39100b 100644 --- a/macOS/GameKit/GKScore.swift +++ b/macOS/GameKit/GKScore.swift @@ -18,10 +18,14 @@ class GKScore : NSObject, NSCoding, NSSecureCoding { var shouldSetDefaultLeaderboard: Bool @available(macOS 10.8, *) class func report(_ scores: [GKScore], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.8, *) + class func report(_ scores: [GKScore]) async throws } extension GKScore { @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use +reportScores:withCompletionhandler: instead") func report(completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use +reportScores:withCompletionhandler: instead") + func report() async throws @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use initWithLeaderboardIdentifier: instead") init(category: String?) @available(macOS, introduced: 10.8, deprecated: 10.10, message: "Use leaderboardIdentifier instead") diff --git a/macOS/GameKit/GKTurnBasedMatch.swift b/macOS/GameKit/GKTurnBasedMatch.swift index a11986f..dc062e1 100644 --- a/macOS/GameKit/GKTurnBasedMatch.swift +++ b/macOS/GameKit/GKTurnBasedMatch.swift @@ -94,35 +94,65 @@ class GKTurnBasedMatch : NSObject { @available(macOS 10.10, *) var exchangeMaxInitiatedExchangesPerPlayer: Int { get } class func find(for request: GKMatchRequest, withCompletionHandler completionHandler: @escaping (GKTurnBasedMatch?, Error?) -> Void) + class func find(for request: GKMatchRequest) async throws -> GKTurnBasedMatch class func loadMatches(completionHandler: (([GKTurnBasedMatch]?, Error?) -> Void)? = nil) + class func loadMatches() async throws -> [GKTurnBasedMatch] @available(macOS 10.8, *) class func load(withID matchID: String, withCompletionHandler completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(macOS 10.8, *) + class func load(withID matchID: String) async throws -> GKTurnBasedMatch @available(macOS 10.9, *) func rematch(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(macOS 10.9, *) + func rematch() async throws -> GKTurnBasedMatch @available(macOS 10.8, *) func acceptInvite(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(macOS 10.8, *) + func acceptInvite() async throws -> GKTurnBasedMatch + @available(macOS 10.8, *) func declineInvite(completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.8, *) + func declineInvite() async throws func remove(completionHandler: ((Error?) -> Void)? = nil) + func remove() async throws func loadMatchData(completionHandler: ((Data?, Error?) -> Void)? = nil) + func loadMatchData() async throws -> Data @available(macOS 10.9, *) func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.9, *) + func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws + @available(macOS 10.9, *) func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.9, *) + func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome) async throws func endMatchInTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + func endMatchInTurn(withMatch matchData: Data) async throws @available(macOS, introduced: 10.10, deprecated: 11.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS, introduced: 10.10, deprecated: 11.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") + func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?) async throws @available(macOS 11.0, *) func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any], completionHandler: @escaping (Error?) -> Void) + @available(macOS 11.0, *) + func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any]) async throws @available(macOS 10.8, *) func saveCurrentTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.8, *) + func saveCurrentTurn(withMatch matchData: Data) async throws @available(macOS 10.10, *) func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.10, *) + func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throws + @available(macOS 10.10, *) func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval, completionHandler: ((GKTurnBasedExchange?, Error?) -> Void)? = nil) @available(macOS 10.10, *) + func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval) async throws -> GKTurnBasedExchange + @available(macOS 10.10, *) func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String]) async throws } @available(macOS 10.10, *) enum GKTurnBasedExchangeStatus : Int8 { @@ -153,7 +183,11 @@ class GKTurnBasedExchange : NSObject { @available(macOS 10.10, *) func cancel(withLocalizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.10, *) + func cancel(withLocalizableMessageKey key: String, arguments: [String]) async throws + @available(macOS 10.10, *) func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 10.10, *) + func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data) async throws } @available(macOS 10.10, *) class GKTurnBasedExchangeReply : NSObject { diff --git a/macOS/IOUSBHost/IOUSBHostCIMessageHelpers.swift b/macOS/IOUSBHost/IOUSBHostCIMessageHelpers.swift new file mode 100644 index 0000000..c6d2b50 --- /dev/null +++ b/macOS/IOUSBHost/IOUSBHostCIMessageHelpers.swift @@ -0,0 +1,4 @@ + +func IOUSBHostCIMessageStatusToIOReturn(_ status: IOUSBHostCIMessageStatus) -> IOReturn +func IOUSBHostCIMessageStatusFromIOReturn(_ status: IOReturn) -> IOUSBHostCIMessageStatus +func IOUSBHostCILinkStateEnabled(_ linkState: IOUSBHostCILinkState) -> Bool diff --git a/macOS/IOUSBHost/IOUSBHostObject.swift b/macOS/IOUSBHost/IOUSBHostObject.swift index 4dc18be..e7e8338 100644 --- a/macOS/IOUSBHost/IOUSBHostObject.swift +++ b/macOS/IOUSBHost/IOUSBHostObject.swift @@ -6,6 +6,7 @@ class IOUSBHostObject : NSObject { var queue: DispatchQueue { get } func __send(_ request: IOUSBDeviceRequest, data: NSMutableData?, bytesTransferred: UnsafeMutablePointer?, completionTimeout: TimeInterval) throws func __enqueue(_ request: IOUSBDeviceRequest, data: NSMutableData?, completionTimeout: TimeInterval, completionHandler: IOUSBHostCompletionHandler? = nil) throws + func __enqueue(_ request: IOUSBDeviceRequest, data: NSMutableData?, completionTimeout: TimeInterval) async throws -> (IOReturn, Int) func __abortDeviceRequests(with option: IOUSBHostAbortOption) throws func __descriptor(with type: tIOUSBDescriptorType, length: UnsafeMutablePointer, index: Int, languageID: Int, requestType: tIOUSBDeviceRequestTypeValue, requestRecipient: tIOUSBDeviceRequestRecipientValue) throws -> UnsafePointer func __string(with index: Int, languageID: Int) throws -> String diff --git a/macOS/IOUSBHost/IOUSBHostPipe.swift b/macOS/IOUSBHost/IOUSBHostPipe.swift index e31cb75..3116484 100644 --- a/macOS/IOUSBHost/IOUSBHostPipe.swift +++ b/macOS/IOUSBHost/IOUSBHostPipe.swift @@ -8,11 +8,14 @@ class IOUSBHostPipe : IOUSBHostIOSource { func clearStall() throws func __sendControlRequest(_ request: IOUSBDeviceRequest, data: NSMutableData?, bytesTransferred: UnsafeMutablePointer?, completionTimeout: TimeInterval) throws func __enqueueControlRequest(_ request: IOUSBDeviceRequest, data: NSMutableData?, completionTimeout: TimeInterval, completionHandler: IOUSBHostCompletionHandler? = nil) throws + func __enqueueControlRequest(_ request: IOUSBDeviceRequest, data: NSMutableData?, completionTimeout: TimeInterval) async throws -> (IOReturn, Int) func __abort(with option: IOUSBHostAbortOption) throws func __sendIORequest(with data: NSMutableData?, bytesTransferred: UnsafeMutablePointer?, completionTimeout: TimeInterval) throws func enqueueIORequest(with data: NSMutableData?, completionTimeout: TimeInterval, completionHandler: IOUSBHostCompletionHandler? = nil) throws + func enqueueIORequest(with data: NSMutableData?, completionTimeout: TimeInterval) async throws -> (IOReturn, Int) func sendIORequest(with data: NSMutableData, frameList: UnsafeMutablePointer, frameListCount: Int, firstFrameNumber: UInt64) throws func enqueueIORequest(with data: NSMutableData, frameList: UnsafeMutablePointer, frameListCount: Int, firstFrameNumber: UInt64, completionHandler: IOUSBHostIsochronousCompletionHandler? = nil) throws + func enqueueIORequest(with data: NSMutableData, frameList: UnsafeMutablePointer, frameListCount: Int, firstFrameNumber: UInt64) async throws -> (IOReturn, UnsafeMutablePointer) func enableStreams() throws func disableStreams() throws func copyStream(withStreamID streamID: Int) throws -> IOUSBHostStream diff --git a/macOS/IOUSBHost/IOUSBHostStream.swift b/macOS/IOUSBHost/IOUSBHostStream.swift index 5284db4..2411f53 100644 --- a/macOS/IOUSBHost/IOUSBHostStream.swift +++ b/macOS/IOUSBHost/IOUSBHostStream.swift @@ -6,4 +6,5 @@ class IOUSBHostStream : IOUSBHostIOSource { func abort() throws func __sendIORequest(with data: NSMutableData?, bytesTransferred: UnsafeMutablePointer?) throws func enqueueIORequest(with data: NSMutableData?, completionHandler: IOUSBHostCompletionHandler? = nil) throws + func enqueueIORequest(with data: NSMutableData?) async throws -> (IOReturn, Int) } diff --git a/macOS/ImageCaptureCore/ICCameraDevice.swift b/macOS/ImageCaptureCore/ICCameraDevice.swift index 6820ac3..619f8f0 100644 --- a/macOS/ImageCaptureCore/ICCameraDevice.swift +++ b/macOS/ImageCaptureCore/ICCameraDevice.swift @@ -116,6 +116,8 @@ class ICCameraDevice : ICDevice { func requestSendPTPCommand(_ command: Data, outData data: Data?, sendCommandDelegate: Any, didSendCommand selector: Selector, contextInfo: UnsafeMutableRawPointer?) @available(macOS 10.15, *) func requestSendPTPCommand(_ ptpCommand: Data, outData ptpData: Data?, completion: @escaping (Data, Data, Error?) -> Void) + @available(macOS 10.15, *) + func requestSendPTPCommand(_ ptpCommand: Data, outData ptpData: Data?) async throws -> (Data, Data) } protocol ICCameraDeviceDelegate : ICDeviceDelegate { @available(macOS 10.4, *) diff --git a/macOS/ImageCaptureCore/ICCameraFile.swift b/macOS/ImageCaptureCore/ICCameraFile.swift index 85dc5c3..8caf555 100644 --- a/macOS/ImageCaptureCore/ICCameraFile.swift +++ b/macOS/ImageCaptureCore/ICCameraFile.swift @@ -50,9 +50,15 @@ class ICCameraFile : ICCameraItem { @available(macOS 10.15, *) func requestThumbnailData(options: [ICCameraItemThumbnailOption : Any]? = nil, completion: @escaping (Data?, Error?) -> Void) @available(macOS 10.15, *) + func requestThumbnailData(options: [ICCameraItemThumbnailOption : Any]? = nil) async throws -> Data + @available(macOS 10.15, *) func requestMetadataDictionary(options: [ICCameraItemMetadataOption : Any]? = nil, completion: @escaping ([AnyHashable : Any]?, Error?) -> Void) @available(macOS 10.15, *) + func requestMetadataDictionary(options: [ICCameraItemMetadataOption : Any]? = nil) async throws -> [AnyHashable : Any] + @available(macOS 10.15, *) func requestDownload(options: [ICDownloadOption : Any]? = nil, completion: @escaping (String?, Error?) -> Void) -> Progress? @available(macOS 10.15, *) func requestReadData(atOffset offset: off_t, length: off_t, completion: @escaping (Data?, Error?) -> Void) + @available(macOS 10.15, *) + func requestReadData(atOffset offset: off_t, length: off_t) async throws -> Data } diff --git a/macOS/ImageCaptureCore/ICDevice.swift b/macOS/ImageCaptureCore/ICDevice.swift index 4713f7f..742e6b6 100644 --- a/macOS/ImageCaptureCore/ICDevice.swift +++ b/macOS/ImageCaptureCore/ICDevice.swift @@ -144,9 +144,15 @@ class ICDevice : NSObject { @available(macOS 10.15, *) func requestOpenSession(options: [ICSessionOptions : Any]? = nil, completion: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func requestOpenSession(options: [ICSessionOptions : Any]? = nil) async throws + @available(macOS 10.15, *) func requestCloseSession(options: [ICSessionOptions : Any]? = nil, completion: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func requestCloseSession(options: [ICSessionOptions : Any]? = nil) async throws + @available(macOS 10.15, *) func requestEject(completion: @escaping (Error?) -> Void) + @available(macOS 10.15, *) + func requestEject() async throws @available(macOS 10.4, *) var autolaunchApplicationPath: String? @available(macOS 10.4, *) diff --git a/macOS/Intents/INColor.swift b/macOS/Intents/INColor.swift new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/macOS/Intents/INColor.swift @@ -0,0 +1 @@ + diff --git a/macOS/Intents/INInteraction.swift b/macOS/Intents/INInteraction.swift index 6f575eb..49f996d 100644 --- a/macOS/Intents/INInteraction.swift +++ b/macOS/Intents/INInteraction.swift @@ -23,9 +23,13 @@ enum INInteractionDirection : Int { class INInteraction : NSObject, NSSecureCoding, NSCopying { init(intent: INIntent, response: INIntentResponse?) func donate(completion: ((Error?) -> Void)? = nil) + func donate() async throws class func deleteAll(completion: ((Error?) -> Void)? = nil) + class func deleteAll() async throws class func delete(with identifiers: [String], completion: ((Error?) -> Void)? = nil) + class func delete(with identifiers: [String]) async throws class func delete(with groupIdentifier: String, completion: ((Error?) -> Void)? = nil) + class func delete(with groupIdentifier: String) async throws @NSCopying var intent: INIntent { get } @NSCopying var intentResponse: INIntentResponse? { get } var intentHandlingStatus: INIntentHandlingStatus { get } diff --git a/macOS/LinkPresentation/LPMetadataProvider.swift b/macOS/LinkPresentation/LPMetadataProvider.swift index ef6738c..44a9dd3 100644 --- a/macOS/LinkPresentation/LPMetadataProvider.swift +++ b/macOS/LinkPresentation/LPMetadataProvider.swift @@ -2,6 +2,7 @@ @available(macOS 10.15, *) class LPMetadataProvider : NSObject { func startFetchingMetadata(for URL: URL, completionHandler: @escaping (LPLinkMetadata?, Error?) -> Void) + func startFetchingMetadata(for URL: URL) async throws -> LPLinkMetadata func cancel() var shouldFetchSubresources: Bool var timeout: TimeInterval diff --git a/macOS/LocalAuthentication/LAContext.swift b/macOS/LocalAuthentication/LAContext.swift index 2360c75..2b92467 100644 --- a/macOS/LocalAuthentication/LAContext.swift +++ b/macOS/LocalAuthentication/LAContext.swift @@ -20,6 +20,8 @@ class LAContext : NSObject { func canEvaluatePolicy(_ policy: LAPolicy, error: NSErrorPointer) -> Bool @available(macOS 10.10, *) func evaluatePolicy(_ policy: LAPolicy, localizedReason: String, reply: @escaping (Bool, Error?) -> Void) + @available(macOS 10.10, *) + func evaluatePolicy(_ policy: LAPolicy, localizedReason: String) async throws -> Bool @available(macOS 10.11, *) func invalidate() @available(macOS 10.11, *) @@ -28,6 +30,8 @@ class LAContext : NSObject { func isCredentialSet(_ type: LACredentialType) -> Bool @available(macOS 10.11, *) func evaluateAccessControl(_ accessControl: SecAccessControl, operation: LAAccessControlOperation, localizedReason: String, reply: @escaping (Bool, Error?) -> Void) + @available(macOS 10.11, *) + func evaluateAccessControl(_ accessControl: SecAccessControl, operation: LAAccessControlOperation, localizedReason: String) async throws -> Bool @available(macOS 10.10, *) var localizedFallbackTitle: String? @available(macOS 10.12, *) diff --git a/macOS/MapKit/MKDirections.swift b/macOS/MapKit/MKDirections.swift index 1425b2f..871d059 100644 --- a/macOS/MapKit/MKDirections.swift +++ b/macOS/MapKit/MKDirections.swift @@ -7,7 +7,9 @@ extension MKDirections { class MKDirections : NSObject { init(request: MKDirections.Request) func calculate(completionHandler: @escaping MKDirections.DirectionsHandler) + func calculate() async throws -> MKDirections.Response func calculateETA(completionHandler: @escaping MKDirections.ETAHandler) + func calculateETA() async throws -> MKDirections.ETAResponse func cancel() var isCalculating: Bool { get } } diff --git a/macOS/MapKit/MKLocalSearch.swift b/macOS/MapKit/MKLocalSearch.swift index 3143870..4ada9a0 100644 --- a/macOS/MapKit/MKLocalSearch.swift +++ b/macOS/MapKit/MKLocalSearch.swift @@ -8,6 +8,7 @@ class MKLocalSearch : NSObject { @available(macOS 11.0, *) init(request: MKLocalPointsOfInterestRequest) func start(completionHandler: @escaping MKLocalSearch.CompletionHandler) + func start() async throws -> MKLocalSearch.Response func cancel() var isSearching: Bool { get } } diff --git a/macOS/MapKit/MKMapSnapshotter.swift b/macOS/MapKit/MKMapSnapshotter.swift index a69adf0..0b96043 100644 --- a/macOS/MapKit/MKMapSnapshotter.swift +++ b/macOS/MapKit/MKMapSnapshotter.swift @@ -6,7 +6,9 @@ extension MKMapSnapshotter { class MKMapSnapshotter : NSObject { init(options: MKMapSnapshotter.Options) func start(completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start() async throws -> MKMapSnapshotter.Snapshot func start(with queue: DispatchQueue, completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start(with queue: DispatchQueue) async throws -> MKMapSnapshotter.Snapshot func cancel() var isLoading: Bool { get } } diff --git a/macOS/Metal/MTLDevice.swift b/macOS/Metal/MTLDevice.swift index 68c96a8..69ec5bf 100644 --- a/macOS/Metal/MTLDevice.swift +++ b/macOS/Metal/MTLDevice.swift @@ -219,18 +219,25 @@ protocol MTLDevice : NSObjectProtocol { func makeLibrary(data: __DispatchData) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?, completionHandler: @escaping MTLNewLibraryCompletionHandler) + func makeLibrary(source: String, options: MTLCompileOptions?) async throws -> MTLLibrary func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, completionHandler: @escaping MTLNewRenderPipelineStateCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) async throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewRenderPipelineStateWithReflectionCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLRenderPipelineState, MTLRenderPipelineReflection) func makeComputePipelineState(function computeFunction: MTLFunction) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, completionHandler: @escaping MTLNewComputePipelineStateCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction) async throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(macOS 10.11, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState @available(macOS 10.11, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + @available(macOS 10.11, *) + func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(macOS 10.13, *) func makeFence() -> MTLFence? func supportsFeatureSet(_ featureSet: MTLFeatureSet) -> Bool @@ -246,6 +253,8 @@ protocol MTLDevice : NSObjectProtocol { func makeRenderPipelineState(tileDescriptor descriptor: MTLTileRenderPipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLRenderPipelineState @available(macOS 11.0, *) func makeRenderPipelineState(tileDescriptor descriptor: MTLTileRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewRenderPipelineStateWithReflectionCompletionHandler) + @available(macOS 11.0, *) + func makeRenderPipelineState(tileDescriptor descriptor: MTLTileRenderPipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLRenderPipelineState, MTLRenderPipelineReflection) @available(macOS 10.13, *) var maxThreadgroupMemoryLength: Int { get } @available(macOS 10.14, *) diff --git a/macOS/Metal/MTLLibrary.swift b/macOS/Metal/MTLLibrary.swift index 43bdadf..f9e71ad 100644 --- a/macOS/Metal/MTLLibrary.swift +++ b/macOS/Metal/MTLLibrary.swift @@ -137,13 +137,19 @@ protocol MTLLibrary : NSObjectProtocol { func makeFunction(name: String, constantValues: MTLFunctionConstantValues) throws -> MTLFunction @available(macOS 10.12, *) func makeFunction(name: String, constantValues: MTLFunctionConstantValues, completionHandler: @escaping (MTLFunction?, Error?) -> Void) + @available(macOS 10.12, *) + func makeFunction(name: String, constantValues: MTLFunctionConstantValues) async throws -> MTLFunction @available(macOS 11.0, *) func makeFunction(descriptor: MTLFunctionDescriptor, completionHandler: @escaping (MTLFunction?, Error?) -> Void) @available(macOS 11.0, *) + func makeFunction(descriptor: MTLFunctionDescriptor) async throws -> MTLFunction + @available(macOS 11.0, *) func makeFunction(descriptor: MTLFunctionDescriptor) throws -> MTLFunction @available(macOS 11.0, *) func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor, completionHandler: @escaping (MTLFunction?, Error?) -> Void) @available(macOS 11.0, *) + func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor) async throws -> MTLFunction + @available(macOS 11.0, *) func makeIntersectionFunction(descriptor: MTLIntersectionFunctionDescriptor) throws -> MTLFunction var functionNames: [String] { get } @available(macOS 11.0, *) diff --git a/macOS/MetalKit/MTKTextureLoader.swift b/macOS/MetalKit/MTKTextureLoader.swift index 4568098..19044f5 100644 --- a/macOS/MetalKit/MTKTextureLoader.swift +++ b/macOS/MetalKit/MTKTextureLoader.swift @@ -65,20 +65,35 @@ class MTKTextureLoader : NSObject { var device: MTLDevice { get } init(device: MTLDevice) func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(macOS 10.12, *) func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) @available(macOS 10.12, *) + func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture + @available(macOS 10.12, *) func newTexture(name: String, scaleFactor: CGFloat, displayGamut: NSDisplayGamut, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) @available(macOS 10.12, *) + func newTexture(name: String, scaleFactor: CGFloat, displayGamut: NSDisplayGamut, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture + @available(macOS 10.12, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) @available(macOS 10.12, *) + func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] + @available(macOS 10.12, *) func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) @available(macOS 10.12, *) + func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] + @available(macOS 10.12, *) func newTextures(names: [String], scaleFactor: CGFloat, displayGamut: NSDisplayGamut, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) + @available(macOS 10.12, *) + func newTextures(names: [String], scaleFactor: CGFloat, displayGamut: NSDisplayGamut, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(macOS 10.12, *) func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + @available(macOS 10.12, *) + func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) throws -> MTLTexture @available(macOS 10.12, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, error: NSErrorPointer) -> [MTLTexture] diff --git a/macOS/MetalPerformanceShaders/MetalPerformanceShaders.swift b/macOS/MetalPerformanceShaders/MetalPerformanceShaders.swift index 7bbda86..721e70e 100644 --- a/macOS/MetalPerformanceShaders/MetalPerformanceShaders.swift +++ b/macOS/MetalPerformanceShaders/MetalPerformanceShaders.swift @@ -3732,6 +3732,7 @@ class MPSAccelerationStructure : MPSKernel, NSSecureCoding, NSCopying { init?(coder aDecoder: NSCoder, group: MPSAccelerationStructureGroup) func rebuild() func rebuild(completionHandler: @escaping MPSAccelerationStructureCompletionHandler) + func rebuild() async -> MPSAccelerationStructure? func encodeRefit(commandBuffer: MTLCommandBuffer) func copy(with zone: NSZone? = nil, group: MPSAccelerationStructureGroup) -> Self } diff --git a/macOS/MultipeerConnectivity/MCSession.swift b/macOS/MultipeerConnectivity/MCSession.swift index 8cff849..34fe81b 100644 --- a/macOS/MultipeerConnectivity/MCSession.swift +++ b/macOS/MultipeerConnectivity/MCSession.swift @@ -56,6 +56,7 @@ protocol MCSessionDelegate : NSObjectProtocol { } extension MCSession { func nearbyConnectionData(forPeer peerID: MCPeerID, withCompletionHandler completionHandler: @escaping (Data?, Error?) -> Void) + func nearbyConnectionData(forPeer peerID: MCPeerID) async throws -> Data func connectPeer(_ peerID: MCPeerID, withNearbyConnectionData data: Data) func cancelConnectPeer(_ peerID: MCPeerID) } diff --git a/macOS/NaturalLanguage/NLTagger.swift b/macOS/NaturalLanguage/NLTagger.swift index 6c65ee1..423ede4 100644 --- a/macOS/NaturalLanguage/NLTagger.swift +++ b/macOS/NaturalLanguage/NLTagger.swift @@ -37,6 +37,8 @@ class NLTagger : NSObject { func gazetteers(for tagScheme: NLTagScheme) -> [NLGazetteer] @available(macOS 10.15, *) class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme, completionHandler: @escaping (NLTagger.AssetsResult, Error?) -> Void) + @available(macOS 10.15, *) + class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme) async throws -> NLTagger.AssetsResult } @available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) diff --git a/macOS/NetworkExtension/NetworkExtension.swift b/macOS/NetworkExtension/NetworkExtension.swift index c634de3..b1e8381 100644 --- a/macOS/NetworkExtension/NetworkExtension.swift +++ b/macOS/NetworkExtension/NetworkExtension.swift @@ -24,6 +24,8 @@ class NEAppProxyFlow : NSObject { @available(macOS 10.11, *) func open(withLocalEndpoint localEndpoint: NWHostEndpoint?, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func open(withLocalEndpoint localEndpoint: NWHostEndpoint?) async throws + @available(macOS 10.11, *) func closeReadWithError(_ error: Error?) @available(macOS 10.11, *) func closeWriteWithError(_ error: Error?) @@ -65,6 +67,8 @@ class NEProvider : NSObject { @available(macOS 10.11, *) func sleep(completionHandler: @escaping () -> Void) @available(macOS 10.11, *) + func sleep() async + @available(macOS 10.11, *) func wake() @available(macOS 10.11, *) func createTCPConnection(to remoteEndpoint: NWEndpoint, enableTLS: Bool, tlsParameters TLSParameters: NWTLSParameters?, delegate: Any?) -> NWTCPConnection @@ -72,6 +76,8 @@ class NEProvider : NSObject { func createUDPSession(to remoteEndpoint: NWEndpoint, from localEndpoint: NWHostEndpoint?) -> NWUDPSession @available(macOS, introduced: 10.12, deprecated: 10.14) func displayMessage(_ message: String, completionHandler: @escaping (Bool) -> Void) + @available(macOS, introduced: 10.12, deprecated: 10.14) + func displayMessage(_ message: String) async -> Bool @available(macOS 10.15, *) class func startSystemExtensionMode() @available(macOS 10.11, *) @@ -102,8 +108,12 @@ class NETunnelProvider : NEProvider { @available(macOS 10.11, *) func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) @available(macOS 10.11, *) + func handleAppMessage(_ messageData: Data) async -> Data? + @available(macOS 10.11, *) func setTunnelNetworkSettings(_ tunnelNetworkSettings: NETunnelNetworkSettings?, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.11, *) + func setTunnelNetworkSettings(_ tunnelNetworkSettings: NETunnelNetworkSettings?) async throws + @available(macOS 10.11, *) var protocolConfiguration: NEVPNProtocol { get } @available(macOS 10.11, *) var appRules: [NEAppRule]? { get } @@ -117,8 +127,12 @@ class NEAppProxyProvider : NETunnelProvider { @available(macOS 10.11, *) func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func startProxy(options: [String : Any]? = nil) async throws + @available(macOS 10.11, *) func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(macOS 10.11, *) + func stopProxy(with reason: NEProviderStopReason) async + @available(macOS 10.11, *) func cancelProxyWithError(_ error: Error?) @available(macOS 10.11, *) func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool @@ -158,10 +172,16 @@ class NEVPNManager : NSObject { @available(macOS 10.11, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func loadFromPreferences() async throws + @available(macOS 10.11, *) func removeFromPreferences(completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.11, *) + func removeFromPreferences() async throws + @available(macOS 10.11, *) func saveToPreferences(completionHandler: ((Error?) -> Void)? = nil) @available(macOS 10.11, *) + func saveToPreferences() async throws + @available(macOS 10.11, *) func setAuthorization(_ authorization: AuthorizationRef) @available(macOS 10.11, *) var onDemandRules: [NEOnDemandRule]? @@ -182,6 +202,8 @@ class NEVPNManager : NSObject { class NETunnelProviderManager : NEVPNManager { @available(macOS 10.11, *) class func loadAllFromPreferences(completionHandler: @escaping ([NETunnelProviderManager]?, Error?) -> Void) + @available(macOS 10.11, *) + class func loadAllFromPreferences() async throws -> [NETunnelProviderManager] @available(macOS 10.15.4, *) class func forPerAppVPN() -> Self @available(macOS 10.11, *) @@ -211,8 +233,12 @@ class NEAppProxyTCPFlow : NEAppProxyFlow { @available(macOS 10.11, *) func readData(completionHandler: @escaping (Data?, Error?) -> Void) @available(macOS 10.11, *) + func readData() async throws -> Data + @available(macOS 10.11, *) func write(_ data: Data, withCompletionHandler completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func write(_ data: Data) async throws + @available(macOS 10.11, *) var remoteEndpoint: NWEndpoint { get } } @available(macOS 10.11, *) @@ -220,8 +246,12 @@ class NEAppProxyUDPFlow : NEAppProxyFlow { @available(macOS 10.11, *) func readDatagrams(completionHandler: @escaping ([Data]?, [NWEndpoint]?, Error?) -> Void) @available(macOS 10.11, *) + func readDatagrams() async throws -> ([Data], [NWEndpoint]) + @available(macOS 10.11, *) func writeDatagrams(_ datagrams: [Data], sentBy remoteEndpoints: [NWEndpoint], completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func writeDatagrams(_ datagrams: [Data], sentBy remoteEndpoints: [NWEndpoint]) async throws + @available(macOS 10.11, *) var localEndpoint: NWEndpoint? { get } } @available(macOS 10.11, *) @@ -257,10 +287,16 @@ class NEDNSProxyManager : NSObject { @available(macOS 10.15, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func loadFromPreferences() async throws + @available(macOS 10.15, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func removeFromPreferences() async throws + @available(macOS 10.15, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func saveToPreferences() async throws + @available(macOS 10.15, *) var localizedDescription: String? @available(macOS 10.15, *) var providerProtocol: NEDNSProxyProviderProtocol? @@ -272,8 +308,12 @@ class NEDNSProxyProvider : NEProvider { @available(macOS 10.15, *) func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func startProxy(options: [String : Any]? = nil) async throws + @available(macOS 10.15, *) func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(macOS 10.15, *) + func stopProxy(with reason: NEProviderStopReason) async + @available(macOS 10.15, *) func cancelProxyWithError(_ error: Error?) @available(macOS 10.15, *) func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool @@ -405,10 +445,16 @@ class NEDNSSettingsManager : NSObject { @available(macOS 11.0, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + func loadFromPreferences() async throws + @available(macOS 11.0, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + func removeFromPreferences() async throws + @available(macOS 11.0, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 11.0, *) + func saveToPreferences() async throws + @available(macOS 11.0, *) var localizedDescription: String? @available(macOS 11.0, *) var dnsSettings: NEDNSSettings? @@ -492,8 +538,12 @@ class NEFilterProvider : NEProvider { @available(macOS 10.15, *) func startFilter(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func startFilter() async throws + @available(macOS 10.15, *) func stopFilter(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(macOS 10.15, *) + func stopFilter(with reason: NEProviderStopReason) async + @available(macOS 10.15, *) var filterConfiguration: NEFilterProviderConfiguration { get } @available(macOS 10.15, *) func handle(_ report: NEFilterReport) @@ -585,6 +635,8 @@ class NEFilterDataProvider : NEFilterProvider { @available(macOS 10.15, *) func apply(_ settings: NEFilterSettings?, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func apply(_ settings: NEFilterSettings?) async throws + @available(macOS 10.15, *) func resumeFlow(_ flow: NEFilterFlow, with verdict: NEFilterVerdict) @available(macOS 10.15.4, *) func update(_ flow: NEFilterSocketFlow, using verdict: NEFilterDataVerdict, for direction: NETrafficDirection) @@ -633,10 +685,16 @@ class NEFilterManager : NSObject { @available(macOS 10.11, *) func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func loadFromPreferences() async throws + @available(macOS 10.11, *) func removeFromPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func removeFromPreferences() async throws + @available(macOS 10.11, *) func saveToPreferences(completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func saveToPreferences() async throws + @available(macOS 10.11, *) var localizedDescription: String? @available(macOS 10.11, *) var providerConfiguration: NEFilterProviderConfiguration? @@ -866,10 +924,14 @@ class NEPacketTunnelFlow : NSObject { @available(macOS 10.11, *) func readPackets(completionHandler: @escaping ([Data], [NSNumber]) -> Void) @available(macOS 10.11, *) + func readPackets() async -> ([Data], [NSNumber]) + @available(macOS 10.11, *) func writePackets(_ packets: [Data], withProtocols protocols: [NSNumber]) -> Bool @available(macOS 10.12, *) func readPacketObjects(completionHandler: @escaping ([NEPacket]) -> Void) @available(macOS 10.12, *) + func readPacketObjects() async -> [NEPacket] + @available(macOS 10.12, *) func writePacketObjects(_ packets: [NEPacket]) -> Bool } @available(macOS 10.11, *) @@ -899,8 +961,12 @@ class NEPacketTunnelProvider : NETunnelProvider { @available(macOS 10.11, *) func startTunnel(options: [String : NSObject]? = nil, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func startTunnel(options: [String : NSObject]? = nil) async throws + @available(macOS 10.11, *) func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) @available(macOS 10.11, *) + func stopTunnel(with reason: NEProviderStopReason) async + @available(macOS 10.11, *) func cancelTunnelWithError(_ error: Error?) @available(macOS 10.11, *) var packetFlow: NEPacketTunnelFlow { get } @@ -913,6 +979,8 @@ class NEPacketTunnelProvider : NETunnelProvider { class NETransparentProxyManager : NEVPNManager { @available(macOS 10.15, *) class func loadAllFromPreferences(completionHandler: @escaping ([NETransparentProxyManager]?, Error?) -> Void) + @available(macOS 10.15, *) + class func loadAllFromPreferences() async throws -> [NETransparentProxyManager] } @available(macOS 10.15, *) class NETransparentProxyNetworkSettings : NETunnelNetworkSettings { @@ -1189,10 +1257,16 @@ class NWTCPConnection : NSObject { @available(macOS 10.11, *) func readLength(_ length: Int, completionHandler completion: @escaping (Data?, Error?) -> Void) @available(macOS 10.11, *) + func readLength(_ length: Int) async throws -> Data + @available(macOS 10.11, *) func readMinimumLength(_ minimum: Int, maximumLength maximum: Int, completionHandler completion: @escaping (Data?, Error?) -> Void) @available(macOS 10.11, *) + func readMinimumLength(_ minimum: Int, maximumLength maximum: Int) async throws -> Data + @available(macOS 10.11, *) func write(_ data: Data, completionHandler completion: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func write(_ data: Data) async throws + @available(macOS 10.11, *) func writeClose() } @available(macOS 10.11, *) @@ -1202,9 +1276,13 @@ protocol NWTCPConnectionAuthenticationDelegate : NSObjectProtocol { @available(macOS 10.11, *) optional func provideIdentity(for connection: NWTCPConnection, completionHandler completion: @escaping (SecIdentity, [Any]) -> Void) @available(macOS 10.11, *) + optional func provideIdentity(for connection: NWTCPConnection) async -> (SecIdentity, [Any]) + @available(macOS 10.11, *) optional func shouldEvaluateTrust(for connection: NWTCPConnection) -> Bool @available(macOS 10.11, *) optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any], completionHandler completion: @escaping (SecTrust) -> Void) + @available(macOS 10.11, *) + optional func evaluateTrust(for connection: NWTCPConnection, peerCertificateChain: [Any]) async -> SecTrust } @available(macOS 10.11, *) enum NWUDPSessionState : Int { @@ -1242,8 +1320,12 @@ class NWUDPSession : NSObject { @available(macOS 10.11, *) func writeMultipleDatagrams(_ datagramArray: [Data], completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func writeMultipleDatagrams(_ datagramArray: [Data]) async throws + @available(macOS 10.11, *) func writeDatagram(_ datagram: Data, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.11, *) + func writeDatagram(_ datagram: Data) async throws + @available(macOS 10.11, *) func cancel() } class NWTLSParameters : NSObject { diff --git a/macOS/NotificationCenter/NCWidgetProviding.swift b/macOS/NotificationCenter/NCWidgetProviding.swift index 545a161..30e536f 100644 --- a/macOS/NotificationCenter/NCWidgetProviding.swift +++ b/macOS/NotificationCenter/NCWidgetProviding.swift @@ -12,6 +12,8 @@ protocol NCWidgetProviding : NSExtensionRequestHandling { @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") optional func widgetPerformUpdate(completionHandler: @escaping (NCUpdateResult) -> Void) @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") + optional func widgetPerformUpdate() async -> NCUpdateResult + @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") optional func widgetMarginInsets(forProposedMarginInsets defaultMarginInset: NSEdgeInsets) -> NSEdgeInsets @available(macOS, introduced: 10.10, deprecated: 11.0, message: "Use WidgetKit instead. Today View extensions have been deprecated.") optional var widgetAllowsEditing: Bool { get } diff --git a/macOS/PassKit/PKAddShareablePassConfiguration.swift b/macOS/PassKit/PKAddShareablePassConfiguration.swift index befbe1e..a14c7e8 100644 --- a/macOS/PassKit/PKAddShareablePassConfiguration.swift +++ b/macOS/PassKit/PKAddShareablePassConfiguration.swift @@ -16,6 +16,7 @@ enum PKAddShareablePassConfigurationPrimaryAction : UInt { } class PKAddShareablePassConfiguration : PKAddSecureElementPassConfiguration { class func forPassMetaData(_ passMetadata: [PKShareablePassMetadata], provisioningPolicyIdentifier: String, action: PKAddShareablePassConfigurationPrimaryAction, completion: @escaping (PKAddShareablePassConfiguration?, Error?) -> Void) + class func forPassMetaData(_ passMetadata: [PKShareablePassMetadata], provisioningPolicyIdentifier: String, action: PKAddShareablePassConfigurationPrimaryAction) async throws -> PKAddShareablePassConfiguration var primaryAction: PKAddShareablePassConfigurationPrimaryAction { get } var credentialsMetadata: [PKShareablePassMetadata] { get } var provisioningPolicyIdentifier: String { get } diff --git a/macOS/PassKit/PKPassLibrary.swift b/macOS/PassKit/PKPassLibrary.swift index ff7ebd6..96f3d24 100644 --- a/macOS/PassKit/PKPassLibrary.swift +++ b/macOS/PassKit/PKPassLibrary.swift @@ -40,6 +40,8 @@ class PKPassLibrary : NSObject { @available(macOS 10.12, *) func addPasses(_ passes: [PKPass], withCompletionHandler completion: ((PKPassLibraryAddPassesStatus) -> Void)? = nil) @available(macOS 10.12, *) + func addPasses(_ passes: [PKPass]) async -> PKPassLibraryAddPassesStatus + @available(macOS 10.12, *) func openPaymentSetup() func present(_ pass: PKPaymentPass) func present(_ pass: PKSecureElementPass) @@ -47,9 +49,13 @@ class PKPassLibrary : NSObject { func canAddSecureElementPass(primaryAccountIdentifier: String) -> Bool func canAddFelicaPass() -> Bool func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data, completion: ((Bool, Error) -> Void)? = nil) + func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data) async -> (Bool, Error) func activate(_ paymentPass: PKPaymentPass, withActivationCode activationCode: String, completion: ((Bool, Error) -> Void)? = nil) + func activate(_ paymentPass: PKPaymentPass, withActivationCode activationCode: String) async -> (Bool, Error) func activate(_ secureElementPass: PKSecureElementPass, activationData: Data, completion: ((Bool, Error?) -> Void)? = nil) + func activate(_ secureElementPass: PKSecureElementPass, activationData: Data) async throws -> Bool func sign(_ signData: Data, using secureElementPass: PKSecureElementPass, completion: @escaping (Data?, Data?, Error?) -> Void) + func sign(_ signData: Data, using secureElementPass: PKSecureElementPass) async throws -> (Data, Data) } struct PKPassLibraryNotificationName : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(_ rawValue: String) diff --git a/macOS/PassKit/PKPaymentAuthorizationController.swift b/macOS/PassKit/PKPaymentAuthorizationController.swift index 89ea575..f0af447 100644 --- a/macOS/PassKit/PKPaymentAuthorizationController.swift +++ b/macOS/PassKit/PKPaymentAuthorizationController.swift @@ -5,24 +5,40 @@ protocol PKPaymentAuthorizationControllerDelegate : NSObjectProtocol { @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationResult + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationStatus + @available(macOS 11.0, *) optional func paymentAuthorizationControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationController) @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didRequestMerchantSessionUpdate handler: @escaping (PKPaymentRequestMerchantSessionUpdate) -> Void) @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> PKPaymentRequestShippingMethodUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> PKPaymentRequestShippingContactUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, handler completion: @escaping (PKPaymentRequestPaymentMethodUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, completion: @escaping (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) + @available(macOS 11.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, completion: @escaping ([PKPaymentSummaryItem]) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> [PKPaymentSummaryItem] + @available(macOS 11.0, *) func presentationWindow(for controller: PKPaymentAuthorizationController) -> NSWindow? } @available(macOS 11.0, *) @@ -33,5 +49,7 @@ class PKPaymentAuthorizationController : NSObject { weak var delegate: @sil_weak PKPaymentAuthorizationControllerDelegate? init(paymentRequest request: PKPaymentRequest) func present(completion: ((Bool) -> Void)? = nil) + func present() async -> Bool func dismiss(completion: (() -> Void)? = nil) + func dismiss() async } diff --git a/macOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift b/macOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift index fa629a8..bf74fa9 100644 --- a/macOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift +++ b/macOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.swift @@ -5,21 +5,37 @@ protocol PKPaymentAuthorizationViewControllerDelegate : NSObjectProtocol { @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationResult + @available(macOS 11.0, *) optional func paymentAuthorizationViewControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationViewController) @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didRequestMerchantSessionUpdate handler: @escaping (PKPaymentRequestMerchantSessionUpdate) -> Void) @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod, handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod) async -> PKPaymentRequestShippingMethodUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact, handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact) async -> PKPaymentRequestShippingContactUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod, handler completion: @escaping (PKPaymentRequestPaymentMethodUpdate) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationStatus + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod, completion: @escaping (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect shippingMethod: PKShippingMethod) async -> (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelectShippingContact contact: PKContact) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) + @available(macOS 11.0, *) optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod, completion: @escaping ([PKPaymentSummaryItem]) -> Void) + @available(macOS 11.0, *) + optional func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didSelect paymentMethod: PKPaymentMethod) async -> [PKPaymentSummaryItem] } diff --git a/macOS/PassKit/PKPaymentInformationEventExtension.swift b/macOS/PassKit/PKPaymentInformationEventExtension.swift index d6891c7..c433e04 100644 --- a/macOS/PassKit/PKPaymentInformationEventExtension.swift +++ b/macOS/PassKit/PKPaymentInformationEventExtension.swift @@ -5,6 +5,9 @@ class PKPaymentInformationEventExtension : NSObject { } protocol PKPaymentInformationRequestHandling { func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest, completion: @escaping PKInformationRequestCompletionBlock) + func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest) async -> PKBarcodeEventMetadataResponse func handle(_ signatureRequest: PKBarcodeEventSignatureRequest, completion: @escaping PKSignatureRequestCompletionBlock) + func handle(_ signatureRequest: PKBarcodeEventSignatureRequest) async -> PKBarcodeEventSignatureResponse func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest, completion: @escaping () -> Void) + func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest) async } diff --git a/macOS/Photos/PHAssetResourceManager.swift b/macOS/Photos/PHAssetResourceManager.swift index 73956b5..6a850c3 100644 --- a/macOS/Photos/PHAssetResourceManager.swift +++ b/macOS/Photos/PHAssetResourceManager.swift @@ -21,5 +21,7 @@ class PHAssetResourceManager : NSObject { @available(macOS 10.15, *) func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?, completionHandler: @escaping (Error?) -> Void) @available(macOS 10.15, *) + func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?) async throws + @available(macOS 10.15, *) func cancelDataRequest(_ requestID: PHAssetResourceDataRequestID) } diff --git a/macOS/Photos/PHLivePhotoEditingContext.swift b/macOS/Photos/PHLivePhotoEditingContext.swift index e93ee8f..00fe3a9 100644 --- a/macOS/Photos/PHLivePhotoEditingContext.swift +++ b/macOS/Photos/PHLivePhotoEditingContext.swift @@ -26,8 +26,12 @@ class PHLivePhotoEditingContext : NSObject { @available(macOS 10.12, *) func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil, completionHandler handler: @escaping (PHLivePhoto?, Error?) -> Void) @available(macOS 10.12, *) + func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil) async throws -> PHLivePhoto + @available(macOS 10.12, *) func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil, completionHandler handler: @escaping (Bool, Error?) -> Void) @available(macOS 10.12, *) + func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil) async throws -> Bool + @available(macOS 10.12, *) func cancel() } @available(macOS 10.12, macOS 10.12, *) diff --git a/macOS/Photos/PHPhotoLibrary.swift b/macOS/Photos/PHPhotoLibrary.swift index d8c76a5..92c664d 100644 --- a/macOS/Photos/PHPhotoLibrary.swift +++ b/macOS/Photos/PHPhotoLibrary.swift @@ -54,6 +54,8 @@ class PHPhotoLibrary : NSObject { @available(macOS 10.13, *) func performChanges(_ changeBlock: @escaping () -> Void, completionHandler: ((Bool, Error?) -> Void)? = nil) @available(macOS 10.13, *) + func performChanges(_ changeBlock: @escaping () -> Void) async throws -> Bool + @available(macOS 10.13, *) func performChangesAndWait(_ changeBlock: @escaping () -> Void) throws @available(macOS 10.13, *) func register(_ observer: PHPhotoLibraryChangeObserver) diff --git a/macOS/PhotosUI/PHContentEditingController.swift b/macOS/PhotosUI/PHContentEditingController.swift index 08b8e45..9c1a2b5 100644 --- a/macOS/PhotosUI/PHContentEditingController.swift +++ b/macOS/PhotosUI/PHContentEditingController.swift @@ -8,6 +8,8 @@ protocol PHContentEditingController : NSObjectProtocol { @available(macOS 10.11, *) func finishContentEditing(completionHandler: @escaping (PHContentEditingOutput?) -> Void) @available(macOS 10.11, *) + func finishContentEditing() async -> PHContentEditingOutput? + @available(macOS 10.11, *) func cancelContentEditing() @available(macOS 10.11, *) var shouldShowCancelConfirmation: Bool { get } diff --git a/macOS/PhotosUI/PHProjectExtensionController.swift b/macOS/PhotosUI/PHProjectExtensionController.swift index addd7a1..65db9e8 100644 --- a/macOS/PhotosUI/PHProjectExtensionController.swift +++ b/macOS/PhotosUI/PHProjectExtensionController.swift @@ -8,7 +8,13 @@ protocol PHProjectExtensionController : NSObjectProtocol { @available(macOS 10.13, *) func beginProject(with extensionContext: PHProjectExtensionContext, projectInfo: PHProjectInfo, completion: @escaping (Error?) -> Void) @available(macOS 10.13, *) + func beginProject(with extensionContext: PHProjectExtensionContext, projectInfo: PHProjectInfo) async throws + @available(macOS 10.13, *) func resumeProject(with extensionContext: PHProjectExtensionContext, completion: @escaping (Error?) -> Void) @available(macOS 10.13, *) + func resumeProject(with extensionContext: PHProjectExtensionContext) async throws + @available(macOS 10.13, *) func finishProject(completionHandler completion: @escaping () -> Void) + @available(macOS 10.13, *) + func finishProject() async } diff --git a/macOS/PushKit/PKPushRegistry.swift b/macOS/PushKit/PKPushRegistry.swift index 66fca9c..b10a57d 100644 --- a/macOS/PushKit/PKPushRegistry.swift +++ b/macOS/PushKit/PKPushRegistry.swift @@ -16,5 +16,7 @@ protocol PKPushRegistryDelegate : NSObjectProtocol { @available(macOS 10.15, *) optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) @available(macOS 10.15, *) + optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async + @available(macOS 10.15, *) optional func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) } diff --git a/macOS/QuickLookThumbnailing/QLThumbnailGenerator.swift b/macOS/QuickLookThumbnailing/QLThumbnailGenerator.swift index c4395bf..feca539 100644 --- a/macOS/QuickLookThumbnailing/QLThumbnailGenerator.swift +++ b/macOS/QuickLookThumbnailing/QLThumbnailGenerator.swift @@ -3,7 +3,9 @@ class QLThumbnailGenerator : NSObject { class var shared: QLThumbnailGenerator { get } func generateBestRepresentation(for request: QLThumbnailGenerator.Request, completion completionHandler: @escaping (QLThumbnailRepresentation?, Error?) -> Void) + func generateBestRepresentation(for request: QLThumbnailGenerator.Request) async throws -> QLThumbnailRepresentation func generateRepresentations(for request: QLThumbnailGenerator.Request, update updateHandler: ((QLThumbnailRepresentation?, QLThumbnailRepresentation.RepresentationType, Error?) -> Void)? = nil) func cancel(_ request: QLThumbnailGenerator.Request) func saveBestRepresentation(for request: QLThumbnailGenerator.Request, to fileURL: URL, contentType: String, completion completionHandler: @escaping (Error?) -> Void) + func saveBestRepresentation(for request: QLThumbnailGenerator.Request, to fileURL: URL, contentType: String) async throws } diff --git a/macOS/ReplayKit/RPBroadcast.swift b/macOS/ReplayKit/RPBroadcast.swift index 46cfd86..653a468 100644 --- a/macOS/ReplayKit/RPBroadcast.swift +++ b/macOS/ReplayKit/RPBroadcast.swift @@ -2,6 +2,8 @@ class RPBroadcastActivityController : NSObject { @available(macOS 11.0, *) class func showBroadcastPicker(at point: CGPoint, from window: NSWindow?, preferredExtensionIdentifier preferredExtension: String?, completionHandler handler: @escaping (RPBroadcastActivityController?, Error?) -> Void) + @available(macOS 11.0, *) + class func showBroadcastPicker(at point: CGPoint, from window: NSWindow?, preferredExtensionIdentifier preferredExtension: String?) async throws -> RPBroadcastActivityController weak var delegate: @sil_weak RPBroadcastActivityControllerDelegate? } @available(macOS 11.0, *) diff --git a/macOS/ReplayKit/RPBroadcastExtension.swift b/macOS/ReplayKit/RPBroadcastExtension.swift index 421de7b..c6bb237 100644 --- a/macOS/ReplayKit/RPBroadcastExtension.swift +++ b/macOS/ReplayKit/RPBroadcastExtension.swift @@ -3,6 +3,8 @@ extension NSExtensionContext { @available(macOS 11.0, *) func loadBroadcastingApplicationInfo(completion handler: @escaping (String, String, NSImage?) -> Void) @available(macOS 11.0, *) + func loadBroadcastingApplicationInfo() async -> (String, String, NSImage?) + @available(macOS 11.0, *) func completeRequest(withBroadcast broadcastURL: URL, setupInfo: [String : NSCoding & NSObjectProtocol]?) } @available(macOS 11.0, *) diff --git a/macOS/ReplayKit/RPScreenRecorder.swift b/macOS/ReplayKit/RPScreenRecorder.swift index 673a3d1..511d7c0 100644 --- a/macOS/ReplayKit/RPScreenRecorder.swift +++ b/macOS/ReplayKit/RPScreenRecorder.swift @@ -12,10 +12,14 @@ class RPScreenRecorder : NSObject { func stopRecording(handler: ((RPPreviewViewController?, Error?) -> Void)? = nil) @available(macOS 11.0, *) func stopRecording(withOutput url: URL, completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 11.0, *) + func stopRecording(withOutput url: URL) async throws func discardRecording(handler: @escaping () -> Void) @available(macOS 11.0, *) func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 11.0, *) + func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?) async throws + @available(macOS 11.0, *) func stopCapture(handler: ((Error?) -> Void)? = nil) weak var delegate: @sil_weak RPScreenRecorderDelegate? var isAvailable: Bool { get } diff --git a/macOS/SafariServices/SFContentBlockerManager.swift b/macOS/SafariServices/SFContentBlockerManager.swift index 9a87562..0bb2c87 100644 --- a/macOS/SafariServices/SFContentBlockerManager.swift +++ b/macOS/SafariServices/SFContentBlockerManager.swift @@ -1,5 +1,7 @@ class SFContentBlockerManager : NSObject { class func reloadContentBlocker(withIdentifier identifier: String, completionHandler: ((Error?) -> Void)? = nil) + class func reloadContentBlocker(withIdentifier identifier: String) async throws class func getStateOfContentBlocker(withIdentifier identifier: String, completionHandler: @escaping (SFContentBlockerState?, Error?) -> Void) + class func stateOfContentBlocker(withIdentifier identifier: String) async throws -> SFContentBlockerState } diff --git a/macOS/SafariServices/SFSafariApplication.swift b/macOS/SafariServices/SFSafariApplication.swift index b77732a..ad6840a 100644 --- a/macOS/SafariServices/SFSafariApplication.swift +++ b/macOS/SafariServices/SFSafariApplication.swift @@ -2,10 +2,16 @@ let SFExtensionMessageKey: String class SFSafariApplication : NSObject { class func getActiveWindow(completionHandler: @escaping (SFSafariWindow?) -> Void) + class func activeWindow() async -> SFSafariWindow? class func getAllWindows(completionHandler: @escaping ([SFSafariWindow]) -> Void) + class func allWindows() async -> [SFSafariWindow] class func openWindow(with url: URL, completionHandler: ((SFSafariWindow?) -> Void)? = nil) + class func openWindow(with url: URL) async -> SFSafariWindow? class func setToolbarItemsNeedUpdate() class func getHostApplication(completionHandler: @escaping (NSRunningApplication) -> Void) + class func hostApplication() async -> NSRunningApplication class func showPreferencesForExtension(withIdentifier identifier: String, completionHandler: ((Error?) -> Void)? = nil) + class func showPreferencesForExtension(withIdentifier identifier: String) async throws class func dispatchMessage(withName messageName: String, toExtensionWithIdentifier identifier: String, userInfo: [String : Any]? = nil, completionHandler: ((Error?) -> Void)? = nil) + class func dispatchMessage(withName messageName: String, toExtensionWithIdentifier identifier: String, userInfo: [String : Any]? = nil) async throws } diff --git a/macOS/SafariServices/SFSafariExtension.swift b/macOS/SafariServices/SFSafariExtension.swift index 1b5ad33..2d8f86c 100644 --- a/macOS/SafariServices/SFSafariExtension.swift +++ b/macOS/SafariServices/SFSafariExtension.swift @@ -1,4 +1,5 @@ class SFSafariExtension : NSObject { class func getBaseURI(completionHandler: @escaping (URL?) -> Void) + class func baseURI() async -> URL? } diff --git a/macOS/SafariServices/SFSafariExtensionHandling.swift b/macOS/SafariServices/SFSafariExtensionHandling.swift index f881cd6..0054171 100644 --- a/macOS/SafariServices/SFSafariExtensionHandling.swift +++ b/macOS/SafariServices/SFSafariExtensionHandling.swift @@ -10,6 +10,7 @@ protocol SFSafariExtensionHandling : NSObjectProtocol { optional func popoverDidClose(in window: SFSafariWindow) optional func popoverViewController() -> SFSafariExtensionViewController optional func additionalRequestHeaders(for url: URL, completionHandler: @escaping ([String : String]?) -> Void) + optional func additionalRequestHeaders(for url: URL) async -> [String : String]? optional func contentBlocker(withIdentifier contentBlockerIdentifier: String, blockedResourcesWith urls: [URL], on page: SFSafariPage) optional func page(_ page: SFSafariPage, willNavigateTo url: URL?) } diff --git a/macOS/SafariServices/SFSafariExtensionManager.swift b/macOS/SafariServices/SFSafariExtensionManager.swift index 7fd3c2b..cbc6c22 100644 --- a/macOS/SafariServices/SFSafariExtensionManager.swift +++ b/macOS/SafariServices/SFSafariExtensionManager.swift @@ -1,4 +1,5 @@ class SFSafariExtensionManager : NSObject { class func getStateOfSafariExtension(withIdentifier identifier: String, completionHandler: @escaping (SFSafariExtensionState?, Error?) -> Void) + class func stateOfSafariExtension(withIdentifier identifier: String) async throws -> SFSafariExtensionState } diff --git a/macOS/SafariServices/SFSafariPage.swift b/macOS/SafariServices/SFSafariPage.swift index 709c6a2..c2a20b5 100644 --- a/macOS/SafariServices/SFSafariPage.swift +++ b/macOS/SafariServices/SFSafariPage.swift @@ -3,6 +3,9 @@ class SFSafariPage : NSObject, NSCopying, NSSecureCoding { func dispatchMessageToScript(withName messageName: String, userInfo: [String : Any]? = nil) func reload() func getPropertiesWithCompletionHandler(_ completionHandler: @escaping (SFSafariPageProperties?) -> Void) + func properties() async -> SFSafariPageProperties? func getContainingTab(completionHandler: @escaping (SFSafariTab) -> Void) + func containingTab() async -> SFSafariTab func getScreenshotOfVisibleArea(completionHandler: @escaping (NSImage?) -> Void) + func screenshotOfVisibleArea() async -> NSImage? } diff --git a/macOS/SafariServices/SFSafariTab.swift b/macOS/SafariServices/SFSafariTab.swift index 7e7b6a5..c280440 100644 --- a/macOS/SafariServices/SFSafariTab.swift +++ b/macOS/SafariServices/SFSafariTab.swift @@ -1,9 +1,13 @@ class SFSafariTab : NSObject, NSCopying, NSSecureCoding { func getActivePage(completionHandler: @escaping (SFSafariPage?) -> Void) + func activePage() async -> SFSafariPage? func getPagesWithCompletionHandler(_ completionHandler: @escaping ([SFSafariPage]?) -> Void) + func pages() async -> [SFSafariPage]? func getContainingWindow(completionHandler: @escaping (SFSafariWindow?) -> Void) + func containingWindow() async -> SFSafariWindow? func activate(completionHandler: (() -> Void)? = nil) + func activate() async func navigate(to url: URL) func close() } diff --git a/macOS/SafariServices/SFSafariWindow.swift b/macOS/SafariServices/SFSafariWindow.swift index 87380de..f4a868a 100644 --- a/macOS/SafariServices/SFSafariWindow.swift +++ b/macOS/SafariServices/SFSafariWindow.swift @@ -1,8 +1,12 @@ class SFSafariWindow : NSObject, NSCopying, NSSecureCoding { func getActiveTab(completionHandler: @escaping (SFSafariTab?) -> Void) + func activeTab() async -> SFSafariTab? func getAllTabs(completionHandler: @escaping ([SFSafariTab]) -> Void) + func allTabs() async -> [SFSafariTab] func openTab(with url: URL, makeActiveIfPossible activateTab: Bool, completionHandler: ((SFSafariTab?) -> Void)? = nil) + func openTab(with url: URL, makeActiveIfPossible activateTab: Bool) async -> SFSafariTab? func getToolbarItem(completionHandler: @escaping (SFSafariToolbarItem?) -> Void) + func toolbarItem() async -> SFSafariToolbarItem? func close() } diff --git a/macOS/SceneKit/SCNAction.swift b/macOS/SceneKit/SCNAction.swift index 9486e5e..a9c068e 100644 --- a/macOS/SceneKit/SCNAction.swift +++ b/macOS/SceneKit/SCNAction.swift @@ -6,10 +6,14 @@ protocol SCNActionable : NSObjectProtocol { @available(macOS 10.10, *) func runAction(_ action: SCNAction, completionHandler block: (() -> Void)? = nil) @available(macOS 10.10, *) + func runAction(_ action: SCNAction) async + @available(macOS 10.10, *) func runAction(_ action: SCNAction, forKey key: String?) @available(macOS 10.10, *) func runAction(_ action: SCNAction, forKey key: String?, completionHandler block: (() -> Void)? = nil) @available(macOS 10.10, *) + func runAction(_ action: SCNAction, forKey key: String?) async + @available(macOS 10.10, *) var hasActions: Bool { get } @available(macOS 10.10, *) func action(forKey key: String) -> SCNAction? diff --git a/macOS/SceneKit/SCNSceneRenderer.swift b/macOS/SceneKit/SCNSceneRenderer.swift index 57b51a1..330e270 100644 --- a/macOS/SceneKit/SCNSceneRenderer.swift +++ b/macOS/SceneKit/SCNSceneRenderer.swift @@ -64,6 +64,8 @@ protocol SCNSceneRenderer : NSObjectProtocol { func prepare(_ object: Any, shouldAbortBlock block: (() -> Bool)? = nil) -> Bool @available(macOS 10.10, *) func prepare(_ objects: [Any], completionHandler: ((Bool) -> Void)? = nil) + @available(macOS 10.10, *) + func prepare(_ objects: [Any]) async -> Bool @available(macOS 10.9, *) var showsStatistics: Bool { get set } @available(macOS 10.11, *) diff --git a/macOS/SoundAnalysis/SNAnalyzer.swift b/macOS/SoundAnalysis/SNAnalyzer.swift index 7cf7950..7a6bb6f 100644 --- a/macOS/SoundAnalysis/SNAnalyzer.swift +++ b/macOS/SoundAnalysis/SNAnalyzer.swift @@ -16,5 +16,6 @@ class SNAudioFileAnalyzer : NSObject { func removeAllRequests() func analyze() func analyze(completionHandler: @escaping (Bool) -> Void) + func analyze() async -> Bool func cancelAnalysis() } diff --git a/macOS/SpriteKit/SKNode.swift b/macOS/SpriteKit/SKNode.swift index bf8f4da..f94255b 100644 --- a/macOS/SpriteKit/SKNode.swift +++ b/macOS/SpriteKit/SKNode.swift @@ -56,6 +56,7 @@ class SKNode : NSResponder, NSCopying, NSSecureCoding { func inParentHierarchy(_ parent: SKNode) -> Bool func run(_ action: SKAction) func run(_ action: SKAction, completion block: @escaping () -> Void) + func run(_ action: SKAction) async func run(_ action: SKAction, withKey key: String) func hasActions() -> Bool func action(forKey key: String) -> SKAction? diff --git a/macOS/SpriteKit/SKTexture.swift b/macOS/SpriteKit/SKTexture.swift index b3c325d..fe1a559 100644 --- a/macOS/SpriteKit/SKTexture.swift +++ b/macOS/SpriteKit/SKTexture.swift @@ -30,7 +30,9 @@ class SKTexture : NSObject, NSCopying, NSSecureCoding { @available(macOS 10.11, *) func cgImage() -> CGImage class func preload(_ textures: [SKTexture], withCompletionHandler completionHandler: @escaping () -> Void) + class func preload(_ textures: [SKTexture]) async func preload(completionHandler: @escaping () -> Void) + func preload() async } extension SKTexture : _CustomPlaygroundQuickLookable { diff --git a/macOS/SpriteKit/SKTextureAtlas.swift b/macOS/SpriteKit/SKTextureAtlas.swift index efe0953..9faca6d 100644 --- a/macOS/SpriteKit/SKTextureAtlas.swift +++ b/macOS/SpriteKit/SKTextureAtlas.swift @@ -5,9 +5,13 @@ class SKTextureAtlas : NSObject, NSSecureCoding { convenience init(dictionary properties: [String : Any]) func textureNamed(_ name: String) -> SKTexture class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas], withCompletionHandler completionHandler: @escaping () -> Void) + class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas]) async @available(macOS 10.11, *) class func preloadTextureAtlasesNamed(_ atlasNames: [String], withCompletionHandler completionHandler: @escaping (Error?, [SKTextureAtlas]) -> Void) + @available(macOS 10.11, *) + class func preloadTextureAtlasesNamed(_ atlasNames: [String]) async throws -> [SKTextureAtlas] func preload(completionHandler: @escaping () -> Void) + func preload() async var textureNames: [String] { get } } diff --git a/macOS/StoreKit/SKCloudServiceController.swift b/macOS/StoreKit/SKCloudServiceController.swift index 42a7a0c..bbe3982 100644 --- a/macOS/StoreKit/SKCloudServiceController.swift +++ b/macOS/StoreKit/SKCloudServiceController.swift @@ -25,11 +25,18 @@ class SKCloudServiceController : NSObject { class func requestAuthorization(_ handler: @escaping (SKCloudServiceAuthorizationStatus) -> Void) @available(macOS 11.0, *) func requestCapabilities(completionHandler: @escaping (SKCloudServiceCapability, Error?) -> Void) + @available(macOS 11.0, *) + func requestCapabilities() async throws -> SKCloudServiceCapability func requestStorefrontCountryCode(completionHandler: @escaping (String?, Error?) -> Void) + func requestStorefrontCountryCode() async throws -> String @available(macOS 11.0, *) func requestStorefrontIdentifier(completionHandler: @escaping (String?, Error?) -> Void) @available(macOS 11.0, *) + func requestStorefrontIdentifier() async throws -> String + @available(macOS 11.0, *) func requestUserToken(forDeveloperToken developerToken: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(macOS 11.0, *) + func requestUserToken(forDeveloperToken developerToken: String) async throws -> String } extension NSNotification.Name { @available(macOS 11.0, *) diff --git a/macOS/StoreKit/SKProductStorePromotionController.swift b/macOS/StoreKit/SKProductStorePromotionController.swift index 6208892..82ae6d9 100644 --- a/macOS/StoreKit/SKProductStorePromotionController.swift +++ b/macOS/StoreKit/SKProductStorePromotionController.swift @@ -14,9 +14,17 @@ class SKProductStorePromotionController : NSObject { @available(macOS 11.0, *) func fetchStorePromotionVisibility(for product: SKProduct, completionHandler: ((SKProductStorePromotionVisibility, Error?) -> Void)? = nil) @available(macOS 11.0, *) + func fetchStorePromotionVisibility(for product: SKProduct) async throws -> SKProductStorePromotionVisibility + @available(macOS 11.0, *) func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct, completionHandler: ((Error?) -> Void)? = nil) @available(macOS 11.0, *) + func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct) async throws + @available(macOS 11.0, *) func fetchStorePromotionOrder(completionHandler: (([SKProduct], Error?) -> Void)? = nil) @available(macOS 11.0, *) + func fetchStorePromotionOrder() async throws -> [SKProduct] + @available(macOS 11.0, *) func update(storePromotionOrder: [SKProduct], completionHandler: ((Error?) -> Void)? = nil) + @available(macOS 11.0, *) + func update(storePromotionOrder: [SKProduct]) async throws } diff --git a/macOS/StoreKit/SKStoreProductViewController.swift b/macOS/StoreKit/SKStoreProductViewController.swift index 1fa5181..ef669d0 100644 --- a/macOS/StoreKit/SKStoreProductViewController.swift +++ b/macOS/StoreKit/SKStoreProductViewController.swift @@ -5,6 +5,8 @@ class SKStoreProductViewController : NSViewController { weak var delegate: @sil_weak SKStoreProductViewControllerDelegate? @available(macOS 11.0, *) func loadProduct(withParameters parameters: [String : Any], completionBlock block: ((Bool, Error?) -> Void)? = nil) + @available(macOS 11.0, *) + func loadProduct(withParameters parameters: [String : Any]) async throws -> Bool } protocol SKStoreProductViewControllerDelegate : NSObjectProtocol { @available(macOS 11.0, *) diff --git a/macOS/SwiftUI/SwiftUI.swift b/macOS/SwiftUI/SwiftUI.swift index edbfe76..09d39bb 100644 --- a/macOS/SwiftUI/SwiftUI.swift +++ b/macOS/SwiftUI/SwiftUI.swift @@ -896,7 +896,7 @@ extension Commands { @available(iOS 14.0, macOS 11.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@_functionBuilder struct CommandsBuilder { +@resultBuilder struct CommandsBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyCommands @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : Commands } @@ -4077,7 +4077,7 @@ extension Scene { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct SceneBuilder { +@resultBuilder struct SceneBuilder { static func buildBlock(_ content: Content) -> Content where Content : Scene } @@ -4848,7 +4848,7 @@ extension ToolbarContent { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct ToolbarContentBuilder { +@resultBuilder struct ToolbarContentBuilder { static func buildBlock(_ content: Content) -> some ToolbarContent where Content : ToolbarContent static func buildBlock(_ content: Content) -> some CustomizableToolbarContent where Content : CustomizableToolbarContent @@ -6555,7 +6555,7 @@ extension View { } @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) -@_functionBuilder struct ViewBuilder { +@resultBuilder struct ViewBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyView @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : View } @@ -6699,7 +6699,7 @@ protocol WidgetBundle { @available(iOS 14.0, macOS 11.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@_functionBuilder struct WidgetBundleBuilder { +@resultBuilder struct WidgetBundleBuilder { static func buildBlock() -> some Widget static func buildBlock(_ content: Content) -> some Widget where Content : Widget diff --git a/macOS/UserNotifications/UNUserNotificationCenter.swift b/macOS/UserNotifications/UNUserNotificationCenter.swift index 4e6f3e8..4ad85d9 100644 --- a/macOS/UserNotifications/UNUserNotificationCenter.swift +++ b/macOS/UserNotifications/UNUserNotificationCenter.swift @@ -20,14 +20,20 @@ class UNUserNotificationCenter : NSObject { var supportsContentExtensions: Bool { get } class func current() -> UNUserNotificationCenter func requestAuthorization(options: UNAuthorizationOptions = [], completionHandler: @escaping (Bool, Error?) -> Void) + func requestAuthorization(options: UNAuthorizationOptions = []) async throws -> Bool func setNotificationCategories(_ categories: Set) func getNotificationCategories(completionHandler: @escaping (Set) -> Void) + func notificationCategories() async -> Set func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void) + func notificationSettings() async -> UNNotificationSettings func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func add(_ request: UNNotificationRequest) async throws func getPendingNotificationRequests(completionHandler: @escaping ([UNNotificationRequest]) -> Void) + func pendingNotificationRequests() async -> [UNNotificationRequest] func removePendingNotificationRequests(withIdentifiers identifiers: [String]) func removeAllPendingNotificationRequests() func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) -> Void) + func deliveredNotifications() async -> [UNNotification] func removeDeliveredNotifications(withIdentifiers identifiers: [String]) func removeAllDeliveredNotifications() } @@ -49,7 +55,11 @@ protocol UNUserNotificationCenterDelegate : NSObjectProtocol { @available(macOS 10.14, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) @available(macOS 10.14, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions + @available(macOS 10.14, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) @available(macOS 10.14, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async + @available(macOS 10.14, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification?) } diff --git a/macOS/Virtualization/VZVirtioConsoleDeviceConfiguration.swift b/macOS/Virtualization/VZVirtioConsoleDeviceConfiguration.swift new file mode 100644 index 0000000..008c40a --- /dev/null +++ b/macOS/Virtualization/VZVirtioConsoleDeviceConfiguration.swift @@ -0,0 +1,4 @@ + +@available(macOS 11.0, *) +class VZVirtioConsoleDeviceConfiguration : VZSerialPortConfiguration { +} diff --git a/macOS/Virtualization/VZVirtioSocketDevice.swift b/macOS/Virtualization/VZVirtioSocketDevice.swift index bc3051b..a79ae29 100644 --- a/macOS/Virtualization/VZVirtioSocketDevice.swift +++ b/macOS/Virtualization/VZVirtioSocketDevice.swift @@ -4,6 +4,7 @@ class VZVirtioSocketDevice : VZSocketDevice { func setSocketListener(_ listener: VZVirtioSocketListener, forPort port: UInt32) func removeSocketListener(forPort port: UInt32) func __connect(toPort port: UInt32, completionHandler: @escaping (VZVirtioSocketConnection?, Error?) -> Void) + func __connect(toPort port: UInt32) async throws -> VZVirtioSocketConnection } extension VZVirtioSocketDevice { diff --git a/macOS/Virtualization/VZVirtualMachine.swift b/macOS/Virtualization/VZVirtualMachine.swift index bd1c6c4..5bbddb0 100644 --- a/macOS/Virtualization/VZVirtualMachine.swift +++ b/macOS/Virtualization/VZVirtualMachine.swift @@ -27,8 +27,11 @@ class VZVirtualMachine : NSObject { var memoryBalloonDevices: [VZMemoryBalloonDevice] { get } var socketDevices: [VZSocketDevice] { get } func __start(completionHandler: @escaping (Error?) -> Void) + func __start() async throws func __pause(completionHandler: @escaping (Error?) -> Void) + func __pause() async throws func __resume(completionHandler: @escaping (Error?) -> Void) + func __resume() async throws func requestStop() throws } diff --git a/macOS/WebKit/NSAttributedString.swift b/macOS/WebKit/NSAttributedString.swift index 9fabb66..bf0575b 100644 --- a/macOS/WebKit/NSAttributedString.swift +++ b/macOS/WebKit/NSAttributedString.swift @@ -11,9 +11,17 @@ extension NSAttributedString { @available(macOS 10.15, *) class func loadFromHTML(request: URLRequest, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(macOS 10.15, *) + class func loadFromHTML(request: URLRequest, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(macOS 10.15, *) class func loadFromHTML(fileURL: URL, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(macOS 10.15, *) + class func loadFromHTML(fileURL: URL, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(macOS 10.15, *) class func loadFromHTML(string: String, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) @available(macOS 10.15, *) + class func loadFromHTML(string: String, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) + @available(macOS 10.15, *) class func loadFromHTML(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], completionHandler: @escaping NSAttributedString.CompletionHandler) + @available(macOS 10.15, *) + class func loadFromHTML(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:]) async throws -> (NSAttributedString, [NSAttributedString.DocumentAttributeKey : Any]) } diff --git a/macOS/WebKit/WKContentRuleListStore.swift b/macOS/WebKit/WKContentRuleListStore.swift index 2886b3b..a686971 100644 --- a/macOS/WebKit/WKContentRuleListStore.swift +++ b/macOS/WebKit/WKContentRuleListStore.swift @@ -4,7 +4,11 @@ class WKContentRuleListStore : NSObject { class func `default`() -> Self! convenience init!(url: URL!) func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!, completionHandler: ((WKContentRuleList?, Error?) -> Void)!) + func compileContentRuleList(forIdentifier identifier: String!, encodedContentRuleList: String!) async throws -> WKContentRuleList? func lookUpContentRuleList(forIdentifier identifier: String!, completionHandler: ((WKContentRuleList?, Error?) -> Void)!) + func lookUpContentRuleList(forIdentifier identifier: String!) async throws -> WKContentRuleList? func removeContentRuleList(forIdentifier identifier: String!, completionHandler: ((Error?) -> Void)!) + func removeContentRuleList(forIdentifier identifier: String!) async throws func getAvailableContentRuleListIdentifiers(_ completionHandler: (([String]?) -> Void)!) + func availableContentRuleListIdentifiers() async -> [String]? } diff --git a/macOS/WebKit/WKHTTPCookieStore.swift b/macOS/WebKit/WKHTTPCookieStore.swift index 8118443..967f22b 100644 --- a/macOS/WebKit/WKHTTPCookieStore.swift +++ b/macOS/WebKit/WKHTTPCookieStore.swift @@ -6,8 +6,11 @@ protocol WKHTTPCookieStoreObserver : NSObjectProtocol { @available(macOS 10.13, *) class WKHTTPCookieStore : NSObject { func getAllCookies(_ completionHandler: @escaping ([HTTPCookie]) -> Void) + func allCookies() async -> [HTTPCookie] func setCookie(_ cookie: HTTPCookie, completionHandler: (() -> Void)? = nil) + func setCookie(_ cookie: HTTPCookie) async func delete(_ cookie: HTTPCookie, completionHandler: (() -> Void)? = nil) + func delete(_ cookie: HTTPCookie) async func add(_ observer: WKHTTPCookieStoreObserver) func remove(_ observer: WKHTTPCookieStoreObserver) } diff --git a/macOS/WebKit/WKNavigationDelegate.swift b/macOS/WebKit/WKNavigationDelegate.swift index 3d45fbe..df4ae5f 100644 --- a/macOS/WebKit/WKNavigationDelegate.swift +++ b/macOS/WebKit/WKNavigationDelegate.swift @@ -34,6 +34,8 @@ protocol WKNavigationDelegate : NSObjectProtocol { optional func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) @available(macOS 10.10, *) optional func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + @available(macOS 10.10, *) + optional func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(macOS 10.11, *) optional func webViewWebContentProcessDidTerminate(_ webView: WKWebView) @available(macOS 11.0, *) diff --git a/macOS/WebKit/WKUIDelegate.swift b/macOS/WebKit/WKUIDelegate.swift index bc919cc..1783f12 100644 --- a/macOS/WebKit/WKUIDelegate.swift +++ b/macOS/WebKit/WKUIDelegate.swift @@ -7,9 +7,17 @@ protocol WKUIDelegate : NSObjectProtocol { @available(macOS 10.10, *) optional func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) @available(macOS 10.10, *) + optional func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async + @available(macOS 10.10, *) optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) @available(macOS 10.10, *) + optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async -> Bool + @available(macOS 10.10, *) optional func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) + @available(macOS 10.10, *) + optional func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo) async -> String? @available(macOS 10.12, *) optional func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping ([URL]?) -> Void) + @available(macOS 10.12, *) + optional func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo) async -> [URL]? } diff --git a/macOS/WebKit/WKWebView.swift b/macOS/WebKit/WKWebView.swift index 935fad0..a2e4039 100644 --- a/macOS/WebKit/WKWebView.swift +++ b/macOS/WebKit/WKWebView.swift @@ -28,16 +28,27 @@ class WKWebView : NSView { func reloadFromOrigin() -> WKNavigation? func stopLoading() func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil) + func evaluateJavaScript(_ javaScriptString: String) async throws -> Any @available(macOS 11.0, *) func __evaluateJavaScript(_ javaScriptString: String, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld, completionHandler: ((Any?, Error?) -> Void)? = nil) @available(macOS 11.0, *) + func __evaluateJavaScript(_ javaScriptString: String, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld) async throws -> Any + @available(macOS 11.0, *) func __callAsyncJavaScript(_ functionBody: String, arguments: [String : Any]?, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld, completionHandler: ((Any?, Error?) -> Void)? = nil) + @available(macOS 11.0, *) + func __callAsyncJavaScript(_ functionBody: String, arguments: [String : Any]?, inFrame frame: WKFrameInfo?, in contentWorld: WKContentWorld) async throws -> Any @available(macOS 10.13, *) func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (NSImage?, Error?) -> Void) + @available(macOS 10.13, *) + func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?) async throws -> NSImage @available(macOS 11.0, *) func __createPDF(with pdfConfiguration: WKPDFConfiguration?, completionHandler: @escaping (Data?, Error?) -> Void) @available(macOS 11.0, *) + func __createPDF(with pdfConfiguration: WKPDFConfiguration?) async throws -> Data + @available(macOS 11.0, *) func __createWebArchiveData(completionHandler: @escaping (Data, Error) -> Void) + @available(macOS 11.0, *) + func __createWebArchiveData() async -> (Data, Error) var allowsBackForwardNavigationGestures: Bool @available(macOS 10.11, *) var customUserAgent: String? @@ -50,6 +61,8 @@ class WKWebView : NSView { var pageZoom: CGFloat @available(macOS 11.0, *) func __find(_ string: String, with configuration: WKFindConfiguration?, completionHandler: @escaping (WKFindResult) -> Void) + @available(macOS 11.0, *) + func __find(_ string: String, with configuration: WKFindConfiguration?) async -> WKFindResult @available(macOS 10.13, *) class func handlesURLScheme(_ urlScheme: String) -> Bool @available(macOS 11.0, *) diff --git a/macOS/WebKit/WKWebsiteDataStore.swift b/macOS/WebKit/WKWebsiteDataStore.swift index 9e92d35..eb2ff6b 100644 --- a/macOS/WebKit/WKWebsiteDataStore.swift +++ b/macOS/WebKit/WKWebsiteDataStore.swift @@ -6,8 +6,11 @@ class WKWebsiteDataStore : NSObject, NSSecureCoding { var isPersistent: Bool { get } class func allWebsiteDataTypes() -> Set func fetchDataRecords(ofTypes dataTypes: Set, completionHandler: @escaping ([WKWebsiteDataRecord]) -> Void) + func fetchDataRecords(ofTypes dataTypes: Set) async -> [WKWebsiteDataRecord] func removeData(ofTypes dataTypes: Set, for dataRecords: [WKWebsiteDataRecord], completionHandler: @escaping () -> Void) + func removeData(ofTypes dataTypes: Set, for dataRecords: [WKWebsiteDataRecord]) async func removeData(ofTypes dataTypes: Set, modifiedSince date: Date, completionHandler: @escaping () -> Void) + func removeData(ofTypes dataTypes: Set, modifiedSince date: Date) async @available(macOS 10.13, *) var httpCookieStore: WKHTTPCookieStore { get } } diff --git a/tvOS/AVFoundation/AVAssetExportSession.swift b/tvOS/AVFoundation/AVAssetExportSession.swift index 6a5cdac..0194957 100644 --- a/tvOS/AVFoundation/AVAssetExportSession.swift +++ b/tvOS/AVFoundation/AVAssetExportSession.swift @@ -55,6 +55,7 @@ class AVAssetExportSession : NSObject { var status: AVAssetExportSession.Status { get } var error: Error? { get } func exportAsynchronously(completionHandler handler: @escaping () -> Void) + func export() async var progress: Float { get } func cancelExport() } @@ -63,11 +64,15 @@ extension AVAssetExportSession { class func exportPresets(compatibleWith asset: AVAsset) -> [String] @available(tvOS 9.0, *) class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?, completionHandler handler: @escaping (Bool) -> Void) + @available(tvOS 9.0, *) + class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?) async -> Bool } extension AVAssetExportSession { var supportedFileTypes: [AVFileType] { get } @available(tvOS 9.0, *) func determineCompatibleFileTypes(completionHandler handler: @escaping ([AVFileType]) -> Void) + @available(tvOS 9.0, *) + func determineCompatibleFileTypes() async -> [AVFileType] } extension AVAssetExportSession { var timeRange: CMTimeRange @@ -80,7 +85,11 @@ extension AVAssetExportSession { @available(tvOS 13.0, *) func estimateMaximumDuration(completionHandler handler: @escaping (CMTime, Error?) -> Void) @available(tvOS 13.0, *) + func estimateMaximumDuration() async throws -> CMTime + @available(tvOS 13.0, *) func estimateOutputFileLength(completionHandler handler: @escaping (Int64, Error?) -> Void) + @available(tvOS 13.0, *) + func estimateOutputFileLength() async throws -> Int64 } extension AVAssetExportSession { var metadata: [AVMetadataItem]? diff --git a/tvOS/AVFoundation/AVAssetImageGenerator.swift b/tvOS/AVFoundation/AVAssetImageGenerator.swift index 96fe2f0..d72ca8a 100644 --- a/tvOS/AVFoundation/AVAssetImageGenerator.swift +++ b/tvOS/AVFoundation/AVAssetImageGenerator.swift @@ -38,6 +38,7 @@ class AVAssetImageGenerator : NSObject { init(asset: AVAsset) func copyCGImage(at requestedTime: CMTime, actualTime: UnsafeMutablePointer?) throws -> CGImage func generateCGImagesAsynchronously(forTimes requestedTimes: [NSValue], completionHandler handler: @escaping AVAssetImageGeneratorCompletionHandler) + func generateCGImages(forTimes requestedTimes: [NSValue]) async throws -> (CMTime, CGImage, CMTime, AVAssetImageGenerator.Result) func cancelAllCGImageGeneration() } typealias AVAssetImageGeneratorCompletionHandler = (CMTime, CGImage?, CMTime, AVAssetImageGenerator.Result, Error?) -> Void diff --git a/tvOS/AVFoundation/AVAssetWriter.swift b/tvOS/AVFoundation/AVAssetWriter.swift index 072db39..be7d6e3 100644 --- a/tvOS/AVFoundation/AVAssetWriter.swift +++ b/tvOS/AVFoundation/AVAssetWriter.swift @@ -37,6 +37,8 @@ class AVAssetWriter : NSObject { func finishWriting() -> Bool @available(tvOS 9.0, *) func finishWriting(completionHandler handler: @escaping () -> Void) + @available(tvOS 9.0, *) + func finishWriting() async } extension AVAssetWriter { var movieFragmentInterval: CMTime diff --git a/tvOS/AVFoundation/AVAsynchronousKeyValueLoading.swift b/tvOS/AVFoundation/AVAsynchronousKeyValueLoading.swift index a340868..22888c5 100644 --- a/tvOS/AVFoundation/AVAsynchronousKeyValueLoading.swift +++ b/tvOS/AVFoundation/AVAsynchronousKeyValueLoading.swift @@ -11,4 +11,5 @@ enum AVKeyValueStatus : Int { protocol AVAsynchronousKeyValueLoading { func statusOfValue(forKey key: String, error outError: NSErrorPointer) -> AVKeyValueStatus func loadValuesAsynchronously(forKeys keys: [String], completionHandler handler: (() -> Void)? = nil) + func loadValues(forKeys keys: [String]) async } diff --git a/tvOS/AVFoundation/AVCaptureDevice.swift b/tvOS/AVFoundation/AVCaptureDevice.swift index d7ccb3b..e28fbff 100644 --- a/tvOS/AVFoundation/AVCaptureDevice.swift +++ b/tvOS/AVFoundation/AVCaptureDevice.swift @@ -64,6 +64,8 @@ extension AVCaptureDevice { var lensPosition: Float { get } @available(tvOS 8.0, *) func setFocusModeLocked(lensPosition: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(tvOS 8.0, *) + func setFocusModeLocked(lensPosition: Float) async -> CMTime } extension AVCaptureDevice { func isExposureModeSupported(_ exposureMode: AVCaptureDevice.ExposureMode) -> Bool @@ -80,6 +82,8 @@ extension AVCaptureDevice { @available(tvOS 8.0, *) func setExposureModeCustom(duration: CMTime, iso ISO: Float, completionHandler handler: ((CMTime) -> Void)? = nil) @available(tvOS 8.0, *) + func setExposureModeCustom(duration: CMTime, iso ISO: Float) async -> CMTime + @available(tvOS 8.0, *) var exposureTargetOffset: Float { get } @available(tvOS 8.0, *) var exposureTargetBias: Float { get } @@ -89,6 +93,8 @@ extension AVCaptureDevice { var maxExposureTargetBias: Float { get } @available(tvOS 8.0, *) func setExposureTargetBias(_ bias: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(tvOS 8.0, *) + func setExposureTargetBias(_ bias: Float) async -> CMTime } extension AVCaptureDevice { } @@ -107,6 +113,8 @@ extension AVCaptureDevice { @available(tvOS 8.0, *) func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains, completionHandler handler: ((CMTime) -> Void)? = nil) @available(tvOS 8.0, *) + func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) async -> CMTime + @available(tvOS 8.0, *) func chromaticityValues(for whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) -> AVCaptureDevice.WhiteBalanceChromaticityValues @available(tvOS 8.0, *) func deviceWhiteBalanceGains(for chromaticityValues: AVCaptureDevice.WhiteBalanceChromaticityValues) -> AVCaptureDevice.WhiteBalanceGains @@ -144,6 +152,8 @@ extension AVCaptureDevice { class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus @available(tvOS 7.0, *) class func requestAccess(for mediaType: AVMediaType, completionHandler handler: @escaping (Bool) -> Void) + @available(tvOS 7.0, *) + class func requestAccess(for mediaType: AVMediaType) async -> Bool } extension AVCaptureDevice { } diff --git a/tvOS/AVFoundation/AVCaptureStillImageOutput.swift b/tvOS/AVFoundation/AVCaptureStillImageOutput.swift index a83c61d..b377d49 100644 --- a/tvOS/AVFoundation/AVCaptureStillImageOutput.swift +++ b/tvOS/AVFoundation/AVCaptureStillImageOutput.swift @@ -8,6 +8,10 @@ extension AVCaptureStillImageOutput { var isLensStabilizationDuringBracketedCaptureEnabled: Bool @available(tvOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (Bool, Error?) -> Void) + @available(tvOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") + func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> Bool @available(tvOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") func captureStillImageBracketAsynchronously(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (CMSampleBuffer?, AVCaptureBracketedStillImageSettings?, Error?) -> Void) + @available(tvOS, introduced: 8.0, deprecated: 10.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") + func captureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> (CMSampleBuffer, AVCaptureBracketedStillImageSettings) } diff --git a/tvOS/AVFoundation/AVContentKeySession.swift b/tvOS/AVFoundation/AVContentKeySession.swift index 0d05b42..ee1a073 100644 --- a/tvOS/AVFoundation/AVContentKeySession.swift +++ b/tvOS/AVFoundation/AVContentKeySession.swift @@ -94,6 +94,7 @@ class AVContentKeyRequest : NSObject { var options: [String : Any] { get } var canProvidePersistableContentKey: Bool { get } func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil) async throws -> Data func processContentKeyResponse(_ keyResponse: AVContentKeyResponse) func processContentKeyResponseError(_ error: Error) } diff --git a/tvOS/AVFoundation/AVPlayer.swift b/tvOS/AVFoundation/AVPlayer.swift index 99a62ed..f5504d1 100644 --- a/tvOS/AVFoundation/AVPlayer.swift +++ b/tvOS/AVFoundation/AVPlayer.swift @@ -74,12 +74,18 @@ extension AVPlayer { func seek(to date: Date) @available(tvOS 9.0, *) func seek(to date: Date, completionHandler: @escaping (Bool) -> Void) + @available(tvOS 9.0, *) + func seek(to date: Date) async -> Bool func seek(to time: CMTime) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) @available(tvOS 9.0, *) func seek(to time: CMTime, completionHandler: @escaping (Bool) -> Void) @available(tvOS 9.0, *) + func seek(to time: CMTime) async -> Bool + @available(tvOS 9.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: @escaping (Bool) -> Void) + @available(tvOS 9.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool } extension AVPlayer { @available(tvOS 10.0, *) @@ -89,6 +95,8 @@ extension AVPlayer { @available(tvOS 9.0, *) func preroll(atRate rate: Float, completionHandler: ((Bool) -> Void)? = nil) @available(tvOS 9.0, *) + func preroll(atRate rate: Float) async -> Bool + @available(tvOS 9.0, *) func cancelPendingPrerolls() @available(tvOS 9.0, *) var masterClock: CMClock? diff --git a/tvOS/AVFoundation/AVPlayerItem.swift b/tvOS/AVFoundation/AVPlayerItem.swift index 939c171..167c361 100644 --- a/tvOS/AVFoundation/AVPlayerItem.swift +++ b/tvOS/AVFoundation/AVPlayerItem.swift @@ -85,8 +85,12 @@ extension AVPlayerItem { @available(tvOS 9.0, *) func seek(to time: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(tvOS 9.0, *) + func seek(to time: CMTime) async -> Bool + @available(tvOS 9.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(tvOS 9.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool + @available(tvOS 9.0, *) func cancelPendingSeeks() func currentDate() -> Date? @available(tvOS 9.0, *) diff --git a/tvOS/AVFoundation/AVSampleBufferAudioRenderer.swift b/tvOS/AVFoundation/AVSampleBufferAudioRenderer.swift index 5046523..23d35d6 100644 --- a/tvOS/AVFoundation/AVSampleBufferAudioRenderer.swift +++ b/tvOS/AVFoundation/AVSampleBufferAudioRenderer.swift @@ -11,6 +11,7 @@ extension AVSampleBufferAudioRenderer { } extension AVSampleBufferAudioRenderer { func flush(fromSourceTime time: CMTime, completionHandler: @escaping (Bool) -> Void) + func flush(fromSourceTime time: CMTime) async -> Bool } extension NSNotification.Name { @available(tvOS 11.0, *) diff --git a/tvOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift b/tvOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift index b0b32f2..e3aaaa7 100644 --- a/tvOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift +++ b/tvOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift @@ -15,6 +15,7 @@ extension AVSampleBufferRenderSynchronizer { var renderers: [AVQueuedSampleBufferRendering] { get } func addRenderer(_ renderer: AVQueuedSampleBufferRendering) func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime, completionHandler: ((Bool) -> Void)? = nil) + func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime) async -> Bool } extension AVSampleBufferRenderSynchronizer { func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any diff --git a/tvOS/AVKit/AVContentProposalViewController.swift b/tvOS/AVKit/AVContentProposalViewController.swift index 31d236b..77aa7fe 100644 --- a/tvOS/AVKit/AVContentProposalViewController.swift +++ b/tvOS/AVKit/AVContentProposalViewController.swift @@ -14,6 +14,7 @@ class AVContentProposalViewController : UIViewController { var playerLayoutGuide: UILayoutGuide { get } var dateOfAutomaticAcceptance: Date? func dismissContentProposal(for action: AVContentProposalAction, animated: Bool, completion block: (() -> Void)? = nil) + func dismissContentProposal(for action: AVContentProposalAction, animated: Bool) async } extension AVPlayerViewController { @available(tvOS 10.0, *) diff --git a/tvOS/AVKit/AVPictureInPictureController.swift b/tvOS/AVKit/AVPictureInPictureController.swift index 29a7350..2e2f15c 100644 --- a/tvOS/AVKit/AVPictureInPictureController.swift +++ b/tvOS/AVKit/AVPictureInPictureController.swift @@ -29,4 +29,5 @@ protocol AVPictureInPictureControllerDelegate : NSObjectProtocol { optional func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController) async -> Bool } diff --git a/tvOS/AVKit/AVPlayerItem.swift b/tvOS/AVKit/AVPlayerItem.swift index 593d02a..f2ff594 100644 --- a/tvOS/AVKit/AVPlayerItem.swift +++ b/tvOS/AVKit/AVPlayerItem.swift @@ -24,6 +24,8 @@ extension AVPlayerItem { @available(tvOS 13.0, *) func requestPlaybackRestrictionsAuthorization(_ completion: @escaping (Bool, Error?) -> Void) @available(tvOS 13.0, *) + func requestPlaybackRestrictionsAuthorization() async throws -> Bool + @available(tvOS 13.0, *) func cancelPlaybackRestrictionsAuthorizationRequest() } extension AVPlayerItem { diff --git a/tvOS/AVKit/AVPlayerViewController.swift b/tvOS/AVKit/AVPlayerViewController.swift index 978f47e..c4f12b0 100644 --- a/tvOS/AVKit/AVPlayerViewController.swift +++ b/tvOS/AVKit/AVPlayerViewController.swift @@ -69,8 +69,12 @@ protocol AVPlayerViewControllerDelegate : NSObjectProtocol { @available(tvOS 13.0, *) optional func playerViewController(_ playerViewController: AVPlayerViewController, skipToNextChannel completion: @escaping (Bool) -> Void) @available(tvOS 13.0, *) + optional func playerViewController(_ playerViewController: AVPlayerViewController) async -> Bool + @available(tvOS 13.0, *) optional func playerViewController(_ playerViewController: AVPlayerViewController, skipToPreviousChannel completion: @escaping (Bool) -> Void) @available(tvOS 13.0, *) + optional func playerViewController(_ playerViewController: AVPlayerViewController) async -> Bool + @available(tvOS 13.0, *) optional func nextChannelInterstitialViewController(for playerViewController: AVPlayerViewController) -> UIViewController @available(tvOS 13.0, *) optional func previousChannelInterstitialViewController(for playerViewController: AVPlayerViewController) -> UIViewController @@ -96,8 +100,12 @@ protocol AVPlayerViewControllerDelegate : NSObjectProtocol { optional func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_ playerViewController: AVPlayerViewController) -> Bool @available(tvOS 9.0, *) optional func playerViewController(_ playerViewController: AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) + @available(tvOS 9.0, *) + optional func playerViewControllerRestoreUserInterfaceForPictureInPictureStop(_ playerViewController: AVPlayerViewController) async -> Bool } protocol AVPlayerViewControllerAnimationCoordinator : NSObjectProtocol { @available(tvOS 11.0, *) func addCoordinatedAnimations(_ animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + @available(tvOS 11.0, *) + func addCoordinatedAnimations(_ animations: (() -> Void)?) async -> Bool } diff --git a/tvOS/AppTrackingTransparency/AppTrackingTransparency.swift b/tvOS/AppTrackingTransparency/AppTrackingTransparency.swift index bc371ce..48905eb 100644 --- a/tvOS/AppTrackingTransparency/AppTrackingTransparency.swift +++ b/tvOS/AppTrackingTransparency/AppTrackingTransparency.swift @@ -14,5 +14,6 @@ extension ATTrackingManager { class ATTrackingManager : NSObject { class var trackingAuthorizationStatus: ATTrackingManager.AuthorizationStatus { get } class func requestTrackingAuthorization(completionHandler completion: @escaping (ATTrackingManager.AuthorizationStatus) -> Void) + class func requestTrackingAuthorization() async -> ATTrackingManager.AuthorizationStatus } var AppTrackingTransparencyVersionNumber: Double diff --git a/tvOS/AudioToolbox/AUAudioUnit.swift b/tvOS/AudioToolbox/AUAudioUnit.swift index c2a2457..9c4cb87 100644 --- a/tvOS/AudioToolbox/AUAudioUnit.swift +++ b/tvOS/AudioToolbox/AUAudioUnit.swift @@ -32,6 +32,7 @@ class AUAudioUnit : NSObject { init(componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) throws convenience init(componentDescription: AudioComponentDescription) throws class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = [], completionHandler: @escaping (AUAudioUnit?, Error?) -> Void) + class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) async throws -> AUAudioUnit var componentDescription: AudioComponentDescription { get } var component: AudioComponent { get } var componentName: String? { get } diff --git a/tvOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift b/tvOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift index a408cb7..be3279c 100644 --- a/tvOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift +++ b/tvOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift @@ -16,4 +16,5 @@ extension ASAuthorizationAppleIDProvider { class ASAuthorizationAppleIDProvider : NSObject, ASAuthorizationProvider { func createRequest() -> ASAuthorizationAppleIDRequest func getCredentialState(forUserID userID: String, completion: @escaping (ASAuthorizationAppleIDProvider.CredentialState, Error?) -> Void) + func credentialState(forUserID userID: String) async throws -> ASAuthorizationAppleIDProvider.CredentialState } diff --git a/tvOS/BackgroundTasks/BGTaskScheduler.swift b/tvOS/BackgroundTasks/BGTaskScheduler.swift index bae7ae1..6396dd5 100644 --- a/tvOS/BackgroundTasks/BGTaskScheduler.swift +++ b/tvOS/BackgroundTasks/BGTaskScheduler.swift @@ -20,4 +20,5 @@ class BGTaskScheduler : NSObject { func cancel(taskRequestWithIdentifier identifier: String) func cancelAllTaskRequests() func getPendingTaskRequests(completionHandler: @escaping ([BGTaskRequest]) -> Void) + func pendingTaskRequests() async -> [BGTaskRequest] } diff --git a/tvOS/CloudKit/CKContainer.swift b/tvOS/CloudKit/CKContainer.swift index 12852a7..38198ee 100644 --- a/tvOS/CloudKit/CKContainer.swift +++ b/tvOS/CloudKit/CKContainer.swift @@ -51,6 +51,7 @@ extension NSNotification.Name { } extension CKContainer { func accountStatus(completionHandler: @escaping (CKAccountStatus, Error?) -> Void) + func accountStatus() async throws -> CKAccountStatus } @available(tvOS 8.0, *) struct CKContainer_Application_Permissions : OptionSet { @@ -70,32 +71,55 @@ enum CKContainer_Application_PermissionStatus : Int { typealias CKContainer_Application_PermissionBlock = (CKContainer_Application_PermissionStatus, Error?) -> Void extension CKContainer { func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus } extension CKContainer { func fetchUserRecordID(completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func fetchUserRecordID() async throws -> CKRecord.ID @available(tvOS 10.0, *) func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(tvOS 10.0, *) + func discoverUserIdentity(withEmailAddress email: String) async throws -> CKUserIdentity + @available(tvOS 10.0, *) func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(tvOS 10.0, *) + func discoverUserIdentity(withPhoneNumber phoneNumber: String) async throws -> CKUserIdentity + @available(tvOS 10.0, *) func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) + @available(tvOS 10.0, *) + func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity } extension CKContainer { @available(tvOS 10.0, *) func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(tvOS 10.0, *) + func fetchShareParticipant(withEmailAddress emailAddress: String) async throws -> CKShare.Participant + @available(tvOS 10.0, *) func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(tvOS 10.0, *) + func fetchShareParticipant(withPhoneNumber phoneNumber: String) async throws -> CKShare.Participant + @available(tvOS 10.0, *) func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(tvOS 10.0, *) + func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant + @available(tvOS 10.0, *) func fetchShareMetadata(with url: URL, completionHandler: @escaping (CKShare.Metadata?, Error?) -> Void) @available(tvOS 10.0, *) + func fetchShareMetadata(with url: URL) async throws -> CKShare.Metadata + @available(tvOS 10.0, *) func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping (CKShare?, Error?) -> Void) + @available(tvOS 10.0, *) + func accept(_ metadata: CKShare.Metadata) async throws -> CKShare } extension CKContainer { @available(tvOS 9.2, *) func __fetchAllLongLivedOperationIDs(completionHandler: @escaping ([String]?, Error?) -> Void) @available(tvOS 9.2, *) + func __fetchAllLongLivedOperationIDs() async throws -> [String] + @available(tvOS 9.2, *) func __fetchLongLivedOperation(withID operationID: String, completionHandler: @escaping (CKOperation?, Error?) -> Void) + @available(tvOS 9.2, *) + func __fetchLongLivedOperation(withID operationID: String) async throws -> CKOperation } diff --git a/tvOS/CloudKit/CKDatabase.swift b/tvOS/CloudKit/CKDatabase.swift index 96873a5..ceef649 100644 --- a/tvOS/CloudKit/CKDatabase.swift +++ b/tvOS/CloudKit/CKDatabase.swift @@ -25,19 +25,35 @@ class CKDatabase : NSObject { } extension CKDatabase { func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func fetch(withRecordID recordID: CKRecord.ID) async throws -> CKRecord func save(_ record: CKRecord, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func save(_ record: CKRecord) async throws -> CKRecord func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func delete(withRecordID recordID: CKRecord.ID) async throws -> CKRecord.ID func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?, completionHandler: @escaping ([CKRecord]?, Error?) -> Void) + func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?) async throws -> [CKRecord] func fetchAllRecordZones(completionHandler: @escaping ([CKRecordZone]?, Error?) -> Void) + func fetchAllRecordZones() async throws -> [CKRecordZone] func fetch(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func fetch(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone func save(_ zone: CKRecordZone, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func save(_ zone: CKRecordZone) async throws -> CKRecordZone func delete(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone.ID?, Error?) -> Void) + func delete(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone.ID @available(tvOS 9.0, *) func __fetch(withSubscriptionID subscriptionID: String, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(tvOS 9.0, *) + func __fetch(withSubscriptionID subscriptionID: String) async throws -> CKSubscription + @available(tvOS 9.0, *) func fetchAllSubscriptions(completionHandler: @escaping ([CKSubscription]?, Error?) -> Void) @available(tvOS 9.0, *) + func fetchAllSubscriptions() async throws -> [CKSubscription] + @available(tvOS 9.0, *) func save(_ subscription: CKSubscription, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(tvOS 9.0, *) + func save(_ subscription: CKSubscription) async throws -> CKSubscription + @available(tvOS 9.0, *) func __delete(withSubscriptionID subscriptionID: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(tvOS 9.0, *) + func __delete(withSubscriptionID subscriptionID: String) async throws -> String } diff --git a/tvOS/CoreData/NSPersistentContainer.swift b/tvOS/CoreData/NSPersistentContainer.swift index 1343e4e..f5c45a4 100644 --- a/tvOS/CoreData/NSPersistentContainer.swift +++ b/tvOS/CoreData/NSPersistentContainer.swift @@ -10,6 +10,7 @@ class NSPersistentContainer : NSObject { convenience init(name: String) init(name: String, managedObjectModel model: NSManagedObjectModel) func loadPersistentStores(completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + func loadPersistentStores() async throws -> NSPersistentStoreDescription func newBackgroundContext() -> NSManagedObjectContext func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void) } diff --git a/tvOS/CoreData/NSPersistentStoreCoordinator.swift b/tvOS/CoreData/NSPersistentStoreCoordinator.swift index fa8dd96..2490ea3 100644 --- a/tvOS/CoreData/NSPersistentStoreCoordinator.swift +++ b/tvOS/CoreData/NSPersistentStoreCoordinator.swift @@ -79,6 +79,8 @@ class NSPersistentStoreCoordinator : NSObject { func addPersistentStore(ofType storeType: String, configurationName configuration: String?, at storeURL: URL?, options: [AnyHashable : Any]? = nil) throws -> NSPersistentStore @available(tvOS 10.0, *) func addPersistentStore(with storeDescription: NSPersistentStoreDescription, completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + @available(tvOS 10.0, *) + func addPersistentStore(with storeDescription: NSPersistentStoreDescription) async throws -> NSPersistentStoreDescription func remove(_ store: NSPersistentStore) throws func setMetadata(_ metadata: [String : Any]?, for store: NSPersistentStore) func metadata(for store: NSPersistentStore) -> [String : Any] diff --git a/tvOS/CoreFoundation/CFError.swift b/tvOS/CoreFoundation/CFError.swift index f80e436..2d2e3be 100644 --- a/tvOS/CoreFoundation/CFError.swift +++ b/tvOS/CoreFoundation/CFError.swift @@ -2,9 +2,6 @@ typealias CFErrorDomain = CFString class CFError : _CFObject { } - -extension CFError : Error { -} @available(tvOS 9.0, *) func CFErrorGetTypeID() -> CFTypeID @available(tvOS 9.0, *) diff --git a/tvOS/CoreGraphics/CGAffineTransform.swift b/tvOS/CoreGraphics/CGAffineTransform.swift index 5e9a917..585e09b 100644 --- a/tvOS/CoreGraphics/CGAffineTransform.swift +++ b/tvOS/CoreGraphics/CGAffineTransform.swift @@ -19,9 +19,6 @@ extension CGAffineTransform { extension CGAffineTransform : Codable { } - -extension CGAffineTransform : _ObjectiveCBridgeable { -} extension CGAffineTransform { @available(tvOS 2.0, *) /*not inherited*/ init(translationX tx: CGFloat, y ty: CGFloat) diff --git a/tvOS/CoreGraphics/CGGeometry.swift b/tvOS/CoreGraphics/CGGeometry.swift index 76c045f..e99e84c 100644 --- a/tvOS/CoreGraphics/CGGeometry.swift +++ b/tvOS/CoreGraphics/CGGeometry.swift @@ -27,9 +27,6 @@ extension CGPoint : Equatable { extension CGPoint : Codable { } - -extension CGPoint : _ObjectiveCBridgeable { -} struct CGSize { var width: CGFloat var height: CGFloat @@ -58,9 +55,6 @@ extension CGSize : Equatable { extension CGSize : Codable { } - -extension CGSize : _ObjectiveCBridgeable { -} struct CGVector { var dx: CGFloat var dy: CGFloat @@ -82,9 +76,6 @@ extension CGVector : CustomDebugStringConvertible { extension CGVector : Codable { } - -extension CGVector : _ObjectiveCBridgeable { -} struct CGRect { var origin: CGPoint var size: CGSize @@ -115,9 +106,6 @@ extension CGRect : Equatable { extension CGRect : Codable { } - -extension CGRect : _ObjectiveCBridgeable { -} @frozen enum CGRectEdge : UInt32 { init?(rawValue: UInt32) var rawValue: UInt32 { get } diff --git a/tvOS/CoreGraphics/CoreGraphics.swift b/tvOS/CoreGraphics/CoreGraphics.swift index f7de2ee..46e021d 100644 --- a/tvOS/CoreGraphics/CoreGraphics.swift +++ b/tvOS/CoreGraphics/CoreGraphics.swift @@ -39,13 +39,6 @@ extension CGFloat : _CVarArgPassedAsDouble, _CVarArgAligned { extension CGFloat : Codable { } -extension CGFloat : _ObjectiveCBridgeable { - @available(swift, deprecated: 4, renamed: "init(truncating:)") - init(_ number: __shared NSNumber) - init(truncating number: __shared NSNumber) - init?(exactly number: __shared NSNumber) -} - enum CGPathFillRule : Int { case winding case evenOdd diff --git a/tvOS/CoreHaptics/CHHapticEngine.swift b/tvOS/CoreHaptics/CHHapticEngine.swift index b553173..73ced75 100644 --- a/tvOS/CoreHaptics/CHHapticEngine.swift +++ b/tvOS/CoreHaptics/CHHapticEngine.swift @@ -35,8 +35,10 @@ class CHHapticEngine : NSObject { var isAutoShutdownEnabled: Bool init() throws func start(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func start() async throws func start() throws func stop(completionHandler: CHHapticEngine.CompletionHandler? = nil) + func stop() async throws func notifyWhenPlayersFinished(finishedHandler: @escaping CHHapticEngine.FinishedHandler) func makePlayer(with pattern: CHHapticPattern) throws -> CHHapticPatternPlayer func makeAdvancedPlayer(with pattern: CHHapticPattern) throws -> CHHapticAdvancedPatternPlayer diff --git a/tvOS/CoreLocation/CLGeocoder.swift b/tvOS/CoreLocation/CLGeocoder.swift index f45b52e..2e8e10b 100644 --- a/tvOS/CoreLocation/CLGeocoder.swift +++ b/tvOS/CoreLocation/CLGeocoder.swift @@ -4,14 +4,23 @@ typealias CLGeocodeCompletionHandler = ([CLPlacemark]?, Error?) -> Void class CLGeocoder : NSObject { var isGeocoding: Bool { get } func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CLGeocodeCompletionHandler) + func reverseGeocodeLocation(_ location: CLLocation) async throws -> [CLPlacemark] @available(tvOS 11.0, *) func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(tvOS 11.0, *) + func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?) async throws -> [CLPlacemark] @available(tvOS, introduced: 5.0, deprecated: 11.0, message: "Use -geocodePostalAddress:completionHandler:") func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: @escaping CLGeocodeCompletionHandler) + @available(tvOS, introduced: 5.0, deprecated: 11.0, message: "Use -geocodePostalAddress:completionHandler:") + func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any]) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, in region: CLRegion?, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String, in region: CLRegion?) async throws -> [CLPlacemark] @available(tvOS 11.0, *) func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(tvOS 11.0, *) + func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?) async throws -> [CLPlacemark] func cancelGeocode() } extension CLGeocoder { diff --git a/tvOS/CoreLocation/CLLocationManager.swift b/tvOS/CoreLocation/CLLocationManager.swift index f5a1fcd..fcf098d 100644 --- a/tvOS/CoreLocation/CLLocationManager.swift +++ b/tvOS/CoreLocation/CLLocationManager.swift @@ -56,6 +56,8 @@ class CLLocationManager : NSObject { @available(tvOS 14.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil) @available(tvOS 14.0, *) + func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) async throws + @available(tvOS 14.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) func stopUpdatingLocation() @available(tvOS 9.0, *) diff --git a/tvOS/CoreML/MLModel.swift b/tvOS/CoreML/MLModel.swift index 0909e8f..57d0bca 100644 --- a/tvOS/CoreML/MLModel.swift +++ b/tvOS/CoreML/MLModel.swift @@ -9,6 +9,8 @@ class MLModel : NSObject { convenience init(contentsOf url: URL, configuration: MLModelConfiguration) throws @available(tvOS 14.0, *) class func __loadContents(of url: URL, configuration: MLModelConfiguration, completionHandler handler: @escaping (MLModel?, Error?) -> Void) + @available(tvOS 14.0, *) + class func __loadContents(of url: URL, configuration: MLModelConfiguration) async throws -> MLModel func prediction(from input: MLFeatureProvider) throws -> MLFeatureProvider func prediction(from input: MLFeatureProvider, options: MLPredictionOptions) throws -> MLFeatureProvider @available(tvOS 12.0, *) diff --git a/tvOS/CoreSpotlight/CSSearchableIndex.swift b/tvOS/CoreSpotlight/CSSearchableIndex.swift index 9120f10..3e62db7 100644 --- a/tvOS/CoreSpotlight/CSSearchableIndex.swift +++ b/tvOS/CoreSpotlight/CSSearchableIndex.swift @@ -2,5 +2,7 @@ extension CSSearchableIndex { func beginBatch() func endBatch(withClientState clientState: Data, completionHandler: ((Error?) -> Void)? = nil) + func endBatch(withClientState clientState: Data) async throws func fetchLastClientState(completionHandler: @escaping (Data?, Error?) -> Void) + func fetchLastClientState() async throws -> Data } diff --git a/tvOS/CryptoTokenKit/TKSmartCard.swift b/tvOS/CryptoTokenKit/TKSmartCard.swift index 3aee1ce..b281719 100644 --- a/tvOS/CryptoTokenKit/TKSmartCard.swift +++ b/tvOS/CryptoTokenKit/TKSmartCard.swift @@ -3,6 +3,7 @@ class TKSmartCardSlotManager : NSObject { class var `default`: TKSmartCardSlotManager? { get } var slotNames: [String] { get } func getSlot(withName name: String, reply: @escaping (TKSmartCardSlot?) -> Void) + func getSlot(withName name: String) async -> TKSmartCardSlot? func slotNamed(_ name: String) -> TKSmartCardSlot? } extension TKSmartCardSlot { @@ -80,6 +81,7 @@ class TKSmartCardUserInteraction : NSObject { var initialTimeout: TimeInterval var interactionTimeout: TimeInterval func run(reply: @escaping (Bool, Error?) -> Void) + func run() async throws -> Bool func cancel() -> Bool } class TKSmartCardUserInteractionForPINOperation : TKSmartCardUserInteraction { @@ -110,7 +112,9 @@ class TKSmartCard : NSObject { var isSensitive: Bool var context: Any? func beginSession(reply: @escaping (Bool, Error?) -> Void) + func beginSession() async throws -> Bool func transmit(_ request: Data, reply: @escaping (Data?, Error?) -> Void) + func transmit(_ request: Data) async throws -> Data func endSession() @available(tvOS 9.0, *) func userInteractionForSecurePINVerification(_ PINFormat: TKSmartCardPINFormat, apdu APDU: Data, pinByteOffset PINByteOffset: Int) -> TKSmartCardUserInteractionForSecurePINVerification? @@ -131,6 +135,7 @@ extension TKSmartCard { var useExtendedLength: Bool var useCommandChaining: Bool func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?, reply: @escaping (Data?, UInt16, Error?) -> Void) + func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?) async throws -> (Data, UInt16) func __inSession(executeBlock block: @escaping (NSErrorPointer) -> Bool) throws func __sendIns(_ ins: UInt8, p1: UInt8, p2: UInt8, data requestData: Data?, le: NSNumber?, sw: UnsafeMutablePointer) throws -> Data } diff --git a/tvOS/DeveloperToolsSupport/DeveloperToolsSupport.swift b/tvOS/DeveloperToolsSupport/DeveloperToolsSupport.swift index e434a46..83f4ea3 100644 --- a/tvOS/DeveloperToolsSupport/DeveloperToolsSupport.swift +++ b/tvOS/DeveloperToolsSupport/DeveloperToolsSupport.swift @@ -1,6 +1,6 @@ @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct LibraryContentBuilder { +@resultBuilder struct LibraryContentBuilder { static func buildBlock(_ segments: [LibraryItem]...) -> [LibraryItem] static func buildExpression(_ item: LibraryItem) -> [LibraryItem] static func buildExpression(_ items: [LibraryItem]) -> [LibraryItem] diff --git a/tvOS/DeviceCheck/DCDevice.swift b/tvOS/DeviceCheck/DCDevice.swift index c051ad2..ac51879 100644 --- a/tvOS/DeviceCheck/DCDevice.swift +++ b/tvOS/DeviceCheck/DCDevice.swift @@ -4,4 +4,5 @@ class DCDevice : NSObject { class var current: DCDevice { get } var isSupported: Bool { get } func generateToken(completionHandler completion: @escaping (Data?, Error?) -> Void) + func generateToken() async throws -> Data } diff --git a/tvOS/ExternalAccessory/EAAccessoryManager.swift b/tvOS/ExternalAccessory/EAAccessoryManager.swift index f06f2a2..d16a71d 100644 --- a/tvOS/ExternalAccessory/EAAccessoryManager.swift +++ b/tvOS/ExternalAccessory/EAAccessoryManager.swift @@ -26,6 +26,8 @@ class EAAccessoryManager : NSObject { class func shared() -> EAAccessoryManager @available(tvOS 6, *) func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?, completion: EABluetoothAccessoryPickerCompletion? = nil) + @available(tvOS 6, *) + func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?) async throws @available(tvOS 10.0, *) func registerForLocalNotifications() @available(tvOS 10.0, *) diff --git a/tvOS/Foundation/NSBundle.swift b/tvOS/Foundation/NSBundle.swift index 5a6fbe0..caee5f0 100644 --- a/tvOS/Foundation/NSBundle.swift +++ b/tvOS/Foundation/NSBundle.swift @@ -99,7 +99,9 @@ class NSBundleResourceRequest : NSObject, ProgressReporting { var tags: Set { get } var bundle: Bundle { get } func beginAccessingResources(completionHandler: @escaping (Error?) -> Void) + func beginAccessingResources() async throws func conditionallyBeginAccessingResources(completionHandler: @escaping (Bool) -> Void) + func conditionallyBeginAccessingResources() async -> Bool func endAccessingResources() } extension Bundle { diff --git a/tvOS/Foundation/NSExtensionContext.swift b/tvOS/Foundation/NSExtensionContext.swift index 1f2cc3b..cc7589c 100644 --- a/tvOS/Foundation/NSExtensionContext.swift +++ b/tvOS/Foundation/NSExtensionContext.swift @@ -3,8 +3,10 @@ class NSExtensionContext : NSObject { var inputItems: [Any] { get } func completeRequest(returningItems items: [Any]?, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(returningItems items: [Any]?) async -> Bool func cancelRequest(withError error: Error) func open(_ URL: URL, completionHandler: ((Bool) -> Void)? = nil) + func open(_ URL: URL) async -> Bool } @available(tvOS 9.0, *) let NSExtensionItemsAndErrorsKey: String diff --git a/tvOS/Foundation/NSFilePresenter.swift b/tvOS/Foundation/NSFilePresenter.swift index 0a0a77e..4f74cc3 100644 --- a/tvOS/Foundation/NSFilePresenter.swift +++ b/tvOS/Foundation/NSFilePresenter.swift @@ -6,7 +6,9 @@ protocol NSFilePresenter : NSObjectProtocol { optional func relinquishPresentedItem(toReader reader: @escaping ((() -> Void)?) -> Void) optional func relinquishPresentedItem(toWriter writer: @escaping ((() -> Void)?) -> Void) optional func savePresentedItemChanges(completionHandler: @escaping (Error?) -> Void) + optional func savePresentedItemChanges() async throws optional func accommodatePresentedItemDeletion(completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedItemDeletion() async throws optional func presentedItemDidMove(to newURL: URL) optional func presentedItemDidChange() @available(tvOS 9.0, *) @@ -16,6 +18,7 @@ protocol NSFilePresenter : NSObjectProtocol { @available(tvOS 9.0, *) optional func presentedItemDidResolveConflict(_ version: NSFileVersion) optional func accommodatePresentedSubitemDeletion(at url: URL, completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedSubitemDeletion(at url: URL) async throws optional func presentedSubitemDidAppear(at url: URL) optional func presentedSubitem(at oldURL: URL, didMoveTo newURL: URL) optional func presentedSubitemDidChange(at url: URL) diff --git a/tvOS/Foundation/NSFileVersion.swift b/tvOS/Foundation/NSFileVersion.swift index 6a04bd0..9f9624e 100644 --- a/tvOS/Foundation/NSFileVersion.swift +++ b/tvOS/Foundation/NSFileVersion.swift @@ -18,6 +18,8 @@ class NSFileVersion : NSObject { class func unresolvedConflictVersionsOfItem(at url: URL) -> [NSFileVersion]? @available(tvOS 9.0, *) class func getNonlocalVersionsOfItem(at url: URL, completionHandler: @escaping ([NSFileVersion]?, Error?) -> Void) + @available(tvOS 9.0, *) + class func nonlocalVersionsOfItem(at url: URL) async throws -> [NSFileVersion] class func version(itemAt url: URL, forPersistentIdentifier persistentIdentifier: Any) -> NSFileVersion? var url: URL { get } var localizedName: String? { get } diff --git a/tvOS/Foundation/NSHTTPCookieStorage.swift b/tvOS/Foundation/NSHTTPCookieStorage.swift index 7ecdaed..cae4a9d 100644 --- a/tvOS/Foundation/NSHTTPCookieStorage.swift +++ b/tvOS/Foundation/NSHTTPCookieStorage.swift @@ -29,6 +29,8 @@ extension HTTPCookieStorage { func storeCookies(_ cookies: [HTTPCookie], for task: URLSessionTask) @available(tvOS 9.0, *) func getCookiesFor(_ task: URLSessionTask, completionHandler: @escaping ([HTTPCookie]?) -> Void) + @available(tvOS 9.0, *) + func cookies(for task: URLSessionTask) async -> [HTTPCookie]? } extension NSNotification.Name { @available(tvOS 9.0, *) diff --git a/tvOS/Foundation/NSItemProvider.swift b/tvOS/Foundation/NSItemProvider.swift index fd9d22e..477cad7 100644 --- a/tvOS/Foundation/NSItemProvider.swift +++ b/tvOS/Foundation/NSItemProvider.swift @@ -75,6 +75,7 @@ class NSItemProvider : NSObject, NSCopying { convenience init?(contentsOf fileURL: URL!) func registerItem(forTypeIdentifier typeIdentifier: String, loadHandler: @escaping NSItemProvider.LoadHandler) func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil, completionHandler: NSItemProvider.CompletionHandler? = nil) + func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil) async throws -> NSSecureCoding } @available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) @@ -93,6 +94,8 @@ extension NSItemProvider { var previewImageHandler: NSItemProvider.LoadHandler? @available(tvOS 9.0, *) func loadPreviewImage(options: [AnyHashable : Any]! = [:], completionHandler: NSItemProvider.CompletionHandler!) + @available(tvOS 9.0, *) + func loadPreviewImage(options: [AnyHashable : Any]! = [:]) async throws -> NSSecureCoding } @available(tvOS 9.0, *) let NSExtensionJavaScriptPreprocessingResultsKey: String diff --git a/tvOS/Foundation/NSURLCache.swift b/tvOS/Foundation/NSURLCache.swift index d352fa7..46eee28 100644 --- a/tvOS/Foundation/NSURLCache.swift +++ b/tvOS/Foundation/NSURLCache.swift @@ -46,5 +46,7 @@ extension URLCache { @available(tvOS 9.0, *) func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -> Void) @available(tvOS 9.0, *) + func cachedResponse(for dataTask: URLSessionDataTask) async -> CachedURLResponse? + @available(tvOS 9.0, *) func removeCachedResponse(for dataTask: URLSessionDataTask) } diff --git a/tvOS/Foundation/NSURLConnection.swift b/tvOS/Foundation/NSURLConnection.swift index 79a2e76..dabeaad 100644 --- a/tvOS/Foundation/NSURLConnection.swift +++ b/tvOS/Foundation/NSURLConnection.swift @@ -55,4 +55,6 @@ extension NSURLConnection { extension NSURLConnection { @available(tvOS, introduced: 9.0, deprecated: 9.0, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue, completionHandler handler: @escaping (URLResponse?, Data?, Error?) -> Void) + @available(tvOS, introduced: 9.0, deprecated: 9.0, message: "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h") + class func sendAsynchronousRequest(_ request: URLRequest, queue: OperationQueue) async throws -> (URLResponse, Data) } diff --git a/tvOS/Foundation/NSURLCredentialStorage.swift b/tvOS/Foundation/NSURLCredentialStorage.swift index 0bf89ea..9bc8da7 100644 --- a/tvOS/Foundation/NSURLCredentialStorage.swift +++ b/tvOS/Foundation/NSURLCredentialStorage.swift @@ -15,12 +15,16 @@ extension URLCredentialStorage { @available(tvOS 9.0, *) func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping ([String : URLCredential]?) -> Void) @available(tvOS 9.0, *) + func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask) async -> [String : URLCredential]? + @available(tvOS 9.0, *) func set(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) @available(tvOS 9.0, *) func remove(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, options: [String : Any]? = nil, task: URLSessionTask) @available(tvOS 9.0, *) func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping (URLCredential?) -> Void) @available(tvOS 9.0, *) + func defaultCredential(for space: URLProtectionSpace, task: URLSessionTask) async -> URLCredential? + @available(tvOS 9.0, *) func setDefaultCredential(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) } extension NSNotification.Name { diff --git a/tvOS/Foundation/NSURLSession.swift b/tvOS/Foundation/NSURLSession.swift index 17487bb..39bc129 100644 --- a/tvOS/Foundation/NSURLSession.swift +++ b/tvOS/Foundation/NSURLSession.swift @@ -13,10 +13,15 @@ class URLSession : NSObject { func finishTasksAndInvalidate() func invalidateAndCancel() func reset(completionHandler: @escaping () -> Void) + func reset() async func flush(completionHandler: @escaping () -> Void) + func flush() async func getTasksWithCompletionHandler(_ completionHandler: @escaping ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) -> Void) + func tasks() async -> ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) @available(tvOS 9.0, *) func getAllTasks(completionHandler: @escaping ([URLSessionTask]) -> Void) + @available(tvOS 9.0, *) + func allTasks() async -> [URLSessionTask] func dataTask(with request: URLRequest) -> URLSessionDataTask func dataTask(with url: URL) -> URLSessionDataTask func uploadTask(with request: URLRequest, fromFile fileURL: URL) -> URLSessionUploadTask @@ -119,11 +124,14 @@ class URLSessionUploadTask : URLSessionDataTask { @available(tvOS 9.0, *) class URLSessionDownloadTask : URLSessionTask { func cancel(byProducingResumeData completionHandler: @escaping (Data?) -> Void) + func cancelByProducingResumeData() async -> Data? } @available(tvOS 9.0, *) class URLSessionStreamTask : URLSessionTask { func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) + func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval) async throws -> (Data, Bool) func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) + func write(_ data: Data, timeout: TimeInterval) async throws func captureStreams() func closeWrite() func closeRead() @@ -169,7 +177,9 @@ extension URLSessionWebSocketTask { @available(tvOS 13.0, *) class URLSessionWebSocketTask : URLSessionTask { func __send(_ message: __NSURLSessionWebSocketMessage, completionHandler: @escaping (Error?) -> Void) + func __send(_ message: __NSURLSessionWebSocketMessage) async throws func __receiveMessage(completionHandler: @escaping (__NSURLSessionWebSocketMessage?, Error?) -> Void) + func __receiveMessage() async throws -> __NSURLSessionWebSocketMessage func sendPing(pongReceiveHandler: @escaping (Error?) -> Void) func cancel(with closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) var maximumMessageSize: Int @@ -266,6 +276,7 @@ extension URLSession { protocol URLSessionDelegate : NSObjectProtocol { optional func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(tvOS 9.0, *) optional func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) } @@ -274,10 +285,15 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(tvOS 11.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest, completionHandler: @escaping (URLSession.DelayedRequestDisposition, URLRequest?) -> Void) @available(tvOS 11.0, *) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest) async -> (URLSession.DelayedRequestDisposition, URLRequest?) + @available(tvOS 11.0, *) optional func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> URLRequest? optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) optional func urlSession(_ session: URLSession, task: URLSessionTask, needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask) async -> InputStream? optional func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) @available(tvOS 10.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) @@ -286,11 +302,13 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(tvOS 9.0, *) protocol URLSessionDataDelegate : URLSessionTaskDelegate { optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse) async -> URLSession.ResponseDisposition optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome downloadTask: URLSessionDownloadTask) @available(tvOS 9.0, *) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome streamTask: URLSessionStreamTask) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse, completionHandler: @escaping (CachedURLResponse?) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) async -> CachedURLResponse? } @available(tvOS 9.0, *) protocol URLSessionDownloadDelegate : URLSessionTaskDelegate { diff --git a/tvOS/Foundation/NSUserActivity.swift b/tvOS/Foundation/NSUserActivity.swift index 6511687..f931d24 100644 --- a/tvOS/Foundation/NSUserActivity.swift +++ b/tvOS/Foundation/NSUserActivity.swift @@ -26,6 +26,7 @@ class NSUserActivity : NSObject { func resignCurrent() func invalidate() func getContinuationStreams(completionHandler: @escaping (InputStream?, OutputStream?, Error?) -> Void) + func continuationStreams() async throws -> (InputStream, OutputStream) @available(tvOS 10.0, *) var isEligibleForHandoff: Bool @available(tvOS 10.0, *) diff --git a/tvOS/GLKit/GLKTextureLoader.swift b/tvOS/GLKit/GLKTextureLoader.swift index 319700f..5ea13a7 100644 --- a/tvOS/GLKit/GLKTextureLoader.swift +++ b/tvOS/GLKit/GLKTextureLoader.swift @@ -82,11 +82,19 @@ class GLKTextureLoader : NSObject { class func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil) throws -> GLKTextureInfo init(sharegroup: EAGLSharegroup) func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withName name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(withContentsOf data: Data, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func texture(with cgImage: CGImage, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOfFile path: String, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?, completionHandler block: @escaping GLKTextureLoaderCallback) + func cubeMap(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: DispatchQueue?) async throws -> GLKTextureInfo } diff --git a/tvOS/GameController/GCController.swift b/tvOS/GameController/GCController.swift index 7737978..ff9fee4 100644 --- a/tvOS/GameController/GCController.swift +++ b/tvOS/GameController/GCController.swift @@ -44,6 +44,7 @@ class GCController : NSObject, GCDevice { func capture() -> GCController class func controllers() -> [GCController] class func startWirelessControllerDiscovery(completionHandler: (() -> Void)? = nil) + class func startWirelessControllerDiscovery() async class func stopWirelessControllerDiscovery() @available(tvOS 13.0, *) class func withMicroGamepad() -> GCController diff --git a/tvOS/GameKit/GKAchievement.swift b/tvOS/GameKit/GKAchievement.swift index 320956a..439b860 100644 --- a/tvOS/GameKit/GKAchievement.swift +++ b/tvOS/GameKit/GKAchievement.swift @@ -2,12 +2,16 @@ @available(tvOS 4.1, *) class GKAchievement : NSObject, NSCoding, NSSecureCoding { class func loadAchievements(completionHandler: (([GKAchievement]?, Error?) -> Void)? = nil) + class func loadAchievements() async throws -> [GKAchievement] class func resetAchievements(completionHandler: ((Error?) -> Void)? = nil) + class func resetAchievements() async throws init(identifier: String) @available(tvOS 8.0, *) init(identifier: String, player: GKPlayer) @available(tvOS 6.0, *) class func report(_ achievements: [GKAchievement], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + class func report(_ achievements: [GKAchievement]) async throws var identifier: String var percentComplete: Double var isCompleted: Bool { get } diff --git a/tvOS/GameKit/GKAchievementDescription.swift b/tvOS/GameKit/GKAchievementDescription.swift index 304d807..98703fe 100644 --- a/tvOS/GameKit/GKAchievementDescription.swift +++ b/tvOS/GameKit/GKAchievementDescription.swift @@ -2,6 +2,7 @@ @available(tvOS 4.1, *) class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { class func loadAchievementDescriptions(completionHandler: (([GKAchievementDescription]?, Error?) -> Void)? = nil) + class func loadAchievementDescriptions() async throws -> [GKAchievementDescription] var identifier: String { get } @available(tvOS 6.0, *) var groupIdentifier: String? { get } @@ -15,6 +16,7 @@ class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { } extension GKAchievementDescription { func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil) + func loadImage() async throws -> UIImage class func incompleteAchievementImage() -> UIImage class func placeholderCompletedAchievementImage() -> UIImage } diff --git a/tvOS/GameKit/GKChallenge.swift b/tvOS/GameKit/GKChallenge.swift index 6665e94..2ab389c 100644 --- a/tvOS/GameKit/GKChallenge.swift +++ b/tvOS/GameKit/GKChallenge.swift @@ -10,6 +10,7 @@ enum GKChallengeState : Int { @available(tvOS 6.0, *) class GKChallenge : NSObject, NSCoding, NSSecureCoding { class func loadReceivedChallenges(completionHandler: (([GKChallenge]?, Error?) -> Void)? = nil) + class func loadReceivedChallenges() async throws -> [GKChallenge] func decline() @available(tvOS 8.0, *) @NSCopying var issuingPlayer: GKPlayer? { get } @@ -33,14 +34,22 @@ class GKAchievementChallenge : GKChallenge { extension GKScore { @available(tvOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to reportLeaderboardScores:withEligibleChallenges:withCompletionHandler instead") + class func report(_ scores: [GKScore], withEligibleChallenges challenges: [GKChallenge]) async throws @available(tvOS 14.0, *) class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 14.0, *) + class func report(_ scores: [GKLeaderboardScore], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKAchievement { @available(tvOS 8.0, *) func selectChallengeablePlayers(_ players: [GKPlayer], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(tvOS 8.0, *) + func selectChallengeablePlayers(_ players: [GKPlayer]) async throws -> [GKPlayer] @available(tvOS 7.0, *) class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 7.0, *) + class func report(_ achievements: [GKAchievement], withEligibleChallenges challenges: [GKChallenge]) async throws } extension GKScore { } diff --git a/tvOS/GameKit/GKCloudPlayer.swift b/tvOS/GameKit/GKCloudPlayer.swift index 6dca1df..496d511 100644 --- a/tvOS/GameKit/GKCloudPlayer.swift +++ b/tvOS/GameKit/GKCloudPlayer.swift @@ -2,4 +2,5 @@ @available(tvOS, introduced: 10.0, deprecated: 12.0, message: "GKGameSession is deprecated. Use GKPlayer for both real-time and turn-based matchmaking APIs.") class GKCloudPlayer : GKBasePlayer { class func getCurrentSignedInPlayer(forContainer containerName: String?, completionHandler handler: @escaping (GKCloudPlayer?, Error?) -> Void) + class func currentSignedInPlayer(forContainer containerName: String?) async throws -> GKCloudPlayer } diff --git a/tvOS/GameKit/GKGameSession.swift b/tvOS/GameKit/GKGameSession.swift index f09ebb9..5459cae 100644 --- a/tvOS/GameKit/GKGameSession.swift +++ b/tvOS/GameKit/GKGameSession.swift @@ -22,15 +22,26 @@ class GKGameSession : NSObject { var maxNumberOfConnectedPlayers: Int { get } var badgedPlayers: [GKCloudPlayer] { get } class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func createSession(inContainer containerName: String?, withTitle title: String, maxConnectedPlayers maxPlayers: Int) async throws -> GKGameSession class func loadSessions(inContainer containerName: String?, completionHandler: @escaping ([GKGameSession]?, Error?) -> Void) + class func loadSessions(inContainer containerName: String?) async throws -> [GKGameSession] class func load(withIdentifier identifier: String, completionHandler: @escaping (GKGameSession?, Error?) -> Void) + class func load(withIdentifier identifier: String) async throws -> GKGameSession class func remove(withIdentifier identifier: String, completionHandler: @escaping (Error?) -> Void) + class func remove(withIdentifier identifier: String) async throws func getShareURL(completionHandler: @escaping (URL?, Error?) -> Void) + func shareURL() async throws -> URL func loadData(completionHandler: @escaping (Data?, Error?) -> Void) + func loadData() async throws -> Data func save(_ data: Data, completionHandler: @escaping (Data?, Error?) -> Void) + func save(_ data: Data) async throws -> Data func setConnectionState(_ state: GKConnectionState, completionHandler: @escaping (Error?) -> Void) + func setConnectionState(_ state: GKConnectionState) async throws func players(with state: GKConnectionState) -> [GKCloudPlayer] func send(_ data: Data, with transport: GKTransportType, completionHandler: @escaping (Error?) -> Void) + func send(_ data: Data, with transport: GKTransportType) async throws func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool, completionHandler: @escaping (Error?) -> Void) + func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool) async throws func clearBadge(for players: [GKCloudPlayer], completionHandler: @escaping (Error?) -> Void) + func clearBadge(for players: [GKCloudPlayer]) async throws } diff --git a/tvOS/GameKit/GKLeaderboard.swift b/tvOS/GameKit/GKLeaderboard.swift index cc12f79..f96e850 100644 --- a/tvOS/GameKit/GKLeaderboard.swift +++ b/tvOS/GameKit/GKLeaderboard.swift @@ -39,15 +39,27 @@ class GKLeaderboard : NSObject { @available(tvOS 14.0, *) class func loadLeaderboards(IDs leaderboardIDs: [String]?, completionHandler: @escaping ([GKLeaderboard]?, Error?) -> Void) @available(tvOS 14.0, *) + class func loadLeaderboards(IDs leaderboardIDs: [String]?) async throws -> [GKLeaderboard] + @available(tvOS 14.0, *) func loadPreviousOccurrence(completionHandler: @escaping (GKLeaderboard?, Error?) -> Void) @available(tvOS 14.0, *) + func loadPreviousOccurrence() async throws -> GKLeaderboard + @available(tvOS 14.0, *) class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String], completionHandler: @escaping (Error?) -> Void) @available(tvOS 14.0, *) + class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String]) async throws + @available(tvOS 14.0, *) func submitScore(_ score: Int, context: Int, player: GKPlayer, completionHandler: @escaping (Error?) -> Void) @available(tvOS 14.0, *) + func submitScore(_ score: Int, context: Int, player: GKPlayer) async throws + @available(tvOS 14.0, *) func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Int, Error?) -> Void) @available(tvOS 14.0, *) + func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry], Int) + @available(tvOS 14.0, *) func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Error?) -> Void) + @available(tvOS 14.0, *) + func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry]) } extension GKLeaderboard { @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler: instead.") @@ -70,8 +82,12 @@ extension GKLeaderboard { init(players: [GKPlayer]) @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") func loadScores(completionHandler: (([GKScore]?, Error?) -> Void)? = nil) + @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") + func loadScores() async throws -> [GKScore] @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") class func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") + class func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboard { } diff --git a/tvOS/GameKit/GKLeaderboardSet.swift b/tvOS/GameKit/GKLeaderboardSet.swift index 79788af..69f265f 100644 --- a/tvOS/GameKit/GKLeaderboardSet.swift +++ b/tvOS/GameKit/GKLeaderboardSet.swift @@ -6,12 +6,16 @@ class GKLeaderboardSet : NSObject, NSCoding, NSSecureCoding { var identifier: String? @available(tvOS 7.0, *) class func loadLeaderboardSets(completionHandler: (([GKLeaderboardSet]?, Error?) -> Void)? = nil) + @available(tvOS 7.0, *) + class func loadLeaderboardSets() async throws -> [GKLeaderboardSet] @available(tvOS 14.0, *) func loadLeaderboards(handler: @escaping ([GKLeaderboard]?, Error?) -> Void) } extension GKLeaderboardSet { @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use loadLeaderboardsWithHandler: instead.") func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(tvOS, introduced: 9.0, deprecated: 14.0, message: "Use loadLeaderboardsWithHandler: instead.") + func loadLeaderboards() async throws -> [GKLeaderboard] } extension GKLeaderboardSet { } diff --git a/tvOS/GameKit/GKLocalPlayer.swift b/tvOS/GameKit/GKLocalPlayer.swift index b7d8894..cabd8bc 100644 --- a/tvOS/GameKit/GKLocalPlayer.swift +++ b/tvOS/GameKit/GKLocalPlayer.swift @@ -12,13 +12,22 @@ class GKLocalPlayer : GKPlayer { var isPersonalizedCommunicationRestricted: Bool { get } @available(tvOS 10.0, *) func loadRecentPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(tvOS 10.0, *) + func loadRecentPlayers() async throws -> [GKPlayer] func loadChallengableFriends(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + func loadChallengableFriends() async throws -> [GKPlayer] @available(tvOS 7.0, *) func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String, completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 7.0, *) + func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String) async throws + @available(tvOS 7.0, *) func loadDefaultLeaderboardIdentifier(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(tvOS 7.0, *) + func loadDefaultLeaderboardIdentifier() async throws -> String @available(tvOS 13.5, *) func fetchItems(forIdentityVerificationSignature completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(tvOS 13.5, *) + func fetchItemsForIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } protocol GKLocalPlayerListener : GKChallengeListener, GKInviteEventListener, GKTurnBasedEventListener { } @@ -37,8 +46,12 @@ extension NSNotification.Name { extension GKLocalPlayer { @available(tvOS, introduced: 8.0, deprecated: 10.0) func loadFriendPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(tvOS, introduced: 8.0, deprecated: 10.0) + func loadFriendPlayers() async throws -> [GKPlayer] @available(tvOS, introduced: 9.0, deprecated: 13.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") func generateIdentityVerificationSignature(completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(tvOS, introduced: 9.0, deprecated: 13.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") + func generateIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } extension GKLocalPlayer { } diff --git a/tvOS/GameKit/GKMatch.swift b/tvOS/GameKit/GKMatch.swift index 393c30b..d136be5 100644 --- a/tvOS/GameKit/GKMatch.swift +++ b/tvOS/GameKit/GKMatch.swift @@ -27,8 +27,12 @@ class GKMatch : NSObject { func voiceChat(withName name: String) -> GKVoiceChat? @available(tvOS 8.0, *) func chooseBestHostingPlayer(completionHandler: @escaping (GKPlayer?) -> Void) + @available(tvOS 8.0, *) + func chooseBestHostingPlayer() async -> GKPlayer? @available(tvOS 6.0, *) func rematch(completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + func rematch() async throws -> GKMatch } protocol GKMatchDelegate : NSObjectProtocol { @available(tvOS 8.0, *) diff --git a/tvOS/GameKit/GKMatchmaker.swift b/tvOS/GameKit/GKMatchmaker.swift index 330fd50..7576f91 100644 --- a/tvOS/GameKit/GKMatchmaker.swift +++ b/tvOS/GameKit/GKMatchmaker.swift @@ -63,17 +63,25 @@ class GKMatchmaker : NSObject { class func shared() -> GKMatchmaker @available(tvOS 6.0, *) func match(for invite: GKInvite, completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + func match(for invite: GKInvite) async throws -> GKMatch func findMatch(for request: GKMatchRequest, withCompletionHandler completionHandler: ((GKMatch?, Error?) -> Void)? = nil) + func findMatch(for request: GKMatchRequest) async throws -> GKMatch @available(tvOS 8.0, *) func findPlayers(forHostedRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(tvOS 8.0, *) + func findPlayers(forHostedRequest request: GKMatchRequest) async throws -> [GKPlayer] func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest, completionHandler: ((Error?) -> Void)? = nil) + func addPlayers(to match: GKMatch, matchRequest: GKMatchRequest) async throws func cancel() @available(tvOS 8.0, *) func cancelPendingInvite(to player: GKPlayer) @available(tvOS 6.0, *) func finishMatchmaking(for match: GKMatch) func queryPlayerGroupActivity(_ playerGroup: Int, withCompletionHandler completionHandler: ((Int, Error?) -> Void)? = nil) + func queryPlayerGroupActivity(_ playerGroup: Int) async throws -> Int func queryActivity(completionHandler: ((Int, Error?) -> Void)? = nil) + func queryActivity() async throws -> Int @available(tvOS 8.0, *) func startBrowsingForNearbyPlayers(handler reachableHandler: ((GKPlayer, Bool) -> Void)? = nil) @available(tvOS 6.0, *) diff --git a/tvOS/GameKit/GKNotificationBanner.swift b/tvOS/GameKit/GKNotificationBanner.swift index ff90efd..def9e97 100644 --- a/tvOS/GameKit/GKNotificationBanner.swift +++ b/tvOS/GameKit/GKNotificationBanner.swift @@ -3,6 +3,10 @@ class GKNotificationBanner : NSObject { @available(tvOS 5.0, *) class func show(withTitle title: String?, message: String?, completionHandler: (() -> Void)? = nil) + @available(tvOS 5.0, *) + class func show(withTitle title: String?, message: String?) async @available(tvOS 6.0, *) class func show(withTitle title: String?, message: String?, duration: TimeInterval, completionHandler: (() -> Void)? = nil) + @available(tvOS 6.0, *) + class func show(withTitle title: String?, message: String?, duration: TimeInterval) async } diff --git a/tvOS/GameKit/GKPlayer.swift b/tvOS/GameKit/GKPlayer.swift index 8ba34b8..00580e5 100644 --- a/tvOS/GameKit/GKPlayer.swift +++ b/tvOS/GameKit/GKPlayer.swift @@ -4,6 +4,7 @@ let GKPlayerIDNoLongerAvailable: String @available(tvOS 4.1, *) class GKPlayer : GKBasePlayer { class func loadPlayers(forIdentifiers identifiers: [String], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + class func loadPlayers(forIdentifiers identifiers: [String]) async throws -> [GKPlayer] @available(tvOS 13.0, *) func scopedIDsArePersistent() -> Bool @available(tvOS 12.4, *) @@ -21,6 +22,8 @@ class GKPlayer : GKBasePlayer { extension GKPlayer { @available(tvOS 5.0, *) func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: ((UIImage?, Error?) -> Void)? = nil) + @available(tvOS 5.0, *) + func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> UIImage } extension GKPlayer { enum PhotoSize : Int { diff --git a/tvOS/GameKit/GKScore.swift b/tvOS/GameKit/GKScore.swift index 33326b5..aae4769 100644 --- a/tvOS/GameKit/GKScore.swift +++ b/tvOS/GameKit/GKScore.swift @@ -18,6 +18,8 @@ class GKScore : NSObject, NSCoding, NSSecureCoding { var shouldSetDefaultLeaderboard: Bool @available(tvOS 6.0, *) class func report(_ scores: [GKScore], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + class func report(_ scores: [GKScore]) async throws } extension GKScore { } diff --git a/tvOS/GameKit/GKTurnBasedMatch.swift b/tvOS/GameKit/GKTurnBasedMatch.swift index 48c1a4d..aefdece 100644 --- a/tvOS/GameKit/GKTurnBasedMatch.swift +++ b/tvOS/GameKit/GKTurnBasedMatch.swift @@ -92,35 +92,65 @@ class GKTurnBasedMatch : NSObject { @available(tvOS 7.0, *) var exchangeMaxInitiatedExchangesPerPlayer: Int { get } class func find(for request: GKMatchRequest, withCompletionHandler completionHandler: @escaping (GKTurnBasedMatch?, Error?) -> Void) + class func find(for request: GKMatchRequest) async throws -> GKTurnBasedMatch class func loadMatches(completionHandler: (([GKTurnBasedMatch]?, Error?) -> Void)? = nil) + class func loadMatches() async throws -> [GKTurnBasedMatch] @available(tvOS 5.0, *) class func load(withID matchID: String, withCompletionHandler completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(tvOS 5.0, *) + class func load(withID matchID: String) async throws -> GKTurnBasedMatch @available(tvOS 6.0, *) func rematch(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + func rematch() async throws -> GKTurnBasedMatch @available(tvOS 5.0, *) func acceptInvite(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(tvOS 5.0, *) + func acceptInvite() async throws -> GKTurnBasedMatch + @available(tvOS 5.0, *) func declineInvite(completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 5.0, *) + func declineInvite() async throws func remove(completionHandler: ((Error?) -> Void)? = nil) + func remove() async throws func loadMatchData(completionHandler: ((Data?, Error?) -> Void)? = nil) + func loadMatchData() async throws -> Data @available(tvOS 6.0, *) func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 6.0, *) + func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws + @available(tvOS 6.0, *) func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome) async throws func endMatchInTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + func endMatchInTurn(withMatch matchData: Data) async throws @available(tvOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?, completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS, introduced: 6.0, deprecated: 14.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") + func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?) async throws @available(tvOS 14.0, *) func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any], completionHandler: @escaping (Error?) -> Void) + @available(tvOS 14.0, *) + func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any]) async throws @available(tvOS 6.0, *) func saveCurrentTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 6.0, *) + func saveCurrentTurn(withMatch matchData: Data) async throws @available(tvOS 7.0, *) func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 7.0, *) + func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throws + @available(tvOS 7.0, *) func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval, completionHandler: ((GKTurnBasedExchange?, Error?) -> Void)? = nil) @available(tvOS 7.0, *) + func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval) async throws -> GKTurnBasedExchange + @available(tvOS 7.0, *) func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 7.0, *) + func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String]) async throws } @available(tvOS 7.0, *) enum GKTurnBasedExchangeStatus : Int8 { @@ -151,7 +181,11 @@ class GKTurnBasedExchange : NSObject { @available(tvOS 7.0, *) func cancel(withLocalizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 7.0, *) + func cancel(withLocalizableMessageKey key: String, arguments: [String]) async throws + @available(tvOS 7.0, *) func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 7.0, *) + func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data) async throws } @available(tvOS 7.0, *) class GKTurnBasedExchangeReply : NSObject { diff --git a/tvOS/HomeKit/HMAccessory.swift b/tvOS/HomeKit/HMAccessory.swift index 6c486a9..6a7bd97 100644 --- a/tvOS/HomeKit/HMAccessory.swift +++ b/tvOS/HomeKit/HMAccessory.swift @@ -25,6 +25,7 @@ class HMAccessory : NSObject { @available(tvOS 11.3, *) var supportsIdentify: Bool { get } func identify(completionHandler completion: @escaping (Error?) -> Void) + func identify() async throws } @available(tvOS 10.0, *) protocol HMAccessoryDelegate : NSObjectProtocol { diff --git a/tvOS/HomeKit/HMCharacteristic.swift b/tvOS/HomeKit/HMCharacteristic.swift index 80f2d37..fd1a551 100644 --- a/tvOS/HomeKit/HMCharacteristic.swift +++ b/tvOS/HomeKit/HMCharacteristic.swift @@ -12,6 +12,9 @@ class HMCharacteristic : NSObject { @available(tvOS 9.0, *) var uniqueIdentifier: UUID { get } func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void) + func writeValue(_ value: Any?) async throws func readValue(completionHandler completion: @escaping (Error?) -> Void) + func readValue() async throws func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) + func enableNotification(_ enable: Bool) async throws } diff --git a/tvOS/HomeKit/HMHome.swift b/tvOS/HomeKit/HMHome.swift index 66d531b..5cb0335 100644 --- a/tvOS/HomeKit/HMHome.swift +++ b/tvOS/HomeKit/HMHome.swift @@ -42,6 +42,7 @@ extension HMHome { extension HMHome { var actionSets: [HMActionSet] { get } func executeActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func executeActionSet(_ actionSet: HMActionSet) async throws @available(tvOS 9.0, *) func builtinActionSet(ofType actionSetType: String) -> HMActionSet? } diff --git a/tvOS/Intents/INAddMediaIntent.swift b/tvOS/Intents/INAddMediaIntent.swift index 9c938a5..3a98a59 100644 --- a/tvOS/Intents/INAddMediaIntent.swift +++ b/tvOS/Intents/INAddMediaIntent.swift @@ -9,7 +9,11 @@ class INAddMediaIntent : INIntent { @available(tvOS 14.0, *) protocol INAddMediaIntentHandling : NSObjectProtocol { func handle(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + func handle(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func confirm(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + optional func confirm(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func resolveMediaItems(for intent: INAddMediaIntent, with completion: @escaping ([INAddMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INAddMediaIntent) async -> [INAddMediaMediaItemResolutionResult] optional func resolveMediaDestination(for intent: INAddMediaIntent, with completion: @escaping (INAddMediaMediaDestinationResolutionResult) -> Void) + optional func resolveMediaDestination(for intent: INAddMediaIntent) async -> INAddMediaMediaDestinationResolutionResult } diff --git a/tvOS/Intents/INColor.swift b/tvOS/Intents/INColor.swift new file mode 100644 index 0000000..41eb19e --- /dev/null +++ b/tvOS/Intents/INColor.swift @@ -0,0 +1,8 @@ + +@available(tvOS 14.0, *) +class INColor : NSObject, NSCopying, NSSecureCoding { + init(red: Double, green: Double, blue: Double) + var red: Double { get } + var green: Double { get } + var blue: Double { get } +} diff --git a/tvOS/Intents/INInteraction.swift b/tvOS/Intents/INInteraction.swift index 12e5c48..c3ef1a1 100644 --- a/tvOS/Intents/INInteraction.swift +++ b/tvOS/Intents/INInteraction.swift @@ -24,9 +24,13 @@ enum INInteractionDirection : Int { class INInteraction : NSObject, NSSecureCoding, NSCopying { init(intent: INIntent, response: INIntentResponse?) func donate(completion: ((Error?) -> Void)? = nil) + func donate() async throws class func deleteAll(completion: ((Error?) -> Void)? = nil) + class func deleteAll() async throws class func delete(with identifiers: [String], completion: ((Error?) -> Void)? = nil) + class func delete(with identifiers: [String]) async throws class func delete(with groupIdentifier: String, completion: ((Error?) -> Void)? = nil) + class func delete(with groupIdentifier: String) async throws @NSCopying var intent: INIntent { get } @NSCopying var intentResponse: INIntentResponse? { get } var intentHandlingStatus: INIntentHandlingStatus { get } diff --git a/tvOS/Intents/INPlayMediaIntent.swift b/tvOS/Intents/INPlayMediaIntent.swift index dc2ca65..008f8f1 100644 --- a/tvOS/Intents/INPlayMediaIntent.swift +++ b/tvOS/Intents/INPlayMediaIntent.swift @@ -29,17 +29,31 @@ extension INPlayMediaIntent { @available(tvOS 14.0, *) protocol INPlayMediaIntentHandling : NSObjectProtocol { func handle(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + func handle(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse optional func confirm(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + optional func confirm(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse @available(tvOS 13.0, *) optional func resolveMediaItems(for intent: INPlayMediaIntent, with completion: @escaping ([INPlayMediaMediaItemResolutionResult]) -> Void) @available(tvOS 13.0, *) + optional func resolveMediaItems(for intent: INPlayMediaIntent) async -> [INPlayMediaMediaItemResolutionResult] + @available(tvOS 13.0, *) optional func resolvePlayShuffled(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(tvOS 13.0, *) + optional func resolvePlayShuffled(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(tvOS 13.0, *) optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackRepeatModeResolutionResult) -> Void) @available(tvOS 13.0, *) + optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent) async -> INPlaybackRepeatModeResolutionResult + @available(tvOS 13.0, *) optional func resolveResumePlayback(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(tvOS 13.0, *) + optional func resolveResumePlayback(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(tvOS 13.0, *) optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackQueueLocationResolutionResult) -> Void) @available(tvOS 13.0, *) + optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent) async -> INPlaybackQueueLocationResolutionResult + @available(tvOS 13.0, *) optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent, with completion: @escaping (INPlayMediaPlaybackSpeedResolutionResult) -> Void) + @available(tvOS 13.0, *) + optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent) async -> INPlayMediaPlaybackSpeedResolutionResult } diff --git a/tvOS/Intents/INSearchForMediaIntent.swift b/tvOS/Intents/INSearchForMediaIntent.swift index 3c82190..7167cc4 100644 --- a/tvOS/Intents/INSearchForMediaIntent.swift +++ b/tvOS/Intents/INSearchForMediaIntent.swift @@ -8,6 +8,9 @@ class INSearchForMediaIntent : INIntent { @available(tvOS 14.0, *) protocol INSearchForMediaIntentHandling : NSObjectProtocol { func handle(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + func handle(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func confirm(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + optional func confirm(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func resolveMediaItems(for intent: INSearchForMediaIntent, with completion: @escaping ([INSearchForMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INSearchForMediaIntent) async -> [INSearchForMediaMediaItemResolutionResult] } diff --git a/tvOS/Intents/INUpdateMediaAffinityIntent.swift b/tvOS/Intents/INUpdateMediaAffinityIntent.swift index 35e7bf0..6ef756d 100644 --- a/tvOS/Intents/INUpdateMediaAffinityIntent.swift +++ b/tvOS/Intents/INUpdateMediaAffinityIntent.swift @@ -9,7 +9,11 @@ class INUpdateMediaAffinityIntent : INIntent { @available(tvOS 14.0, *) protocol INUpdateMediaAffinityIntentHandling : NSObjectProtocol { func handle(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + func handle(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func confirm(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + optional func confirm(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent, with completion: @escaping ([INUpdateMediaAffinityMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent) async -> [INUpdateMediaAffinityMediaItemResolutionResult] optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent, with completion: @escaping (INMediaAffinityTypeResolutionResult) -> Void) + optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent) async -> INMediaAffinityTypeResolutionResult } diff --git a/tvOS/IntentsUI/INImage_IntentsUI.swift b/tvOS/IntentsUI/INImage_IntentsUI.swift index 830651e..2d814ac 100644 --- a/tvOS/IntentsUI/INImage_IntentsUI.swift +++ b/tvOS/IntentsUI/INImage_IntentsUI.swift @@ -8,4 +8,6 @@ extension INImage { class func imageSize(for response: INIntentResponse) -> CGSize @available(tvOS 14.0, *) func fetchUIImage(completion: @escaping (UIImage?) -> Void) + @available(tvOS 14.0, *) + func fetchUIImage() async -> UIImage? } diff --git a/tvOS/MapKit/MKDirections.swift b/tvOS/MapKit/MKDirections.swift index 5060dca..3a2e03a 100644 --- a/tvOS/MapKit/MKDirections.swift +++ b/tvOS/MapKit/MKDirections.swift @@ -7,7 +7,9 @@ extension MKDirections { class MKDirections : NSObject { init(request: MKDirections.Request) func calculate(completionHandler: @escaping MKDirections.DirectionsHandler) + func calculate() async throws -> MKDirections.Response func calculateETA(completionHandler: @escaping MKDirections.ETAHandler) + func calculateETA() async throws -> MKDirections.ETAResponse func cancel() var isCalculating: Bool { get } } diff --git a/tvOS/MapKit/MKLocalSearch.swift b/tvOS/MapKit/MKLocalSearch.swift index ca8e7e4..be19e41 100644 --- a/tvOS/MapKit/MKLocalSearch.swift +++ b/tvOS/MapKit/MKLocalSearch.swift @@ -8,6 +8,7 @@ class MKLocalSearch : NSObject { @available(tvOS 14.0, *) init(request: MKLocalPointsOfInterestRequest) func start(completionHandler: @escaping MKLocalSearch.CompletionHandler) + func start() async throws -> MKLocalSearch.Response func cancel() var isSearching: Bool { get } } diff --git a/tvOS/MapKit/MKMapSnapshotter.swift b/tvOS/MapKit/MKMapSnapshotter.swift index 80a1b6a..a6ac8a0 100644 --- a/tvOS/MapKit/MKMapSnapshotter.swift +++ b/tvOS/MapKit/MKMapSnapshotter.swift @@ -6,7 +6,9 @@ extension MKMapSnapshotter { class MKMapSnapshotter : NSObject { init(options: MKMapSnapshotter.Options) func start(completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start() async throws -> MKMapSnapshotter.Snapshot func start(with queue: DispatchQueue, completionHandler: @escaping MKMapSnapshotter.CompletionHandler) + func start(with queue: DispatchQueue) async throws -> MKMapSnapshotter.Snapshot func cancel() var isLoading: Bool { get } } diff --git a/tvOS/MediaPlayer/MPMusicPlayerApplicationController.swift b/tvOS/MediaPlayer/MPMusicPlayerApplicationController.swift index 6c83845..65bd778 100644 --- a/tvOS/MediaPlayer/MPMusicPlayerApplicationController.swift +++ b/tvOS/MediaPlayer/MPMusicPlayerApplicationController.swift @@ -11,6 +11,7 @@ class MPMusicPlayerControllerMutableQueue : MPMusicPlayerControllerQueue { @available(tvOS 14.0, *) class MPMusicPlayerApplicationController : MPMusicPlayerController { func perform(queueTransaction: @escaping (MPMusicPlayerControllerMutableQueue) -> Void, completionHandler: @escaping (MPMusicPlayerControllerQueue, Error?) -> Void) + func perform(queueTransaction: @escaping (MPMusicPlayerControllerMutableQueue) -> Void) async throws -> MPMusicPlayerControllerQueue } extension NSNotification.Name { @available(tvOS 14.0, *) diff --git a/tvOS/MediaPlayer/MPMusicPlayerController.swift b/tvOS/MediaPlayer/MPMusicPlayerController.swift index bc85ef5..34d91a8 100644 --- a/tvOS/MediaPlayer/MPMusicPlayerController.swift +++ b/tvOS/MediaPlayer/MPMusicPlayerController.swift @@ -54,6 +54,8 @@ class MPMusicPlayerController : NSObject, MPMediaPlayback { func append(_ descriptor: MPMusicPlayerQueueDescriptor) @available(tvOS 14.0, *) func prepareToPlay(completionHandler: @escaping (Error?) -> Void) + @available(tvOS 14.0, *) + func prepareToPlay() async throws func skipToNextItem() func skipToBeginning() func skipToPreviousItem() diff --git a/tvOS/MediaPlayer/MPNowPlayingSession.swift b/tvOS/MediaPlayer/MPNowPlayingSession.swift index 0dc0a12..79f40e0 100644 --- a/tvOS/MediaPlayer/MPNowPlayingSession.swift +++ b/tvOS/MediaPlayer/MPNowPlayingSession.swift @@ -9,6 +9,7 @@ class MPNowPlayingSession : NSObject { var canBecomeActive: Bool { get } var isActive: Bool { get } func becomeActiveIfPossible(completion: ((Bool) -> Void)? = nil) + func becomeActiveIfPossible() async -> Bool func addPlayer(_ player: AVPlayer) func removePlayer(_ player: AVPlayer) } diff --git a/tvOS/Metal/MTLDevice.swift b/tvOS/Metal/MTLDevice.swift index 0e47636..49c5aed 100644 --- a/tvOS/Metal/MTLDevice.swift +++ b/tvOS/Metal/MTLDevice.swift @@ -141,18 +141,25 @@ protocol MTLDevice : NSObjectProtocol { func makeLibrary(data: __DispatchData) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?) throws -> MTLLibrary func makeLibrary(source: String, options: MTLCompileOptions?, completionHandler: @escaping MTLNewLibraryCompletionHandler) + func makeLibrary(source: String, options: MTLCompileOptions?) async throws -> MTLLibrary func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, completionHandler: @escaping MTLNewRenderPipelineStateCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) async throws -> MTLRenderPipelineState func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewRenderPipelineStateWithReflectionCompletionHandler) + func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLRenderPipelineState, MTLRenderPipelineReflection) func makeComputePipelineState(function computeFunction: MTLFunction) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, completionHandler: @escaping MTLNewComputePipelineStateCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction) async throws -> MTLComputePipelineState func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(tvOS 9.0, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer?) throws -> MTLComputePipelineState @available(tvOS 9.0, *) func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping MTLNewComputePipelineStateWithReflectionCompletionHandler) + @available(tvOS 9.0, *) + func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption) async throws -> (MTLComputePipelineState, MTLComputePipelineReflection) @available(tvOS 10.0, *) func makeFence() -> MTLFence? func supportsFeatureSet(_ featureSet: MTLFeatureSet) -> Bool diff --git a/tvOS/Metal/MTLLibrary.swift b/tvOS/Metal/MTLLibrary.swift index 2d49174..e685d0e 100644 --- a/tvOS/Metal/MTLLibrary.swift +++ b/tvOS/Metal/MTLLibrary.swift @@ -135,9 +135,13 @@ protocol MTLLibrary : NSObjectProtocol { func makeFunction(name: String, constantValues: MTLFunctionConstantValues) throws -> MTLFunction @available(tvOS 10.0, *) func makeFunction(name: String, constantValues: MTLFunctionConstantValues, completionHandler: @escaping (MTLFunction?, Error?) -> Void) + @available(tvOS 10.0, *) + func makeFunction(name: String, constantValues: MTLFunctionConstantValues) async throws -> MTLFunction @available(tvOS 14.0, *) func makeFunction(descriptor: MTLFunctionDescriptor, completionHandler: @escaping (MTLFunction?, Error?) -> Void) @available(tvOS 14.0, *) + func makeFunction(descriptor: MTLFunctionDescriptor) async throws -> MTLFunction + @available(tvOS 14.0, *) func makeFunction(descriptor: MTLFunctionDescriptor) throws -> MTLFunction var functionNames: [String] { get } @available(tvOS 14.0, *) diff --git a/tvOS/MetalKit/MTKTextureLoader.swift b/tvOS/MetalKit/MTKTextureLoader.swift index 7cc25a4..4ce6bf3 100644 --- a/tvOS/MetalKit/MTKTextureLoader.swift +++ b/tvOS/MetalKit/MTKTextureLoader.swift @@ -65,16 +65,27 @@ class MTKTextureLoader : NSObject { var device: MTLDevice { get } init(device: MTLDevice) func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(tvOS 10.0, *) func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) @available(tvOS 10.0, *) + func newTexture(name: String, scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture + @available(tvOS 10.0, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) @available(tvOS 10.0, *) + func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] + @available(tvOS 10.0, *) func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.ArrayCallback) + @available(tvOS 10.0, *) + func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> [MTLTexture] func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture @available(tvOS 10.0, *) func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil, completionHandler: @escaping MTKTextureLoader.Callback) + @available(tvOS 10.0, *) + func newTexture(texture: MDLTexture, options: [MTKTextureLoader.Option : Any]? = nil) async throws -> MTLTexture func newTexture(URL: URL, options: [MTKTextureLoader.Option : Any]? = nil) throws -> MTLTexture @available(tvOS 10.0, *) func newTextures(URLs: [URL], options: [MTKTextureLoader.Option : Any]? = nil, error: NSErrorPointer) -> [MTLTexture] diff --git a/tvOS/MetalPerformanceShaders/MetalPerformanceShaders.swift b/tvOS/MetalPerformanceShaders/MetalPerformanceShaders.swift index 197de0b..76ed380 100644 --- a/tvOS/MetalPerformanceShaders/MetalPerformanceShaders.swift +++ b/tvOS/MetalPerformanceShaders/MetalPerformanceShaders.swift @@ -3739,6 +3739,7 @@ class MPSAccelerationStructure : MPSKernel, NSSecureCoding, NSCopying { init?(coder aDecoder: NSCoder, group: MPSAccelerationStructureGroup) func rebuild() func rebuild(completionHandler: @escaping MPSAccelerationStructureCompletionHandler) + func rebuild() async -> MPSAccelerationStructure? func encodeRefit(commandBuffer: MTLCommandBuffer) func copy(with zone: NSZone? = nil, group: MPSAccelerationStructureGroup) -> Self } diff --git a/tvOS/MultipeerConnectivity/MCSession.swift b/tvOS/MultipeerConnectivity/MCSession.swift index fa50725..73a8caa 100644 --- a/tvOS/MultipeerConnectivity/MCSession.swift +++ b/tvOS/MultipeerConnectivity/MCSession.swift @@ -56,6 +56,7 @@ protocol MCSessionDelegate : NSObjectProtocol { } extension MCSession { func nearbyConnectionData(forPeer peerID: MCPeerID, withCompletionHandler completionHandler: @escaping (Data?, Error?) -> Void) + func nearbyConnectionData(forPeer peerID: MCPeerID) async throws -> Data func connectPeer(_ peerID: MCPeerID, withNearbyConnectionData data: Data) func cancelConnectPeer(_ peerID: MCPeerID) } diff --git a/tvOS/NaturalLanguage/NLTagger.swift b/tvOS/NaturalLanguage/NLTagger.swift index 103c9b0..ab84ef0 100644 --- a/tvOS/NaturalLanguage/NLTagger.swift +++ b/tvOS/NaturalLanguage/NLTagger.swift @@ -37,6 +37,8 @@ class NLTagger : NSObject { func gazetteers(for tagScheme: NLTagScheme) -> [NLGazetteer] @available(tvOS 13.0, *) class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme, completionHandler: @escaping (NLTagger.AssetsResult, Error?) -> Void) + @available(tvOS 13.0, *) + class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme) async throws -> NLTagger.AssetsResult } @available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) diff --git a/tvOS/Photos/PHAssetResourceManager.swift b/tvOS/Photos/PHAssetResourceManager.swift index a4ee426..4fdc90f 100644 --- a/tvOS/Photos/PHAssetResourceManager.swift +++ b/tvOS/Photos/PHAssetResourceManager.swift @@ -21,5 +21,7 @@ class PHAssetResourceManager : NSObject { @available(tvOS 10, *) func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?, completionHandler: @escaping (Error?) -> Void) @available(tvOS 10, *) + func writeData(for resource: PHAssetResource, toFile fileURL: URL, options: PHAssetResourceRequestOptions?) async throws + @available(tvOS 10, *) func cancelDataRequest(_ requestID: PHAssetResourceDataRequestID) } diff --git a/tvOS/Photos/PHLivePhotoEditingContext.swift b/tvOS/Photos/PHLivePhotoEditingContext.swift index 5f28629..4b42ec3 100644 --- a/tvOS/Photos/PHLivePhotoEditingContext.swift +++ b/tvOS/Photos/PHLivePhotoEditingContext.swift @@ -26,8 +26,12 @@ class PHLivePhotoEditingContext : NSObject { @available(tvOS 10, *) func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil, completionHandler handler: @escaping (PHLivePhoto?, Error?) -> Void) @available(tvOS 10, *) + func prepareLivePhotoForPlayback(withTargetSize targetSize: CGSize, options: [String : Any]? = nil) async throws -> PHLivePhoto + @available(tvOS 10, *) func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil, completionHandler handler: @escaping (Bool, Error?) -> Void) @available(tvOS 10, *) + func saveLivePhoto(to output: PHContentEditingOutput, options: [String : Any]? = nil) async throws -> Bool + @available(tvOS 10, *) func cancel() } @available(tvOS 10, tvOS 10, *) diff --git a/tvOS/Photos/PHPhotoLibrary.swift b/tvOS/Photos/PHPhotoLibrary.swift index 63feddc..ddfa53f 100644 --- a/tvOS/Photos/PHPhotoLibrary.swift +++ b/tvOS/Photos/PHPhotoLibrary.swift @@ -54,6 +54,8 @@ class PHPhotoLibrary : NSObject { @available(tvOS 10, *) func performChanges(_ changeBlock: @escaping () -> Void, completionHandler: ((Bool, Error?) -> Void)? = nil) @available(tvOS 10, *) + func performChanges(_ changeBlock: @escaping () -> Void) async throws -> Bool + @available(tvOS 10, *) func performChangesAndWait(_ changeBlock: @escaping () -> Void) throws @available(tvOS 10, *) func register(_ observer: PHPhotoLibraryChangeObserver) diff --git a/tvOS/ReplayKit/RPBroadcastExtension.swift b/tvOS/ReplayKit/RPBroadcastExtension.swift index f5b1fc1..8ab685a 100644 --- a/tvOS/ReplayKit/RPBroadcastExtension.swift +++ b/tvOS/ReplayKit/RPBroadcastExtension.swift @@ -1,6 +1,7 @@ extension NSExtensionContext { func loadBroadcastingApplicationInfo(completion handler: @escaping (String, String, UIImage?) -> Void) + func loadBroadcastingApplicationInfo() async -> (String, String, UIImage?) @available(tvOS, introduced: 10.0, deprecated: 11.0, message: "No longer supported") func completeRequest(withBroadcast broadcastURL: URL, broadcastConfiguration: RPBroadcastConfiguration, setupInfo: [String : NSCoding & NSObjectProtocol]?) @available(tvOS 11.0, *) diff --git a/tvOS/ReplayKit/RPScreenRecorder.swift b/tvOS/ReplayKit/RPScreenRecorder.swift index 70f2463..a6c7a4f 100644 --- a/tvOS/ReplayKit/RPScreenRecorder.swift +++ b/tvOS/ReplayKit/RPScreenRecorder.swift @@ -8,10 +8,14 @@ class RPScreenRecorder : NSObject { func stopRecording(handler: ((RPPreviewViewController?, Error?) -> Void)? = nil) @available(tvOS 14.0, *) func stopRecording(withOutput url: URL, completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 14.0, *) + func stopRecording(withOutput url: URL) async throws func discardRecording(handler: @escaping () -> Void) @available(tvOS 11.0, *) func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?, completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 11.0, *) + func startCapture(handler captureHandler: ((CMSampleBuffer, RPSampleBufferType, Error?) -> Void)?) async throws + @available(tvOS 11.0, *) func stopCapture(handler: ((Error?) -> Void)? = nil) weak var delegate: @sil_weak RPScreenRecorderDelegate? var isAvailable: Bool { get } diff --git a/tvOS/SceneKit/SCNAction.swift b/tvOS/SceneKit/SCNAction.swift index cc6256d..8a89838 100644 --- a/tvOS/SceneKit/SCNAction.swift +++ b/tvOS/SceneKit/SCNAction.swift @@ -3,8 +3,10 @@ typealias SCNActionTimingFunction = (Float) -> Float protocol SCNActionable : NSObjectProtocol { func runAction(_ action: SCNAction) func runAction(_ action: SCNAction, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction) async func runAction(_ action: SCNAction, forKey key: String?) func runAction(_ action: SCNAction, forKey key: String?, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction, forKey key: String?) async var hasActions: Bool { get } func action(forKey key: String) -> SCNAction? func removeAction(forKey key: String) diff --git a/tvOS/SceneKit/SCNSceneRenderer.swift b/tvOS/SceneKit/SCNSceneRenderer.swift index 37e5939..2b70ec2 100644 --- a/tvOS/SceneKit/SCNSceneRenderer.swift +++ b/tvOS/SceneKit/SCNSceneRenderer.swift @@ -53,6 +53,7 @@ protocol SCNSceneRenderer : NSObjectProtocol { var isTemporalAntialiasingEnabled: Bool { get set } func prepare(_ object: Any, shouldAbortBlock block: (() -> Bool)? = nil) -> Bool func prepare(_ objects: [Any], completionHandler: ((Bool) -> Void)? = nil) + func prepare(_ objects: [Any]) async -> Bool var showsStatistics: Bool { get set } @available(tvOS 9.0, *) var debugOptions: SCNDebugOptions { get set } diff --git a/tvOS/SoundAnalysis/SNAnalyzer.swift b/tvOS/SoundAnalysis/SNAnalyzer.swift index add2d7c..db4f2c1 100644 --- a/tvOS/SoundAnalysis/SNAnalyzer.swift +++ b/tvOS/SoundAnalysis/SNAnalyzer.swift @@ -16,5 +16,6 @@ class SNAudioFileAnalyzer : NSObject { func removeAllRequests() func analyze() func analyze(completionHandler: @escaping (Bool) -> Void) + func analyze() async -> Bool func cancelAnalysis() } diff --git a/tvOS/SpriteKit/SKNode.swift b/tvOS/SpriteKit/SKNode.swift index 3999da0..f8699e8 100644 --- a/tvOS/SpriteKit/SKNode.swift +++ b/tvOS/SpriteKit/SKNode.swift @@ -65,6 +65,7 @@ class SKNode : UIResponder, NSCopying, NSSecureCoding, UIFocusItem { func inParentHierarchy(_ parent: SKNode) -> Bool func run(_ action: SKAction) func run(_ action: SKAction, completion block: @escaping () -> Void) + func run(_ action: SKAction) async func run(_ action: SKAction, withKey key: String) func hasActions() -> Bool func action(forKey key: String) -> SKAction? diff --git a/tvOS/SpriteKit/SKTexture.swift b/tvOS/SpriteKit/SKTexture.swift index 665bd22..eb9bb3d 100644 --- a/tvOS/SpriteKit/SKTexture.swift +++ b/tvOS/SpriteKit/SKTexture.swift @@ -30,7 +30,9 @@ class SKTexture : NSObject, NSCopying, NSSecureCoding { @available(tvOS 9.0, *) func cgImage() -> CGImage class func preload(_ textures: [SKTexture], withCompletionHandler completionHandler: @escaping () -> Void) + class func preload(_ textures: [SKTexture]) async func preload(completionHandler: @escaping () -> Void) + func preload() async } extension SKTexture : _CustomPlaygroundQuickLookable { diff --git a/tvOS/SpriteKit/SKTextureAtlas.swift b/tvOS/SpriteKit/SKTextureAtlas.swift index 3cd5ae1..69b4d4e 100644 --- a/tvOS/SpriteKit/SKTextureAtlas.swift +++ b/tvOS/SpriteKit/SKTextureAtlas.swift @@ -5,9 +5,13 @@ class SKTextureAtlas : NSObject, NSSecureCoding { convenience init(dictionary properties: [String : Any]) func textureNamed(_ name: String) -> SKTexture class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas], withCompletionHandler completionHandler: @escaping () -> Void) + class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas]) async @available(tvOS 9.0, *) class func preloadTextureAtlasesNamed(_ atlasNames: [String], withCompletionHandler completionHandler: @escaping (Error?, [SKTextureAtlas]) -> Void) + @available(tvOS 9.0, *) + class func preloadTextureAtlasesNamed(_ atlasNames: [String]) async throws -> [SKTextureAtlas] func preload(completionHandler: @escaping () -> Void) + func preload() async var textureNames: [String] { get } } diff --git a/tvOS/StoreKit/SKCloudServiceController.swift b/tvOS/StoreKit/SKCloudServiceController.swift index c239454..e61813c 100644 --- a/tvOS/StoreKit/SKCloudServiceController.swift +++ b/tvOS/StoreKit/SKCloudServiceController.swift @@ -25,14 +25,24 @@ class SKCloudServiceController : NSObject { class func requestAuthorization(_ handler: @escaping (SKCloudServiceAuthorizationStatus) -> Void) @available(tvOS 9.3, *) func requestCapabilities(completionHandler: @escaping (SKCloudServiceCapability, Error?) -> Void) + @available(tvOS 9.3, *) + func requestCapabilities() async throws -> SKCloudServiceCapability @available(tvOS 11.0, *) func requestStorefrontCountryCode(completionHandler: @escaping (String?, Error?) -> Void) + @available(tvOS 11.0, *) + func requestStorefrontCountryCode() async throws -> String @available(tvOS 9.3, *) func requestStorefrontIdentifier(completionHandler: @escaping (String?, Error?) -> Void) + @available(tvOS 9.3, *) + func requestStorefrontIdentifier() async throws -> String @available(tvOS 11.0, *) func requestUserToken(forDeveloperToken developerToken: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(tvOS 11.0, *) + func requestUserToken(forDeveloperToken developerToken: String) async throws -> String @available(tvOS, introduced: 10.3, deprecated: 11.0) func requestPersonalizationToken(forClientToken clientToken: String, withCompletionHandler completionHandler: @escaping (String?, Error?) -> Void) + @available(tvOS, introduced: 10.3, deprecated: 11.0) + func requestPersonalizationToken(forClientToken clientToken: String) async throws -> String } extension NSNotification.Name { @available(tvOS 9.3, *) diff --git a/tvOS/StoreKit/SKProductStorePromotionController.swift b/tvOS/StoreKit/SKProductStorePromotionController.swift index be59fdb..2ab5183 100644 --- a/tvOS/StoreKit/SKProductStorePromotionController.swift +++ b/tvOS/StoreKit/SKProductStorePromotionController.swift @@ -14,9 +14,17 @@ class SKProductStorePromotionController : NSObject { @available(tvOS 11.0, *) func fetchStorePromotionVisibility(for product: SKProduct, completionHandler: ((SKProductStorePromotionVisibility, Error?) -> Void)? = nil) @available(tvOS 11.0, *) + func fetchStorePromotionVisibility(for product: SKProduct) async throws -> SKProductStorePromotionVisibility + @available(tvOS 11.0, *) func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct, completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 11.0, *) + func update(storePromotionVisibility promotionVisibility: SKProductStorePromotionVisibility, for product: SKProduct) async throws + @available(tvOS 11.0, *) func fetchStorePromotionOrder(completionHandler: (([SKProduct], Error?) -> Void)? = nil) @available(tvOS 11.0, *) + func fetchStorePromotionOrder() async throws -> [SKProduct] + @available(tvOS 11.0, *) func update(storePromotionOrder: [SKProduct], completionHandler: ((Error?) -> Void)? = nil) + @available(tvOS 11.0, *) + func update(storePromotionOrder: [SKProduct]) async throws } diff --git a/tvOS/SwiftUI/SwiftUI.swift b/tvOS/SwiftUI/SwiftUI.swift index 77a6cf7..286ce84 100644 --- a/tvOS/SwiftUI/SwiftUI.swift +++ b/tvOS/SwiftUI/SwiftUI.swift @@ -3031,7 +3031,7 @@ extension Scene { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct SceneBuilder { +@resultBuilder struct SceneBuilder { static func buildBlock(_ content: Content) -> Content where Content : Scene } @@ -3614,7 +3614,7 @@ extension ToolbarContent { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct ToolbarContentBuilder { +@resultBuilder struct ToolbarContentBuilder { static func buildBlock(_ content: Content) -> some ToolbarContent where Content : ToolbarContent static func buildBlock(_ content: Content) -> some CustomizableToolbarContent where Content : CustomizableToolbarContent @@ -5085,7 +5085,7 @@ extension View { } @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) -@_functionBuilder struct ViewBuilder { +@resultBuilder struct ViewBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyView @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : View } diff --git a/tvOS/TVMLKit/TVApplicationController.swift b/tvOS/TVMLKit/TVApplicationController.swift index 6e61d1c..e4f9285 100644 --- a/tvOS/TVMLKit/TVApplicationController.swift +++ b/tvOS/TVMLKit/TVApplicationController.swift @@ -27,5 +27,6 @@ class TVApplicationController : NSObject { weak var delegate: @sil_weak TVApplicationControllerDelegate? { get } var navigationController: UINavigationController { get } func evaluate(inJavaScriptContext evaluation: @escaping (JSContext) -> Void, completion: ((Bool) -> Void)? = nil) + func evaluate(inJavaScriptContext evaluation: @escaping (JSContext) -> Void) async -> Bool func stop() } diff --git a/tvOS/TVMLKit/TVPlayback.swift b/tvOS/TVMLKit/TVPlayback.swift index a8ef416..04a938e 100644 --- a/tvOS/TVMLKit/TVPlayback.swift +++ b/tvOS/TVMLKit/TVPlayback.swift @@ -134,6 +134,7 @@ class TVPlayer : NSObject { var nextMediaItem: TVMediaItem? { get } var previousMediaItem: TVMediaItem? { get } func dispatch(event: TVPlaybackEvent, userInfo: TVPlaybackEventMarshaling?, completion: ((Bool) -> Void)? = nil) + func dispatch(event: TVPlaybackEvent, userInfo: TVPlaybackEventMarshaling?) async -> Bool func pause() func next() func previous() diff --git a/tvOS/TVMLKit/TVViewElement.swift b/tvOS/TVMLKit/TVViewElement.swift index 18425ee..3b07e2e 100644 --- a/tvOS/TVMLKit/TVViewElement.swift +++ b/tvOS/TVMLKit/TVViewElement.swift @@ -43,5 +43,7 @@ class TVViewElement : NSObject, NSCopying { @available(tvOS 9.0, *) func resetProperty(_ resettableProperty: TVElementResettableProperty) func dispatchEvent(type: TVElementEventType, canBubble: Bool, cancellable isCancellable: Bool, extraInfo: [String : Any]?, completion: ((Bool, Bool) -> Void)? = nil) + func dispatchEvent(type: TVElementEventType, canBubble: Bool, cancellable isCancellable: Bool, extraInfo: [String : Any]?) async -> (Bool, Bool) func dispatchEvent(name eventName: String, canBubble: Bool, cancellable isCancellable: Bool, extraInfo: [String : Any]?, completion: ((Bool, Bool) -> Void)? = nil) + func dispatchEvent(name eventName: String, canBubble: Bool, cancellable isCancellable: Bool, extraInfo: [String : Any]?) async -> (Bool, Bool) } diff --git a/tvOS/TVServices/TVTopShelfContentProvider.swift b/tvOS/TVServices/TVTopShelfContentProvider.swift index 0509d92..d04c3b6 100644 --- a/tvOS/TVServices/TVTopShelfContentProvider.swift +++ b/tvOS/TVServices/TVTopShelfContentProvider.swift @@ -2,5 +2,6 @@ @available(tvOS 13.0, *) class TVTopShelfContentProvider : NSObject { func loadTopShelfContent(completionHandler: @escaping (TVTopShelfContent?) -> Void) + func loadTopShelfContent() async -> TVTopShelfContent? class func topShelfContentDidChange() } diff --git a/tvOS/TVServices/TVUserManager.swift b/tvOS/TVServices/TVUserManager.swift index 73bc4d0..1c01a83 100644 --- a/tvOS/TVServices/TVUserManager.swift +++ b/tvOS/TVServices/TVUserManager.swift @@ -5,7 +5,9 @@ class TVUserManager : NSObject { var currentUserIdentifier: TVUserIdentifier? { get } var userIdentifiersForCurrentProfile: [TVUserIdentifier] func presentProfilePreferencePanel(currentSettings: [TVUserIdentifier : TVAppProfileDescriptor], availableProfiles: [TVAppProfileDescriptor], completion: @escaping ([TVUserIdentifier : TVAppProfileDescriptor]) -> Void) + func presentProfilePreferencePanel(currentSettings: [TVUserIdentifier : TVAppProfileDescriptor], availableProfiles: [TVAppProfileDescriptor]) async -> [TVUserIdentifier : TVAppProfileDescriptor] func shouldStorePreferenceForCurrentUser(to profile: TVAppProfileDescriptor, completion: @escaping (Bool) -> Void) + func shouldStorePreferenceForCurrentUser(to profile: TVAppProfileDescriptor) async -> Bool } extension TVUserManager { class let currentUserIdentifierDidChangeNotification: NSNotification.Name diff --git a/tvOS/UIKit/UIApplication.swift b/tvOS/UIKit/UIApplication.swift index fe759ef..b25d14b 100644 --- a/tvOS/UIKit/UIApplication.swift +++ b/tvOS/UIKit/UIApplication.swift @@ -44,6 +44,8 @@ class UIApplication : UIResponder { func canOpenURL(_ url: URL) -> Bool @available(tvOS 10.0, *) func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil) + @available(tvOS 10.0, *) + func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:]) async -> Bool func sendEvent(_ event: UIEvent) @available(tvOS, introduced: 2.0, deprecated: 13.0, message: "Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes") var keyWindow: UIWindow? { get } @@ -111,6 +113,8 @@ extension UIApplication { @available(tvOS 10.2, *) func setAlternateIconName(_ alternateIconName: String?, completionHandler: ((Error?) -> Void)? = nil) @available(tvOS 10.2, *) + func setAlternateIconName(_ alternateIconName: String?) async throws + @available(tvOS 10.2, *) var alternateIconName: String? { get } } extension UIApplication { @@ -204,12 +208,20 @@ protocol UIApplicationDelegate : NSObjectProtocol { optional func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) @available(tvOS 7.0, *) optional func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) + @available(tvOS 7.0, *) + optional func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult @available(tvOS, introduced: 11.0, deprecated: 13.0, message: "Use a BGAppRefreshTask in the BackgroundTasks framework instead") optional func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) + @available(tvOS, introduced: 11.0, deprecated: 13.0, message: "Use a BGAppRefreshTask in the BackgroundTasks framework instead") + optional func applicationPerformFetch(_ application: UIApplication) async -> UIBackgroundFetchResult @available(tvOS 7.0, *) optional func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) + @available(tvOS 7.0, *) + optional func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String) async @available(tvOS 8.2, *) optional func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?, reply: @escaping ([AnyHashable : Any]?) -> Void) + @available(tvOS 8.2, *) + optional func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?) async -> [AnyHashable : Any]? @available(tvOS 9.0, *) optional func applicationShouldRequestHealthAuthorization(_ application: UIApplication) @available(tvOS 4.0, *) diff --git a/tvOS/UIKit/UICollectionView.swift b/tvOS/UIKit/UICollectionView.swift index 928ba13..69fbbc7 100644 --- a/tvOS/UIKit/UICollectionView.swift +++ b/tvOS/UIKit/UICollectionView.swift @@ -119,6 +119,8 @@ class UICollectionView : UIScrollView, UIDataSourceTranslating { @available(tvOS 7.0, *) func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool, completion: ((Bool) -> Void)? = nil) @available(tvOS 7.0, *) + func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool) async -> Bool + @available(tvOS 7.0, *) func startInteractiveTransition(to layout: UICollectionViewLayout, completion: UICollectionView.LayoutInteractiveTransitionCompletion? = nil) -> UICollectionViewTransitionLayout @available(tvOS 7.0, *) func finishInteractiveTransition() @@ -149,6 +151,7 @@ class UICollectionView : UIScrollView, UIDataSourceTranslating { func reloadItems(at indexPaths: [IndexPath]) func moveItem(at indexPath: IndexPath, to newIndexPath: IndexPath) func performBatchUpdates(_ updates: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + func performBatchUpdates(_ updates: (() -> Void)?) async -> Bool @available(tvOS 9.0, *) func beginInteractiveMovementForItem(at indexPath: IndexPath) -> Bool @available(tvOS 9.0, *) diff --git a/tvOS/UIKit/UIDiffableDataSource.swift b/tvOS/UIKit/UIDiffableDataSource.swift index 1131b06..3a7457e 100644 --- a/tvOS/UIKit/UIDiffableDataSource.swift +++ b/tvOS/UIKit/UIDiffableDataSource.swift @@ -64,6 +64,7 @@ class UICollectionViewDiffableDataSourceReference : NSObject, UICollectionViewDa func snapshot() -> NSDiffableDataSourceSnapshotReference func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool, completion: (() -> Void)? = nil) + func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) async func itemIdentifier(for indexPath: IndexPath) -> Any? func indexPath(forItemIdentifier identifier: Any) -> IndexPath? @available(tvOS 14.0, *) @@ -73,6 +74,8 @@ class UICollectionViewDiffableDataSourceReference : NSObject, UICollectionViewDa @available(tvOS 14.0, *) func applySnapshot(_ snapshot: NSDiffableDataSourceSectionSnapshotReference, toSection sectionIdentifier: Any, animatingDifferences: Bool, completion: (() -> Void)? = nil) @available(tvOS 14.0, *) + func applySnapshot(_ snapshot: NSDiffableDataSourceSectionSnapshotReference, toSection sectionIdentifier: Any, animatingDifferences: Bool) async + @available(tvOS 14.0, *) func snapshot(forSection section: Any) -> NSDiffableDataSourceSectionSnapshotReference @available(tvOS 14.0, *) @NSCopying var sectionSnapshotHandlers: __UICollectionViewDiffableDataSourceSectionSnapshotHandlers @@ -84,6 +87,7 @@ class UITableViewDiffableDataSourceReference : NSObject, UITableViewDataSource { func snapshot() -> NSDiffableDataSourceSnapshotReference func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool, completion: (() -> Void)? = nil) + func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool) async func itemIdentifier(for indexPath: IndexPath) -> Any? func indexPath(forItemIdentifier identifier: Any) -> IndexPath? var defaultRowAnimation: UITableView.RowAnimation diff --git a/tvOS/UIKit/UIFocusAnimationCoordinator.swift b/tvOS/UIKit/UIFocusAnimationCoordinator.swift index 3d2b16e..fe0b370 100644 --- a/tvOS/UIKit/UIFocusAnimationCoordinator.swift +++ b/tvOS/UIKit/UIFocusAnimationCoordinator.swift @@ -6,8 +6,13 @@ protocol UIFocusAnimationContext : NSObjectProtocol { @available(tvOS 9.0, *) class UIFocusAnimationCoordinator : NSObject { func addCoordinatedAnimations(_ animations: (() -> Void)?, completion: (() -> Void)? = nil) + func addCoordinatedAnimations(_ animations: (() -> Void)?) async @available(tvOS 11.0, *) func addCoordinatedFocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?, completion: (() -> Void)? = nil) @available(tvOS 11.0, *) + func addCoordinatedFocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?) async + @available(tvOS 11.0, *) func addCoordinatedUnfocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?, completion: (() -> Void)? = nil) + @available(tvOS 11.0, *) + func addCoordinatedUnfocusingAnimations(_ animations: ((UIFocusAnimationContext) -> Void)?) async } diff --git a/tvOS/UIKit/UIInputViewController.swift b/tvOS/UIKit/UIInputViewController.swift index 23f4827..06b8e99 100644 --- a/tvOS/UIKit/UIInputViewController.swift +++ b/tvOS/UIKit/UIInputViewController.swift @@ -28,4 +28,5 @@ class UIInputViewController : UIViewController, UITextInputDelegate { @available(tvOS 10.0, *) func handleInputModeList(from view: UIView, with event: UIEvent) func requestSupplementaryLexicon(completion completionHandler: @escaping (UILexicon) -> Void) + func requestSupplementaryLexicon() async -> UILexicon } diff --git a/tvOS/UIKit/UIPageViewController.swift b/tvOS/UIKit/UIPageViewController.swift index c349f6c..c2fe741 100644 --- a/tvOS/UIKit/UIPageViewController.swift +++ b/tvOS/UIKit/UIPageViewController.swift @@ -49,6 +49,7 @@ class UIPageViewController : UIViewController { var gestureRecognizers: [UIGestureRecognizer] { get } var viewControllers: [UIViewController]? { get } func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) + func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool) async -> Bool } protocol UIPageViewControllerDelegate : NSObjectProtocol { @available(tvOS 6.0, *) diff --git a/tvOS/UIKit/UIScene.swift b/tvOS/UIKit/UIScene.swift index e7e4b94..b07ce8c 100644 --- a/tvOS/UIKit/UIScene.swift +++ b/tvOS/UIKit/UIScene.swift @@ -6,6 +6,7 @@ class UIScene : UIResponder { var delegate: UISceneDelegate? var activationState: UIScene.ActivationState { get } func open(_ url: URL, options: UIScene.OpenExternalURLOptions?, completionHandler completion: ((Bool) -> Void)? = nil) + func open(_ url: URL, options: UIScene.OpenExternalURLOptions?) async -> Bool var title: String! var activationConditions: UISceneActivationConditions } diff --git a/tvOS/UIKit/UIScreenshotService.swift b/tvOS/UIKit/UIScreenshotService.swift index 63a54c0..27f3af8 100644 --- a/tvOS/UIKit/UIScreenshotService.swift +++ b/tvOS/UIKit/UIScreenshotService.swift @@ -11,4 +11,6 @@ extension UIWindowScene { protocol UIScreenshotServiceDelegate : NSObjectProtocol { @available(tvOS 13.0, *) optional func screenshotService(_ screenshotService: UIScreenshotService, generatePDFRepresentationWithCompletion completionHandler: @escaping (Data?, Int, CGRect) -> Void) + @available(tvOS 13.0, *) + optional func screenshotServiceGeneratePDFRepresentation(_ screenshotService: UIScreenshotService) async -> (Data?, Int, CGRect) } diff --git a/tvOS/UIKit/UITableView.swift b/tvOS/UIKit/UITableView.swift index 3958bd1..e7fac53 100644 --- a/tvOS/UIKit/UITableView.swift +++ b/tvOS/UIKit/UITableView.swift @@ -154,6 +154,8 @@ class UITableView : UIScrollView, NSCoding, UIDataSourceTranslating { func scrollToNearestSelectedRow(at scrollPosition: UITableView.ScrollPosition, animated: Bool) @available(tvOS 11.0, *) func performBatchUpdates(_ updates: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + @available(tvOS 11.0, *) + func performBatchUpdates(_ updates: (() -> Void)?) async -> Bool func beginUpdates() func endUpdates() func insertSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) diff --git a/tvOS/UIKit/UIView.swift b/tvOS/UIKit/UIView.swift index 8942c21..803d011 100644 --- a/tvOS/UIKit/UIView.swift +++ b/tvOS/UIKit/UIView.swift @@ -245,17 +245,29 @@ extension UIView { @available(tvOS 4.0, *) class func animate(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(tvOS 4.0, *) + class func animate(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.AnimationOptions = [], animations: @escaping () -> Void) async -> Bool + @available(tvOS 4.0, *) class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(tvOS 4.0, *) + class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void) async -> Bool + @available(tvOS 4.0, *) class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void) @available(tvOS 7.0, *) class func animate(withDuration duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping dampingRatio: CGFloat, initialSpringVelocity velocity: CGFloat, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) + @available(tvOS 7.0, *) + class func animate(withDuration duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping dampingRatio: CGFloat, initialSpringVelocity velocity: CGFloat, options: UIView.AnimationOptions = [], animations: @escaping () -> Void) async -> Bool @available(tvOS 4.0, *) class func transition(with view: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) @available(tvOS 4.0, *) + class func transition(with view: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?) async -> Bool + @available(tvOS 4.0, *) class func transition(from fromView: UIView, to toView: UIView, duration: TimeInterval, options: UIView.AnimationOptions = [], completion: ((Bool) -> Void)? = nil) + @available(tvOS 4.0, *) + class func transition(from fromView: UIView, to toView: UIView, duration: TimeInterval, options: UIView.AnimationOptions = []) async -> Bool @available(tvOS 7.0, *) class func perform(_ animation: UIView.SystemAnimation, on views: [UIView], options: UIView.AnimationOptions = [], animations parallelAnimations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) + @available(tvOS 7.0, *) + class func perform(_ animation: UIView.SystemAnimation, on views: [UIView], options: UIView.AnimationOptions = [], animations parallelAnimations: (() -> Void)?) async -> Bool @available(tvOS 12.0, *) class func modifyAnimations(withRepeatCount count: CGFloat, autoreverses: Bool, animations: () -> Void) } @@ -263,6 +275,8 @@ extension UIView { @available(tvOS 7.0, *) class func animateKeyframes(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.KeyframeAnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) @available(tvOS 7.0, *) + class func animateKeyframes(withDuration duration: TimeInterval, delay: TimeInterval, options: UIView.KeyframeAnimationOptions = [], animations: @escaping () -> Void) async -> Bool + @available(tvOS 7.0, *) class func addKeyframe(withRelativeStartTime frameStartTime: Double, relativeDuration frameDuration: Double, animations: @escaping () -> Void) } extension UIView { diff --git a/tvOS/UIKit/UIViewAnimating.swift b/tvOS/UIKit/UIViewAnimating.swift index eeac151..16d3934 100644 --- a/tvOS/UIKit/UIViewAnimating.swift +++ b/tvOS/UIKit/UIViewAnimating.swift @@ -33,5 +33,7 @@ protocol UIViewImplicitlyAnimating : UIViewAnimating { optional func addAnimations(_ animation: @escaping () -> Void) @available(tvOS 10.0, *) optional func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void) + @available(tvOS 10.0, *) + optional func addCompletion() async -> UIViewAnimatingPosition optional func continueAnimation(withTimingParameters parameters: UITimingCurveProvider?, durationFactor: CGFloat) } diff --git a/tvOS/UIKit/UIViewController.swift b/tvOS/UIKit/UIViewController.swift index a603f03..16eeb41 100644 --- a/tvOS/UIKit/UIViewController.swift +++ b/tvOS/UIKit/UIViewController.swift @@ -112,7 +112,11 @@ class UIViewController : UIResponder, NSCoding, UIAppearanceContainer, UITraitEn @available(tvOS 5.0, *) func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) @available(tvOS 5.0, *) + func present(_ viewControllerToPresent: UIViewController, animated flag: Bool) async + @available(tvOS 5.0, *) func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) + @available(tvOS 5.0, *) + func dismiss(animated flag: Bool) async @available(tvOS 3.0, *) var modalTransitionStyle: UIModalTransitionStyle @available(tvOS 3.2, *) @@ -157,6 +161,8 @@ extension UIViewController { @available(tvOS 5.0, *) func transition(from fromViewController: UIViewController, to toViewController: UIViewController, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil) @available(tvOS 5.0, *) + func transition(from fromViewController: UIViewController, to toViewController: UIViewController, duration: TimeInterval, options: UIView.AnimationOptions = [], animations: (() -> Void)?) async -> Bool + @available(tvOS 5.0, *) func beginAppearanceTransition(_ isAppearing: Bool, animated: Bool) @available(tvOS 5.0, *) func endAppearanceTransition() diff --git a/tvOS/UserNotifications/UNUserNotificationCenter.swift b/tvOS/UserNotifications/UNUserNotificationCenter.swift index 73df3b8..7009d99 100644 --- a/tvOS/UserNotifications/UNUserNotificationCenter.swift +++ b/tvOS/UserNotifications/UNUserNotificationCenter.swift @@ -20,9 +20,13 @@ class UNUserNotificationCenter : NSObject { var supportsContentExtensions: Bool { get } class func current() -> UNUserNotificationCenter func requestAuthorization(options: UNAuthorizationOptions = [], completionHandler: @escaping (Bool, Error?) -> Void) + func requestAuthorization(options: UNAuthorizationOptions = []) async throws -> Bool func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void) + func notificationSettings() async -> UNNotificationSettings func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func add(_ request: UNNotificationRequest) async throws func getPendingNotificationRequests(completionHandler: @escaping ([UNNotificationRequest]) -> Void) + func pendingNotificationRequests() async -> [UNNotificationRequest] func removePendingNotificationRequests(withIdentifiers identifiers: [String]) func removeAllPendingNotificationRequests() } @@ -43,4 +47,6 @@ struct UNNotificationPresentationOptions : OptionSet { protocol UNUserNotificationCenterDelegate : NSObjectProtocol { @available(tvOS 10.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) + @available(tvOS 10.0, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions } diff --git a/tvOS/VideoSubscriberAccount/VSAccountManager.swift b/tvOS/VideoSubscriberAccount/VSAccountManager.swift index 86f0875..cca32d3 100644 --- a/tvOS/VideoSubscriberAccount/VSAccountManager.swift +++ b/tvOS/VideoSubscriberAccount/VSAccountManager.swift @@ -24,6 +24,7 @@ extension VSCheckAccessOption { class VSAccountManager : NSObject { weak var delegate: @sil_weak VSAccountManagerDelegate? func checkAccessStatus(options: [VSCheckAccessOption : Any] = [:], completionHandler: @escaping (VSAccountAccessStatus, Error?) -> Void) + func checkAccessStatus(options: [VSCheckAccessOption : Any] = [:]) async throws -> VSAccountAccessStatus func enqueue(_ request: VSAccountMetadataRequest, completionHandler: @escaping (VSAccountMetadata?, Error?) -> Void) -> VSAccountManagerResult } @available(tvOS 10.0, *) diff --git a/watchOS/AVFoundation/AVAsynchronousKeyValueLoading.swift b/watchOS/AVFoundation/AVAsynchronousKeyValueLoading.swift index a340868..22888c5 100644 --- a/watchOS/AVFoundation/AVAsynchronousKeyValueLoading.swift +++ b/watchOS/AVFoundation/AVAsynchronousKeyValueLoading.swift @@ -11,4 +11,5 @@ enum AVKeyValueStatus : Int { protocol AVAsynchronousKeyValueLoading { func statusOfValue(forKey key: String, error outError: NSErrorPointer) -> AVKeyValueStatus func loadValuesAsynchronously(forKeys keys: [String], completionHandler handler: (() -> Void)? = nil) + func loadValues(forKeys keys: [String]) async } diff --git a/watchOS/AVFoundation/AVCaptureDevice.swift b/watchOS/AVFoundation/AVCaptureDevice.swift index 3b7bd8c..8287f9b 100644 --- a/watchOS/AVFoundation/AVCaptureDevice.swift +++ b/watchOS/AVFoundation/AVCaptureDevice.swift @@ -64,6 +64,8 @@ extension AVCaptureDevice { var lensPosition: Float { get } @available(watchOS 2.0, *) func setFocusModeLocked(lensPosition: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(watchOS 2.0, *) + func setFocusModeLocked(lensPosition: Float) async -> CMTime } extension AVCaptureDevice { func isExposureModeSupported(_ exposureMode: AVCaptureDevice.ExposureMode) -> Bool @@ -80,6 +82,8 @@ extension AVCaptureDevice { @available(watchOS 2.0, *) func setExposureModeCustom(duration: CMTime, iso ISO: Float, completionHandler handler: ((CMTime) -> Void)? = nil) @available(watchOS 2.0, *) + func setExposureModeCustom(duration: CMTime, iso ISO: Float) async -> CMTime + @available(watchOS 2.0, *) var exposureTargetOffset: Float { get } @available(watchOS 2.0, *) var exposureTargetBias: Float { get } @@ -89,6 +93,8 @@ extension AVCaptureDevice { var maxExposureTargetBias: Float { get } @available(watchOS 2.0, *) func setExposureTargetBias(_ bias: Float, completionHandler handler: ((CMTime) -> Void)? = nil) + @available(watchOS 2.0, *) + func setExposureTargetBias(_ bias: Float) async -> CMTime } extension AVCaptureDevice { } @@ -107,6 +113,8 @@ extension AVCaptureDevice { @available(watchOS 2.0, *) func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains, completionHandler handler: ((CMTime) -> Void)? = nil) @available(watchOS 2.0, *) + func setWhiteBalanceModeLocked(with whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) async -> CMTime + @available(watchOS 2.0, *) func chromaticityValues(for whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains) -> AVCaptureDevice.WhiteBalanceChromaticityValues @available(watchOS 2.0, *) func deviceWhiteBalanceGains(for chromaticityValues: AVCaptureDevice.WhiteBalanceChromaticityValues) -> AVCaptureDevice.WhiteBalanceGains @@ -144,6 +152,8 @@ extension AVCaptureDevice { class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus @available(watchOS 2.0, *) class func requestAccess(for mediaType: AVMediaType, completionHandler handler: @escaping (Bool) -> Void) + @available(watchOS 2.0, *) + class func requestAccess(for mediaType: AVMediaType) async -> Bool } extension AVCaptureDevice { } diff --git a/watchOS/AVFoundation/AVCaptureStillImageOutput.swift b/watchOS/AVFoundation/AVCaptureStillImageOutput.swift index 3f593ce..24d8790 100644 --- a/watchOS/AVFoundation/AVCaptureStillImageOutput.swift +++ b/watchOS/AVFoundation/AVCaptureStillImageOutput.swift @@ -8,6 +8,10 @@ extension AVCaptureStillImageOutput { var isLensStabilizationDuringBracketedCaptureEnabled: Bool @available(watchOS, introduced: 2.0, deprecated: 3.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (Bool, Error?) -> Void) + @available(watchOS, introduced: 2.0, deprecated: 3.0, message: "Use AVCapturePhotoOutput setPreparedPhotoSettingsArray:completionHandler: instead.") + func prepareToCaptureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> Bool @available(watchOS, introduced: 2.0, deprecated: 3.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") func captureStillImageBracketAsynchronously(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings], completionHandler handler: @escaping (CMSampleBuffer?, AVCaptureBracketedStillImageSettings?, Error?) -> Void) + @available(watchOS, introduced: 2.0, deprecated: 3.0, message: "Use AVCapturePhotoOutput capturePhotoWithSettings:delegate: instead.") + func captureStillImageBracket(from connection: AVCaptureConnection, withSettingsArray settings: [AVCaptureBracketedStillImageSettings]) async throws -> (CMSampleBuffer, AVCaptureBracketedStillImageSettings) } diff --git a/watchOS/AVFoundation/AVContentKeySession.swift b/watchOS/AVFoundation/AVContentKeySession.swift index 8a2670e..f87daea 100644 --- a/watchOS/AVFoundation/AVContentKeySession.swift +++ b/watchOS/AVFoundation/AVContentKeySession.swift @@ -30,9 +30,15 @@ class AVContentKeySession : NSObject { @available(watchOS 7.0, *) func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data, completionHandler handler: @escaping (Data?, Error?) -> Void) @available(watchOS 7.0, *) + func makeSecureTokenForExpirationDate(ofPersistableContentKey persistableContentKeyData: Data) async throws -> Data + @available(watchOS 7.0, *) func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) @available(watchOS 7.0, *) + func invalidatePersistableContentKey(_ persistableContentKeyData: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data + @available(watchOS 7.0, *) func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + @available(watchOS 7.0, *) + func invalidateAllPersistableContentKeys(forApp appIdentifier: Data, options: [AVContentKeySessionServerPlaybackContextOption : Any]? = nil) async throws -> Data } struct AVContentKeySessionServerPlaybackContextOption : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(rawValue: String) @@ -106,6 +112,7 @@ class AVContentKeyRequest : NSObject { var options: [String : Any] { get } var canProvidePersistableContentKey: Bool { get } func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil, completionHandler handler: @escaping (Data?, Error?) -> Void) + func makeStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil) async throws -> Data func processContentKeyResponse(_ keyResponse: AVContentKeyResponse) func processContentKeyResponseError(_ error: Error) @available(watchOS 7.0, *) diff --git a/watchOS/AVFoundation/AVPlayer.swift b/watchOS/AVFoundation/AVPlayer.swift index d8a9082..c8669ca 100644 --- a/watchOS/AVFoundation/AVPlayer.swift +++ b/watchOS/AVFoundation/AVPlayer.swift @@ -64,12 +64,18 @@ extension AVPlayer { func seek(to date: Date) @available(watchOS 1.0, *) func seek(to date: Date, completionHandler: @escaping (Bool) -> Void) + @available(watchOS 1.0, *) + func seek(to date: Date) async -> Bool func seek(to time: CMTime) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) @available(watchOS 1.0, *) func seek(to time: CMTime, completionHandler: @escaping (Bool) -> Void) @available(watchOS 1.0, *) + func seek(to time: CMTime) async -> Bool + @available(watchOS 1.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: @escaping (Bool) -> Void) + @available(watchOS 1.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool } extension AVPlayer { @available(watchOS 3.0, *) @@ -79,6 +85,8 @@ extension AVPlayer { @available(watchOS 1.0, *) func preroll(atRate rate: Float, completionHandler: ((Bool) -> Void)? = nil) @available(watchOS 1.0, *) + func preroll(atRate rate: Float) async -> Bool + @available(watchOS 1.0, *) func cancelPendingPrerolls() @available(watchOS 1.0, *) var masterClock: CMClock? diff --git a/watchOS/AVFoundation/AVPlayerItem.swift b/watchOS/AVFoundation/AVPlayerItem.swift index 04a8cfe..27f3325 100644 --- a/watchOS/AVFoundation/AVPlayerItem.swift +++ b/watchOS/AVFoundation/AVPlayerItem.swift @@ -83,8 +83,12 @@ extension AVPlayerItem { @available(watchOS 1.0, *) func seek(to time: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(watchOS 1.0, *) + func seek(to time: CMTime) async -> Bool + @available(watchOS 1.0, *) func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: ((Bool) -> Void)? = nil) @available(watchOS 1.0, *) + func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool + @available(watchOS 1.0, *) func cancelPendingSeeks() func currentDate() -> Date? @available(watchOS 1.0, *) diff --git a/watchOS/AVFoundation/AVSampleBufferAudioRenderer.swift b/watchOS/AVFoundation/AVSampleBufferAudioRenderer.swift index 622537b..3971811 100644 --- a/watchOS/AVFoundation/AVSampleBufferAudioRenderer.swift +++ b/watchOS/AVFoundation/AVSampleBufferAudioRenderer.swift @@ -11,6 +11,7 @@ extension AVSampleBufferAudioRenderer { } extension AVSampleBufferAudioRenderer { func flush(fromSourceTime time: CMTime, completionHandler: @escaping (Bool) -> Void) + func flush(fromSourceTime time: CMTime) async -> Bool } extension NSNotification.Name { @available(watchOS 4.0, *) diff --git a/watchOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift b/watchOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift index 588c127..3049774 100644 --- a/watchOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift +++ b/watchOS/AVFoundation/AVSampleBufferRenderSynchronizer.swift @@ -15,6 +15,7 @@ extension AVSampleBufferRenderSynchronizer { var renderers: [AVQueuedSampleBufferRendering] { get } func addRenderer(_ renderer: AVQueuedSampleBufferRendering) func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime, completionHandler: ((Bool) -> Void)? = nil) + func removeRenderer(_ renderer: AVQueuedSampleBufferRendering, at time: CMTime) async -> Bool } extension AVSampleBufferRenderSynchronizer { func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any diff --git a/watchOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift b/watchOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift index 8bebc12..2cc9c20 100644 --- a/watchOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift +++ b/watchOS/AuthenticationServices/ASAuthorizationAppleIDProvider.swift @@ -16,4 +16,5 @@ extension ASAuthorizationAppleIDProvider { class ASAuthorizationAppleIDProvider : NSObject, ASAuthorizationProvider { func createRequest() -> ASAuthorizationAppleIDRequest func getCredentialState(forUserID userID: String, completion: @escaping (ASAuthorizationAppleIDProvider.CredentialState, Error?) -> Void) + func credentialState(forUserID userID: String) async throws -> ASAuthorizationAppleIDProvider.CredentialState } diff --git a/watchOS/ClockKit/CLKWatchFaceLibrary.swift b/watchOS/ClockKit/CLKWatchFaceLibrary.swift index 02683c1..ab43387 100644 --- a/watchOS/ClockKit/CLKWatchFaceLibrary.swift +++ b/watchOS/ClockKit/CLKWatchFaceLibrary.swift @@ -15,4 +15,5 @@ extension CLKWatchFaceLibrary { @available(watchOS 7.0, *) class CLKWatchFaceLibrary : NSObject { func addWatchFace(at fileURL: URL, completionHandler handler: @escaping (Error?) -> Void) + func addWatchFace(at fileURL: URL) async throws } diff --git a/watchOS/CloudKit/CKContainer.swift b/watchOS/CloudKit/CKContainer.swift index 1a4daea..807f452 100644 --- a/watchOS/CloudKit/CKContainer.swift +++ b/watchOS/CloudKit/CKContainer.swift @@ -51,6 +51,7 @@ extension NSNotification.Name { } extension CKContainer { func accountStatus(completionHandler: @escaping (CKAccountStatus, Error?) -> Void) + func accountStatus() async throws -> CKAccountStatus } @available(watchOS 3.0, *) struct CKContainer_Application_Permissions : OptionSet { @@ -70,34 +71,59 @@ enum CKContainer_Application_PermissionStatus : Int { typealias CKContainer_Application_PermissionBlock = (CKContainer_Application_PermissionStatus, Error?) -> Void extension CKContainer { func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func status(forApplicationPermission applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions, completionHandler: @escaping CKContainer_Application_PermissionBlock) + func requestApplicationPermission(_ applicationPermission: CKContainer_Application_Permissions) async throws -> CKContainer_Application_PermissionStatus } extension CKContainer { func fetchUserRecordID(completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func fetchUserRecordID() async throws -> CKRecord.ID @available(watchOS 3.0, *) func discoverAllIdentities(completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Void) @available(watchOS 3.0, *) + func discoverAllIdentities() async throws -> [CKUserIdentity] + @available(watchOS 3.0, *) func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(watchOS 3.0, *) + func discoverUserIdentity(withEmailAddress email: String) async throws -> CKUserIdentity + @available(watchOS 3.0, *) func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) @available(watchOS 3.0, *) + func discoverUserIdentity(withPhoneNumber phoneNumber: String) async throws -> CKUserIdentity + @available(watchOS 3.0, *) func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKUserIdentity?, Error?) -> Void) + @available(watchOS 3.0, *) + func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity } extension CKContainer { @available(watchOS 3.0, *) func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(watchOS 3.0, *) + func fetchShareParticipant(withEmailAddress emailAddress: String) async throws -> CKShare.Participant + @available(watchOS 3.0, *) func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(watchOS 3.0, *) + func fetchShareParticipant(withPhoneNumber phoneNumber: String) async throws -> CKShare.Participant + @available(watchOS 3.0, *) func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping (CKShare.Participant?, Error?) -> Void) @available(watchOS 3.0, *) + func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant + @available(watchOS 3.0, *) func fetchShareMetadata(with url: URL, completionHandler: @escaping (CKShare.Metadata?, Error?) -> Void) @available(watchOS 3.0, *) + func fetchShareMetadata(with url: URL) async throws -> CKShare.Metadata + @available(watchOS 3.0, *) func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping (CKShare?, Error?) -> Void) + @available(watchOS 3.0, *) + func accept(_ metadata: CKShare.Metadata) async throws -> CKShare } extension CKContainer { @available(watchOS 3.0, *) func __fetchAllLongLivedOperationIDs(completionHandler: @escaping ([String]?, Error?) -> Void) @available(watchOS 3.0, *) + func __fetchAllLongLivedOperationIDs() async throws -> [String] + @available(watchOS 3.0, *) func __fetchLongLivedOperation(withID operationID: String, completionHandler: @escaping (CKOperation?, Error?) -> Void) + @available(watchOS 3.0, *) + func __fetchLongLivedOperation(withID operationID: String) async throws -> CKOperation } diff --git a/watchOS/CloudKit/CKDatabase.swift b/watchOS/CloudKit/CKDatabase.swift index d905d68..94ba438 100644 --- a/watchOS/CloudKit/CKDatabase.swift +++ b/watchOS/CloudKit/CKDatabase.swift @@ -25,19 +25,35 @@ class CKDatabase : NSObject { } extension CKDatabase { func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func fetch(withRecordID recordID: CKRecord.ID) async throws -> CKRecord func save(_ record: CKRecord, completionHandler: @escaping (CKRecord?, Error?) -> Void) + func save(_ record: CKRecord) async throws -> CKRecord func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord.ID?, Error?) -> Void) + func delete(withRecordID recordID: CKRecord.ID) async throws -> CKRecord.ID func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?, completionHandler: @escaping ([CKRecord]?, Error?) -> Void) + func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?) async throws -> [CKRecord] func fetchAllRecordZones(completionHandler: @escaping ([CKRecordZone]?, Error?) -> Void) + func fetchAllRecordZones() async throws -> [CKRecordZone] func fetch(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func fetch(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone func save(_ zone: CKRecordZone, completionHandler: @escaping (CKRecordZone?, Error?) -> Void) + func save(_ zone: CKRecordZone) async throws -> CKRecordZone func delete(withRecordZoneID zoneID: CKRecordZone.ID, completionHandler: @escaping (CKRecordZone.ID?, Error?) -> Void) + func delete(withRecordZoneID zoneID: CKRecordZone.ID) async throws -> CKRecordZone.ID @available(watchOS 6.0, *) func __fetch(withSubscriptionID subscriptionID: String, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(watchOS 6.0, *) + func __fetch(withSubscriptionID subscriptionID: String) async throws -> CKSubscription + @available(watchOS 6.0, *) func fetchAllSubscriptions(completionHandler: @escaping ([CKSubscription]?, Error?) -> Void) @available(watchOS 6.0, *) + func fetchAllSubscriptions() async throws -> [CKSubscription] + @available(watchOS 6.0, *) func save(_ subscription: CKSubscription, completionHandler: @escaping (CKSubscription?, Error?) -> Void) @available(watchOS 6.0, *) + func save(_ subscription: CKSubscription) async throws -> CKSubscription + @available(watchOS 6.0, *) func __delete(withSubscriptionID subscriptionID: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(watchOS 6.0, *) + func __delete(withSubscriptionID subscriptionID: String) async throws -> String } diff --git a/watchOS/Contacts/CNContactStore.swift b/watchOS/Contacts/CNContactStore.swift index c18c53f..6523af4 100644 --- a/watchOS/Contacts/CNContactStore.swift +++ b/watchOS/Contacts/CNContactStore.swift @@ -18,6 +18,7 @@ enum CNAuthorizationStatus : Int { class CNContactStore : NSObject { class func authorizationStatus(for entityType: CNEntityType) -> CNAuthorizationStatus func requestAccess(for entityType: CNEntityType, completionHandler: @escaping (Bool, Error?) -> Void) + func requestAccess(for entityType: CNEntityType) async throws -> Bool func unifiedContacts(matching predicate: NSPredicate, keysToFetch keys: [CNKeyDescriptor]) throws -> [CNContact] func unifiedContact(withIdentifier identifier: String, keysToFetch keys: [CNKeyDescriptor]) throws -> CNContact func enumerateContacts(with fetchRequest: CNContactFetchRequest, usingBlock block: @escaping (CNContact, UnsafeMutablePointer) -> Void) throws diff --git a/watchOS/CoreData/NSPersistentContainer.swift b/watchOS/CoreData/NSPersistentContainer.swift index d4475b7..accdbea 100644 --- a/watchOS/CoreData/NSPersistentContainer.swift +++ b/watchOS/CoreData/NSPersistentContainer.swift @@ -10,6 +10,7 @@ class NSPersistentContainer : NSObject { convenience init(name: String) init(name: String, managedObjectModel model: NSManagedObjectModel) func loadPersistentStores(completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + func loadPersistentStores() async throws -> NSPersistentStoreDescription func newBackgroundContext() -> NSManagedObjectContext func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void) } diff --git a/watchOS/CoreData/NSPersistentStoreCoordinator.swift b/watchOS/CoreData/NSPersistentStoreCoordinator.swift index 85661e4..6335004 100644 --- a/watchOS/CoreData/NSPersistentStoreCoordinator.swift +++ b/watchOS/CoreData/NSPersistentStoreCoordinator.swift @@ -79,6 +79,8 @@ class NSPersistentStoreCoordinator : NSObject { func addPersistentStore(ofType storeType: String, configurationName configuration: String?, at storeURL: URL?, options: [AnyHashable : Any]? = nil) throws -> NSPersistentStore @available(watchOS 3.0, *) func addPersistentStore(with storeDescription: NSPersistentStoreDescription, completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void) + @available(watchOS 3.0, *) + func addPersistentStore(with storeDescription: NSPersistentStoreDescription) async throws -> NSPersistentStoreDescription func remove(_ store: NSPersistentStore) throws func setMetadata(_ metadata: [String : Any]?, for store: NSPersistentStore) func metadata(for store: NSPersistentStore) -> [String : Any] diff --git a/watchOS/CoreFoundation/CFError.swift b/watchOS/CoreFoundation/CFError.swift index 7ed783f..1ebf2cd 100644 --- a/watchOS/CoreFoundation/CFError.swift +++ b/watchOS/CoreFoundation/CFError.swift @@ -2,9 +2,6 @@ typealias CFErrorDomain = CFString class CFError : _CFObject { } - -extension CFError : Error { -} @available(watchOS 2.0, *) func CFErrorGetTypeID() -> CFTypeID @available(watchOS 2.0, *) diff --git a/watchOS/CoreGraphics/CGAffineTransform.swift b/watchOS/CoreGraphics/CGAffineTransform.swift index 361871f..8d43baa 100644 --- a/watchOS/CoreGraphics/CGAffineTransform.swift +++ b/watchOS/CoreGraphics/CGAffineTransform.swift @@ -19,9 +19,6 @@ extension CGAffineTransform { extension CGAffineTransform : Codable { } - -extension CGAffineTransform : _ObjectiveCBridgeable { -} extension CGAffineTransform { @available(watchOS 2.0, *) /*not inherited*/ init(translationX tx: CGFloat, y ty: CGFloat) diff --git a/watchOS/CoreGraphics/CGGeometry.swift b/watchOS/CoreGraphics/CGGeometry.swift index dc86118..3cf2bac 100644 --- a/watchOS/CoreGraphics/CGGeometry.swift +++ b/watchOS/CoreGraphics/CGGeometry.swift @@ -27,9 +27,6 @@ extension CGPoint : Equatable { extension CGPoint : Codable { } - -extension CGPoint : _ObjectiveCBridgeable { -} struct CGSize { var width: CGFloat var height: CGFloat @@ -58,9 +55,6 @@ extension CGSize : Equatable { extension CGSize : Codable { } - -extension CGSize : _ObjectiveCBridgeable { -} struct CGVector { var dx: CGFloat var dy: CGFloat @@ -82,9 +76,6 @@ extension CGVector : CustomDebugStringConvertible { extension CGVector : Codable { } - -extension CGVector : _ObjectiveCBridgeable { -} struct CGRect { var origin: CGPoint var size: CGSize @@ -115,9 +106,6 @@ extension CGRect : Equatable { extension CGRect : Codable { } - -extension CGRect : _ObjectiveCBridgeable { -} @frozen enum CGRectEdge : UInt32 { init?(rawValue: UInt32) var rawValue: UInt32 { get } diff --git a/watchOS/CoreGraphics/CoreGraphics.swift b/watchOS/CoreGraphics/CoreGraphics.swift index 2e9534a..e191279 100644 --- a/watchOS/CoreGraphics/CoreGraphics.swift +++ b/watchOS/CoreGraphics/CoreGraphics.swift @@ -39,13 +39,6 @@ extension CGFloat : _CVarArgPassedAsDouble, _CVarArgAligned { extension CGFloat : Codable { } -extension CGFloat : _ObjectiveCBridgeable { - @available(swift, deprecated: 4, renamed: "init(truncating:)") - init(_ number: __shared NSNumber) - init(truncating number: __shared NSNumber) - init?(exactly number: __shared NSNumber) -} - enum CGPathFillRule : Int { case winding case evenOdd diff --git a/watchOS/CoreLocation/CLGeocoder.swift b/watchOS/CoreLocation/CLGeocoder.swift index e9cb1f2..5ae909e 100644 --- a/watchOS/CoreLocation/CLGeocoder.swift +++ b/watchOS/CoreLocation/CLGeocoder.swift @@ -4,14 +4,23 @@ typealias CLGeocodeCompletionHandler = ([CLPlacemark]?, Error?) -> Void class CLGeocoder : NSObject { var isGeocoding: Bool { get } func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CLGeocodeCompletionHandler) + func reverseGeocodeLocation(_ location: CLLocation) async throws -> [CLPlacemark] @available(watchOS 4.0, *) func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(watchOS 4.0, *) + func reverseGeocodeLocation(_ location: CLLocation, preferredLocale locale: Locale?) async throws -> [CLPlacemark] @available(watchOS, introduced: 1.0, deprecated: 4.0, message: "Use -geocodePostalAddress:completionHandler:") func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: @escaping CLGeocodeCompletionHandler) + @available(watchOS, introduced: 1.0, deprecated: 4.0, message: "Use -geocodePostalAddress:completionHandler:") + func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any]) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String) async throws -> [CLPlacemark] func geocodeAddressString(_ addressString: String, in region: CLRegion?, completionHandler: @escaping CLGeocodeCompletionHandler) + func geocodeAddressString(_ addressString: String, in region: CLRegion?) async throws -> [CLPlacemark] @available(watchOS 4.0, *) func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) + @available(watchOS 4.0, *) + func geocodeAddressString(_ addressString: String, in region: CLRegion?, preferredLocale locale: Locale?) async throws -> [CLPlacemark] func cancelGeocode() } extension CLGeocoder { diff --git a/watchOS/CoreLocation/CLLocationManager.swift b/watchOS/CoreLocation/CLLocationManager.swift index 3ce8862..adddb42 100644 --- a/watchOS/CoreLocation/CLLocationManager.swift +++ b/watchOS/CoreLocation/CLLocationManager.swift @@ -70,6 +70,8 @@ class CLLocationManager : NSObject { @available(watchOS 7.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil) @available(watchOS 7.0, *) + func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) async throws + @available(watchOS 7.0, *) func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String) @available(watchOS 3.0, *) func startUpdatingLocation() diff --git a/watchOS/CoreML/MLModel.swift b/watchOS/CoreML/MLModel.swift index 2fc5286..6d4a22e 100644 --- a/watchOS/CoreML/MLModel.swift +++ b/watchOS/CoreML/MLModel.swift @@ -9,6 +9,8 @@ class MLModel : NSObject { convenience init(contentsOf url: URL, configuration: MLModelConfiguration) throws @available(watchOS 7.0, *) class func __loadContents(of url: URL, configuration: MLModelConfiguration, completionHandler handler: @escaping (MLModel?, Error?) -> Void) + @available(watchOS 7.0, *) + class func __loadContents(of url: URL, configuration: MLModelConfiguration) async throws -> MLModel func prediction(from input: MLFeatureProvider) throws -> MLFeatureProvider func prediction(from input: MLFeatureProvider, options: MLPredictionOptions) throws -> MLFeatureProvider @available(watchOS 5.0, *) diff --git a/watchOS/DeveloperToolsSupport/DeveloperToolsSupport.swift b/watchOS/DeveloperToolsSupport/DeveloperToolsSupport.swift index e434a46..83f4ea3 100644 --- a/watchOS/DeveloperToolsSupport/DeveloperToolsSupport.swift +++ b/watchOS/DeveloperToolsSupport/DeveloperToolsSupport.swift @@ -1,6 +1,6 @@ @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct LibraryContentBuilder { +@resultBuilder struct LibraryContentBuilder { static func buildBlock(_ segments: [LibraryItem]...) -> [LibraryItem] static func buildExpression(_ item: LibraryItem) -> [LibraryItem] static func buildExpression(_ items: [LibraryItem]) -> [LibraryItem] diff --git a/watchOS/EventKit/EKEventStore.swift b/watchOS/EventKit/EKEventStore.swift index 6cae6dc..6d39dec 100644 --- a/watchOS/EventKit/EKEventStore.swift +++ b/watchOS/EventKit/EKEventStore.swift @@ -12,6 +12,8 @@ class EKEventStore : NSObject { class func authorizationStatus(for entityType: EKEntityType) -> EKAuthorizationStatus @available(watchOS 2.0, *) func requestAccess(to entityType: EKEntityType, completion: @escaping EKEventStoreRequestAccessCompletionHandler) + @available(watchOS 2.0, *) + func requestAccess(to entityType: EKEntityType) async throws -> Bool var eventStoreIdentifier: String { get } @available(watchOS 5.0, *) var delegateSources: [EKSource] { get } diff --git a/watchOS/Foundation/NSBundle.swift b/watchOS/Foundation/NSBundle.swift index ce5ef34..11447c9 100644 --- a/watchOS/Foundation/NSBundle.swift +++ b/watchOS/Foundation/NSBundle.swift @@ -99,7 +99,9 @@ class NSBundleResourceRequest : NSObject, ProgressReporting { var tags: Set { get } var bundle: Bundle { get } func beginAccessingResources(completionHandler: @escaping (Error?) -> Void) + func beginAccessingResources() async throws func conditionallyBeginAccessingResources(completionHandler: @escaping (Bool) -> Void) + func conditionallyBeginAccessingResources() async -> Bool func endAccessingResources() } extension Bundle { diff --git a/watchOS/Foundation/NSExtensionContext.swift b/watchOS/Foundation/NSExtensionContext.swift index c1bf45f..fee646a 100644 --- a/watchOS/Foundation/NSExtensionContext.swift +++ b/watchOS/Foundation/NSExtensionContext.swift @@ -3,8 +3,10 @@ class NSExtensionContext : NSObject { var inputItems: [Any] { get } func completeRequest(returningItems items: [Any]?, completionHandler: ((Bool) -> Void)? = nil) + func completeRequest(returningItems items: [Any]?) async -> Bool func cancelRequest(withError error: Error) func open(_ URL: URL, completionHandler: ((Bool) -> Void)? = nil) + func open(_ URL: URL) async -> Bool } @available(watchOS 2.0, *) let NSExtensionItemsAndErrorsKey: String diff --git a/watchOS/Foundation/NSFilePresenter.swift b/watchOS/Foundation/NSFilePresenter.swift index a0e20af..3a01197 100644 --- a/watchOS/Foundation/NSFilePresenter.swift +++ b/watchOS/Foundation/NSFilePresenter.swift @@ -6,7 +6,9 @@ protocol NSFilePresenter : NSObjectProtocol { optional func relinquishPresentedItem(toReader reader: @escaping ((() -> Void)?) -> Void) optional func relinquishPresentedItem(toWriter writer: @escaping ((() -> Void)?) -> Void) optional func savePresentedItemChanges(completionHandler: @escaping (Error?) -> Void) + optional func savePresentedItemChanges() async throws optional func accommodatePresentedItemDeletion(completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedItemDeletion() async throws optional func presentedItemDidMove(to newURL: URL) optional func presentedItemDidChange() @available(watchOS 2.0, *) @@ -16,6 +18,7 @@ protocol NSFilePresenter : NSObjectProtocol { @available(watchOS 2.0, *) optional func presentedItemDidResolveConflict(_ version: NSFileVersion) optional func accommodatePresentedSubitemDeletion(at url: URL, completionHandler: @escaping (Error?) -> Void) + optional func accommodatePresentedSubitemDeletion(at url: URL) async throws optional func presentedSubitemDidAppear(at url: URL) optional func presentedSubitem(at oldURL: URL, didMoveTo newURL: URL) optional func presentedSubitemDidChange(at url: URL) diff --git a/watchOS/Foundation/NSFileVersion.swift b/watchOS/Foundation/NSFileVersion.swift index 1fbed8a..3a03661 100644 --- a/watchOS/Foundation/NSFileVersion.swift +++ b/watchOS/Foundation/NSFileVersion.swift @@ -18,6 +18,8 @@ class NSFileVersion : NSObject { class func unresolvedConflictVersionsOfItem(at url: URL) -> [NSFileVersion]? @available(watchOS 2.0, *) class func getNonlocalVersionsOfItem(at url: URL, completionHandler: @escaping ([NSFileVersion]?, Error?) -> Void) + @available(watchOS 2.0, *) + class func nonlocalVersionsOfItem(at url: URL) async throws -> [NSFileVersion] class func version(itemAt url: URL, forPersistentIdentifier persistentIdentifier: Any) -> NSFileVersion? var url: URL { get } var localizedName: String? { get } diff --git a/watchOS/Foundation/NSHTTPCookieStorage.swift b/watchOS/Foundation/NSHTTPCookieStorage.swift index f3846ea..af6dc12 100644 --- a/watchOS/Foundation/NSHTTPCookieStorage.swift +++ b/watchOS/Foundation/NSHTTPCookieStorage.swift @@ -29,6 +29,8 @@ extension HTTPCookieStorage { func storeCookies(_ cookies: [HTTPCookie], for task: URLSessionTask) @available(watchOS 2.0, *) func getCookiesFor(_ task: URLSessionTask, completionHandler: @escaping ([HTTPCookie]?) -> Void) + @available(watchOS 2.0, *) + func cookies(for task: URLSessionTask) async -> [HTTPCookie]? } extension NSNotification.Name { @available(watchOS 2.0, *) diff --git a/watchOS/Foundation/NSItemProvider.swift b/watchOS/Foundation/NSItemProvider.swift index 3267233..87a3f38 100644 --- a/watchOS/Foundation/NSItemProvider.swift +++ b/watchOS/Foundation/NSItemProvider.swift @@ -75,6 +75,7 @@ class NSItemProvider : NSObject, NSCopying { convenience init?(contentsOf fileURL: URL!) func registerItem(forTypeIdentifier typeIdentifier: String, loadHandler: @escaping NSItemProvider.LoadHandler) func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil, completionHandler: NSItemProvider.CompletionHandler? = nil) + func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil) async throws -> NSSecureCoding } @available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) @@ -93,6 +94,8 @@ extension NSItemProvider { var previewImageHandler: NSItemProvider.LoadHandler? @available(watchOS 2.0, *) func loadPreviewImage(options: [AnyHashable : Any]! = [:], completionHandler: NSItemProvider.CompletionHandler!) + @available(watchOS 2.0, *) + func loadPreviewImage(options: [AnyHashable : Any]! = [:]) async throws -> NSSecureCoding } @available(watchOS 2.0, *) let NSExtensionJavaScriptPreprocessingResultsKey: String diff --git a/watchOS/Foundation/NSURLCache.swift b/watchOS/Foundation/NSURLCache.swift index 542e2e5..65ae63c 100644 --- a/watchOS/Foundation/NSURLCache.swift +++ b/watchOS/Foundation/NSURLCache.swift @@ -46,5 +46,7 @@ extension URLCache { @available(watchOS 2.0, *) func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -> Void) @available(watchOS 2.0, *) + func cachedResponse(for dataTask: URLSessionDataTask) async -> CachedURLResponse? + @available(watchOS 2.0, *) func removeCachedResponse(for dataTask: URLSessionDataTask) } diff --git a/watchOS/Foundation/NSURLCredentialStorage.swift b/watchOS/Foundation/NSURLCredentialStorage.swift index a59b8db..51fcef0 100644 --- a/watchOS/Foundation/NSURLCredentialStorage.swift +++ b/watchOS/Foundation/NSURLCredentialStorage.swift @@ -15,12 +15,16 @@ extension URLCredentialStorage { @available(watchOS 2.0, *) func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping ([String : URLCredential]?) -> Void) @available(watchOS 2.0, *) + func getCredentials(for protectionSpace: URLProtectionSpace, task: URLSessionTask) async -> [String : URLCredential]? + @available(watchOS 2.0, *) func set(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) @available(watchOS 2.0, *) func remove(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, options: [String : Any]? = nil, task: URLSessionTask) @available(watchOS 2.0, *) func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping (URLCredential?) -> Void) @available(watchOS 2.0, *) + func defaultCredential(for space: URLProtectionSpace, task: URLSessionTask) async -> URLCredential? + @available(watchOS 2.0, *) func setDefaultCredential(_ credential: URLCredential, for protectionSpace: URLProtectionSpace, task: URLSessionTask) } extension NSNotification.Name { diff --git a/watchOS/Foundation/NSURLSession.swift b/watchOS/Foundation/NSURLSession.swift index 1439dde..d9bb823 100644 --- a/watchOS/Foundation/NSURLSession.swift +++ b/watchOS/Foundation/NSURLSession.swift @@ -13,10 +13,15 @@ class URLSession : NSObject { func finishTasksAndInvalidate() func invalidateAndCancel() func reset(completionHandler: @escaping () -> Void) + func reset() async func flush(completionHandler: @escaping () -> Void) + func flush() async func getTasksWithCompletionHandler(_ completionHandler: @escaping ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) -> Void) + func tasks() async -> ([URLSessionDataTask], [URLSessionUploadTask], [URLSessionDownloadTask]) @available(watchOS 2.0, *) func getAllTasks(completionHandler: @escaping ([URLSessionTask]) -> Void) + @available(watchOS 2.0, *) + func allTasks() async -> [URLSessionTask] func dataTask(with request: URLRequest) -> URLSessionDataTask func dataTask(with url: URL) -> URLSessionDataTask func uploadTask(with request: URLRequest, fromFile fileURL: URL) -> URLSessionUploadTask @@ -117,11 +122,14 @@ class URLSessionUploadTask : URLSessionDataTask { @available(watchOS 2.0, *) class URLSessionDownloadTask : URLSessionTask { func cancel(byProducingResumeData completionHandler: @escaping (Data?) -> Void) + func cancelByProducingResumeData() async -> Data? } @available(watchOS 2.0, *) class URLSessionStreamTask : URLSessionTask { func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) + func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval) async throws -> (Data, Bool) func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) + func write(_ data: Data, timeout: TimeInterval) async throws func captureStreams() func closeWrite() func closeRead() @@ -167,7 +175,9 @@ extension URLSessionWebSocketTask { @available(watchOS 6.0, *) class URLSessionWebSocketTask : URLSessionTask { func __send(_ message: __NSURLSessionWebSocketMessage, completionHandler: @escaping (Error?) -> Void) + func __send(_ message: __NSURLSessionWebSocketMessage) async throws func __receiveMessage(completionHandler: @escaping (__NSURLSessionWebSocketMessage?, Error?) -> Void) + func __receiveMessage() async throws -> __NSURLSessionWebSocketMessage func sendPing(pongReceiveHandler: @escaping (Error?) -> Void) func cancel(with closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) var maximumMessageSize: Int @@ -264,6 +274,7 @@ extension URLSession { protocol URLSessionDelegate : NSObjectProtocol { optional func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) @available(watchOS 2.0, *) optional func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) } @@ -272,10 +283,15 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(watchOS 4.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest, completionHandler: @escaping (URLSession.DelayedRequestDisposition, URLRequest?) -> Void) @available(watchOS 4.0, *) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willBeginDelayedRequest request: URLRequest) async -> (URLSession.DelayedRequestDisposition, URLRequest?) + @available(watchOS 4.0, *) optional func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> URLRequest? optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) optional func urlSession(_ session: URLSession, task: URLSessionTask, needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + optional func urlSession(_ session: URLSession, task: URLSessionTask) async -> InputStream? optional func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) @available(watchOS 3.0, *) optional func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) @@ -284,11 +300,13 @@ protocol URLSessionTaskDelegate : URLSessionDelegate { @available(watchOS 2.0, *) protocol URLSessionDataDelegate : URLSessionTaskDelegate { optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse) async -> URLSession.ResponseDisposition optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome downloadTask: URLSessionDownloadTask) @available(watchOS 2.0, *) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome streamTask: URLSessionStreamTask) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse, completionHandler: @escaping (CachedURLResponse?) -> Void) + optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) async -> CachedURLResponse? } @available(watchOS 2.0, *) protocol URLSessionDownloadDelegate : URLSessionTaskDelegate { diff --git a/watchOS/Foundation/NSUserActivity.swift b/watchOS/Foundation/NSUserActivity.swift index a65ca72..31d18cc 100644 --- a/watchOS/Foundation/NSUserActivity.swift +++ b/watchOS/Foundation/NSUserActivity.swift @@ -26,6 +26,7 @@ class NSUserActivity : NSObject { func resignCurrent() func invalidate() func getContinuationStreams(completionHandler: @escaping (InputStream?, OutputStream?, Error?) -> Void) + func continuationStreams() async throws -> (InputStream, OutputStream) @available(watchOS 3.0, *) var isEligibleForHandoff: Bool @available(watchOS 3.0, *) @@ -39,7 +40,11 @@ class NSUserActivity : NSObject { @available(watchOS 5.0, *) class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier], completionHandler handler: @escaping () -> Void) @available(watchOS 5.0, *) + class func deleteSavedUserActivities(withPersistentIdentifiers persistentIdentifiers: [NSUserActivityPersistentIdentifier]) async + @available(watchOS 5.0, *) class func deleteAllSavedUserActivities(completionHandler handler: @escaping () -> Void) + @available(watchOS 5.0, *) + class func deleteAllSavedUserActivities() async } let NSUserActivityTypeBrowsingWeb: String @available(watchOS 3.0, *) diff --git a/watchOS/GameKit/GKAchievement.swift b/watchOS/GameKit/GKAchievement.swift index b844f9f..079ff96 100644 --- a/watchOS/GameKit/GKAchievement.swift +++ b/watchOS/GameKit/GKAchievement.swift @@ -2,12 +2,16 @@ @available(watchOS 3.0, *) class GKAchievement : NSObject, NSCoding, NSSecureCoding { class func loadAchievements(completionHandler: (([GKAchievement]?, Error?) -> Void)? = nil) + class func loadAchievements() async throws -> [GKAchievement] class func resetAchievements(completionHandler: ((Error?) -> Void)? = nil) + class func resetAchievements() async throws init(identifier: String) @available(watchOS 2.0, *) init(identifier: String, player: GKPlayer) @available(watchOS 2.0, *) class func report(_ achievements: [GKAchievement], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 2.0, *) + class func report(_ achievements: [GKAchievement]) async throws var identifier: String var percentComplete: Double var isCompleted: Bool { get } @@ -20,6 +24,8 @@ class GKAchievement : NSObject, NSCoding, NSSecureCoding { extension GKAchievement { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use +reportAchievements:withCompletionHandler:") func report(completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use +reportAchievements:withCompletionHandler:") + func report() async throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use isHidden on the GKAchievementDescription class instead") var isHidden: Bool { get } } diff --git a/watchOS/GameKit/GKAchievementDescription.swift b/watchOS/GameKit/GKAchievementDescription.swift index 7c98756..0656a8e 100644 --- a/watchOS/GameKit/GKAchievementDescription.swift +++ b/watchOS/GameKit/GKAchievementDescription.swift @@ -2,6 +2,7 @@ @available(watchOS 3.0, *) class GKAchievementDescription : NSObject, NSCoding, NSSecureCoding { class func loadAchievementDescriptions(completionHandler: (([GKAchievementDescription]?, Error?) -> Void)? = nil) + class func loadAchievementDescriptions() async throws -> [GKAchievementDescription] var identifier: String { get } @available(watchOS 2.0, *) var groupIdentifier: String? { get } diff --git a/watchOS/GameKit/GKLeaderboard.swift b/watchOS/GameKit/GKLeaderboard.swift index 745ed9b..d8a2095 100644 --- a/watchOS/GameKit/GKLeaderboard.swift +++ b/watchOS/GameKit/GKLeaderboard.swift @@ -39,15 +39,27 @@ class GKLeaderboard : NSObject { @available(watchOS 7.0, *) class func loadLeaderboards(IDs leaderboardIDs: [String]?, completionHandler: @escaping ([GKLeaderboard]?, Error?) -> Void) @available(watchOS 7.0, *) + class func loadLeaderboards(IDs leaderboardIDs: [String]?) async throws -> [GKLeaderboard] + @available(watchOS 7.0, *) func loadPreviousOccurrence(completionHandler: @escaping (GKLeaderboard?, Error?) -> Void) @available(watchOS 7.0, *) + func loadPreviousOccurrence() async throws -> GKLeaderboard + @available(watchOS 7.0, *) class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String], completionHandler: @escaping (Error?) -> Void) @available(watchOS 7.0, *) + class func submitScore(_ score: Int, context: Int, player: GKPlayer, leaderboardIDs: [String]) async throws + @available(watchOS 7.0, *) func submitScore(_ score: Int, context: Int, player: GKPlayer, completionHandler: @escaping (Error?) -> Void) @available(watchOS 7.0, *) + func submitScore(_ score: Int, context: Int, player: GKPlayer) async throws + @available(watchOS 7.0, *) func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Int, Error?) -> Void) @available(watchOS 7.0, *) + func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry], Int) + @available(watchOS 7.0, *) func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope, completionHandler: @escaping (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Error?) -> Void) + @available(watchOS 7.0, *) + func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope) async throws -> (GKLeaderboard.Entry, [GKLeaderboard.Entry]) } extension GKLeaderboard { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use identifier instead") @@ -56,8 +68,12 @@ extension GKLeaderboard { init?(playerIDs: [String]?) @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use loadLeaderboardsWithIDs:completionHandler: instead") class func loadCategories(completionHandler: (([String]?, [String]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use loadLeaderboardsWithIDs:completionHandler: instead") + class func loadCategories() async throws -> ([String], [String]) @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use setDefaultLeaderboardIdentifier:completionHandler: on GKLocalPlayer instead") class func setDefault(_ leaderboardIdentifier: String?, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use setDefaultLeaderboardIdentifier:completionHandler: on GKLocalPlayer instead") + class func setDefault(_ leaderboardIdentifier: String?) async throws @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler: instead.") var timeScope: GKLeaderboard.TimeScope @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler: instead.") @@ -78,6 +94,10 @@ extension GKLeaderboard { init(players: [GKPlayer]) @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") func loadScores(completionHandler: (([GKScore]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadEntriesForPlayerScope:timeScope:range:completionHandler:.") + func loadScores() async throws -> [GKScore] @available(watchOS, introduced: 2.0, deprecated: 7.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") class func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 7.0, message: "Use class method loadLeaderboardsWithIDs:completionHandler:") + class func loadLeaderboards() async throws -> [GKLeaderboard] } diff --git a/watchOS/GameKit/GKLeaderboardSet.swift b/watchOS/GameKit/GKLeaderboardSet.swift index 240dda3..2212e3b 100644 --- a/watchOS/GameKit/GKLeaderboardSet.swift +++ b/watchOS/GameKit/GKLeaderboardSet.swift @@ -6,10 +6,14 @@ class GKLeaderboardSet : NSObject, NSCoding, NSSecureCoding { var identifier: String? @available(watchOS 2.0, *) class func loadLeaderboardSets(completionHandler: (([GKLeaderboardSet]?, Error?) -> Void)? = nil) + @available(watchOS 2.0, *) + class func loadLeaderboardSets() async throws -> [GKLeaderboardSet] @available(watchOS 7.0, *) func loadLeaderboards(handler: @escaping ([GKLeaderboard]?, Error?) -> Void) } extension GKLeaderboardSet { @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadLeaderboardsWithHandler: instead.") func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 3.0, deprecated: 7.0, message: "Use loadLeaderboardsWithHandler: instead.") + func loadLeaderboards() async throws -> [GKLeaderboard] } diff --git a/watchOS/GameKit/GKLocalPlayer.swift b/watchOS/GameKit/GKLocalPlayer.swift index bf9d0f2..115428e 100644 --- a/watchOS/GameKit/GKLocalPlayer.swift +++ b/watchOS/GameKit/GKLocalPlayer.swift @@ -8,13 +8,22 @@ class GKLocalPlayer : GKPlayer { var authenticateHandler: ((Error?) -> Void)? @available(watchOS 3.0, *) func loadRecentPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func loadRecentPlayers() async throws -> [GKPlayer] func loadChallengableFriends(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + func loadChallengableFriends() async throws -> [GKPlayer] @available(watchOS 3.0, *) func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String, completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func setDefaultLeaderboardIdentifier(_ leaderboardIdentifier: String) async throws + @available(watchOS 3.0, *) func loadDefaultLeaderboardIdentifier(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func loadDefaultLeaderboardIdentifier() async throws -> String @available(watchOS 6.5, *) func fetchItems(forIdentityVerificationSignature completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(watchOS 6.5, *) + func fetchItemsForIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } protocol GKLocalPlayerListener : GKChallengeListener, GKInviteEventListener, GKTurnBasedEventListener { } @@ -33,18 +42,30 @@ extension NSNotification.Name { extension GKLocalPlayer { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use setDefaultLeaderboardIdentifier:completionHandler: instead") func setDefaultLeaderboardCategoryID(_ categoryID: String?, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use setDefaultLeaderboardIdentifier:completionHandler: instead") + func setDefaultLeaderboardCategoryID(_ categoryID: String?) async throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use loadDefaultLeaderboardIdentifierWithCompletionHandler: instead") func loadDefaultLeaderboardCategoryID(completionHandler: ((String?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use loadDefaultLeaderboardIdentifierWithCompletionHandler: instead") + func loadDefaultLeaderboardCategoryID() async throws -> String @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Set the authenticateHandler instead") func authenticate(completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Set the authenticateHandler instead") + func authenticate() async throws @available(watchOS, introduced: 2.0, deprecated: 3.0) func loadFriendPlayers(completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 3.0) + func loadFriendPlayers() async throws -> [GKPlayer] @available(watchOS, introduced: 3.0, deprecated: 6.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") func generateIdentityVerificationSignature(completionHandler: ((URL?, Data?, Data?, UInt64, Error?) -> Void)? = nil) + @available(watchOS, introduced: 3.0, deprecated: 6.5, message: "API deprecated. Use fetchItemsForIdentityVerificationSignature: and the teamPlayerID value to verify a user identity.") + func generateIdentityVerificationSignature() async throws -> (URL, Data, Data, UInt64) } extension GKLocalPlayer { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") func loadFriends(completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use loadRecentPlayersWithCompletionHandler: instead") + func loadFriends() async throws -> [String] @available(watchOS, introduced: 2.0, deprecated: 2.0, message: " This property is obsolete, Use loadFriendPlayersWithCompletionHandler: instead") var friends: [String]? { get } } diff --git a/watchOS/GameKit/GKMatch.swift b/watchOS/GameKit/GKMatch.swift index 6505a2d..ad04ffd 100644 --- a/watchOS/GameKit/GKMatch.swift +++ b/watchOS/GameKit/GKMatch.swift @@ -17,6 +17,8 @@ enum GKPlayerConnectionState : Int { extension GKMatch { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") func chooseBestHostPlayer(completionHandler: @escaping (String?) -> Void) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use chooseBestHostingPlayerWithCompletionHandler:") + func chooseBestHostPlayer() async -> String? @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use sendData:toPlayers:dataMode:error:") func send(_ data: Data, toPlayers playerIDs: [String], with mode: GKMatch.SendDataMode) throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use players instead.") diff --git a/watchOS/GameKit/GKMatchmaker.swift b/watchOS/GameKit/GKMatchmaker.swift index b8a2061..14cc17d 100644 --- a/watchOS/GameKit/GKMatchmaker.swift +++ b/watchOS/GameKit/GKMatchmaker.swift @@ -61,4 +61,6 @@ extension GKMatchmaker { func cancelInvite(toPlayer playerID: String) @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") func findPlayers(forHostedMatchRequest request: GKMatchRequest, withCompletionHandler completionHandler: (([String]?, Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "This is never invoked and its implementation does nothing, use findPlayersForHostedRequest:") + func findPlayers(forHostedMatchRequest request: GKMatchRequest) async throws -> [String] } diff --git a/watchOS/GameKit/GKPlayer.swift b/watchOS/GameKit/GKPlayer.swift index 2bd1a74..de94d16 100644 --- a/watchOS/GameKit/GKPlayer.swift +++ b/watchOS/GameKit/GKPlayer.swift @@ -2,6 +2,7 @@ @available(watchOS 3.0, *) class GKPlayer : GKBasePlayer { class func loadPlayers(forIdentifiers identifiers: [String], withCompletionHandler completionHandler: (([GKPlayer]?, Error?) -> Void)? = nil) + class func loadPlayers(forIdentifiers identifiers: [String]) async throws -> [GKPlayer] var alias: String { get } } extension NSNotification.Name { diff --git a/watchOS/GameKit/GKScore.swift b/watchOS/GameKit/GKScore.swift index f62b43c..2bf6c6c 100644 --- a/watchOS/GameKit/GKScore.swift +++ b/watchOS/GameKit/GKScore.swift @@ -18,10 +18,14 @@ class GKScore : NSObject, NSCoding, NSSecureCoding { var shouldSetDefaultLeaderboard: Bool @available(watchOS 3.0, *) class func report(_ scores: [GKScore], withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + class func report(_ scores: [GKScore]) async throws } extension GKScore { @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use +reportScores:withCompletionhandler: instead") func report(completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use +reportScores:withCompletionhandler: instead") + func report() async throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use initWithLeaderboardIdentifier: instead") init(category: String?) @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use leaderboardIdentifier instead") diff --git a/watchOS/GameKit/GKTurnBasedMatch.swift b/watchOS/GameKit/GKTurnBasedMatch.swift index bb8ffee..32a7127 100644 --- a/watchOS/GameKit/GKTurnBasedMatch.swift +++ b/watchOS/GameKit/GKTurnBasedMatch.swift @@ -94,39 +94,73 @@ class GKTurnBasedMatch : NSObject { @available(watchOS 3.0, *) var exchangeMaxInitiatedExchangesPerPlayer: Int { get } class func find(for request: GKMatchRequest, withCompletionHandler completionHandler: @escaping (GKTurnBasedMatch?, Error?) -> Void) + class func find(for request: GKMatchRequest) async throws -> GKTurnBasedMatch class func loadMatches(completionHandler: (([GKTurnBasedMatch]?, Error?) -> Void)? = nil) + class func loadMatches() async throws -> [GKTurnBasedMatch] @available(watchOS 3.0, *) class func load(withID matchID: String, withCompletionHandler completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(watchOS 3.0, *) + class func load(withID matchID: String) async throws -> GKTurnBasedMatch + @available(watchOS 3.0, *) func rematch(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func rematch() async throws -> GKTurnBasedMatch + @available(watchOS 3.0, *) func acceptInvite(completionHandler: ((GKTurnBasedMatch?, Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func acceptInvite() async throws -> GKTurnBasedMatch + @available(watchOS 3.0, *) func declineInvite(completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func declineInvite() async throws func remove(completionHandler: ((Error?) -> Void)? = nil) + func remove() async throws func loadMatchData(completionHandler: ((Data?, Error?) -> Void)? = nil) + func loadMatchData() async throws -> Data @available(watchOS 3.0, *) func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func endTurn(withNextParticipants nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws + @available(watchOS 3.0, *) func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipants: [GKTurnBasedParticipant], turnTimeout timeout: TimeInterval, match matchData: Data) async throws func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func participantQuitOutOfTurn(with matchOutcome: GKTurnBasedMatch.Outcome) async throws func endMatchInTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + func endMatchInTurn(withMatch matchData: Data) async throws @available(watchOS, introduced: 2.0, deprecated: 7.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 7.0, message: "pass GKLeaderboardScore to endMatchInTurnWithMatchData:scores:completionHandler instead") + func endMatchInTurn(withMatch matchData: Data, scores: [GKScore]?, achievements: [GKAchievement]?) async throws @available(watchOS 7.0, *) func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any], completionHandler: @escaping (Error?) -> Void) + @available(watchOS 7.0, *) + func endMatchInTurn(withMatch matchData: Data, leaderboardScores scores: [GKLeaderboardScore], achievements: [Any]) async throws @available(watchOS 3.0, *) func saveCurrentTurn(withMatch matchData: Data, completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func saveCurrentTurn(withMatch matchData: Data) async throws + @available(watchOS 3.0, *) func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throws + @available(watchOS 3.0, *) func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval, completionHandler: ((GKTurnBasedExchange?, Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval) async throws -> GKTurnBasedExchange + @available(watchOS 3.0, *) func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func sendReminder(to participants: [GKTurnBasedParticipant], localizableMessageKey key: String, arguments: [String]) async throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use endTurnWithNextParticipants:... instead") func endTurn(withNextParticipant nextParticipant: GKTurnBasedParticipant, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use endTurnWithNextParticipants:... instead") + func endTurn(withNextParticipant nextParticipant: GKTurnBasedParticipant, match matchData: Data) async throws @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use participantQuitInTurnWithOutcome:nextParticipants:turnTimeout:... instead") func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipant: GKTurnBasedParticipant, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 2.0, message: "Use participantQuitInTurnWithOutcome:nextParticipants:turnTimeout:... instead") + func participantQuitInTurn(with matchOutcome: GKTurnBasedMatch.Outcome, nextParticipant: GKTurnBasedParticipant, match matchData: Data) async throws } @available(watchOS 3.0, *) enum GKTurnBasedExchangeStatus : Int8 { @@ -157,7 +191,11 @@ class GKTurnBasedExchange : NSObject { @available(watchOS 3.0, *) func cancel(withLocalizableMessageKey key: String, arguments: [String], completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 3.0, *) + func cancel(withLocalizableMessageKey key: String, arguments: [String]) async throws + @available(watchOS 3.0, *) func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: ((Error?) -> Void)? = nil) + @available(watchOS 3.0, *) + func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data) async throws } @available(watchOS 3.0, *) class GKTurnBasedExchangeReply : NSObject { diff --git a/watchOS/HealthKit/HKHealthStore.swift b/watchOS/HealthKit/HKHealthStore.swift index b64de8e..a18d5a5 100644 --- a/watchOS/HealthKit/HKHealthStore.swift +++ b/watchOS/HealthKit/HKHealthStore.swift @@ -4,17 +4,27 @@ class HKHealthStore : NSObject { class func isHealthDataAvailable() -> Bool func authorizationStatus(for type: HKObjectType) -> HKAuthorizationStatus func requestAuthorization(toShare typesToShare: Set?, read typesToRead: Set?, completion: @escaping (Bool, Error?) -> Void) + func requestAuthorization(toShare typesToShare: Set?, read typesToRead: Set?) async throws -> Bool @available(watchOS 5.0, *) func getRequestStatusForAuthorization(toShare typesToShare: Set, read typesToRead: Set, completion: @escaping (HKAuthorizationRequestStatus, Error?) -> Void) + @available(watchOS 5.0, *) + func requestStatusForAuthorization(toShare typesToShare: Set, read typesToRead: Set) async throws -> HKAuthorizationRequestStatus @available(watchOS 2.0, *) func earliestPermittedSampleDate() -> Date func save(_ object: HKObject, withCompletion completion: @escaping (Bool, Error?) -> Void) + func save(_ object: HKObject) async throws -> Bool func save(_ objects: [HKObject], withCompletion completion: @escaping (Bool, Error?) -> Void) + func save(_ objects: [HKObject]) async throws -> Bool func delete(_ object: HKObject, withCompletion completion: @escaping (Bool, Error?) -> Void) + func delete(_ object: HKObject) async throws -> Bool @available(watchOS 2.0, *) func delete(_ objects: [HKObject], withCompletion completion: @escaping (Bool, Error?) -> Void) @available(watchOS 2.0, *) + func delete(_ objects: [HKObject]) async throws -> Bool + @available(watchOS 2.0, *) func deleteObjects(of objectType: HKObjectType, predicate: NSPredicate, withCompletion completion: @escaping (Bool, Int, Error?) -> Void) + @available(watchOS 2.0, *) + func deleteObjects(of objectType: HKObjectType, predicate: NSPredicate) async throws -> (Bool, Int) func execute(_ query: HKQuery) func stop(_ query: HKQuery) @available(watchOS, introduced: 2.0, deprecated: 4.0, message: "No longer supported") @@ -34,6 +44,7 @@ class HKHealthStore : NSObject { } extension HKHealthStore { func add(_ samples: [HKSample], to workout: HKWorkout, completion: @escaping (Bool, Error?) -> Void) + func add(_ samples: [HKSample], to workout: HKWorkout) async throws -> Bool @available(watchOS, introduced: 2.0, deprecated: 5.0, message: "Use HKWorkoutSession's start method") func start(_ workoutSession: HKWorkoutSession) @available(watchOS, introduced: 2.0, deprecated: 5.0, message: "Use HKWorkoutSession's end method") @@ -44,6 +55,8 @@ extension HKHealthStore { func resumeWorkoutSession(_ workoutSession: HKWorkoutSession) @available(watchOS 5.0, *) func recoverActiveWorkoutSession(completion: @escaping (HKWorkoutSession?, Error?) -> Void) + @available(watchOS 5.0, *) + func recoverActiveWorkoutSession() async throws -> HKWorkoutSession } extension HKHealthStore { } @@ -54,4 +67,6 @@ extension NSNotification.Name { extension HKHealthStore { @available(watchOS 2.0, *) func preferredUnits(for quantityTypes: Set, completion: @escaping ([HKQuantityType : HKUnit], Error?) -> Void) + @available(watchOS 2.0, *) + func preferredUnits(for quantityTypes: Set) async throws -> [HKQuantityType : HKUnit] } diff --git a/watchOS/HealthKit/HKHeartbeatSeriesBuilder.swift b/watchOS/HealthKit/HKHeartbeatSeriesBuilder.swift index a7c123b..34ea1d4 100644 --- a/watchOS/HealthKit/HKHeartbeatSeriesBuilder.swift +++ b/watchOS/HealthKit/HKHeartbeatSeriesBuilder.swift @@ -4,6 +4,9 @@ class HKHeartbeatSeriesBuilder : HKSeriesBuilder { class var maximumCount: Int { get } init(healthStore: HKHealthStore, device: HKDevice?, start startDate: Date) func addHeartbeatWithTimeInterval(sinceSeriesStartDate timeInterval: TimeInterval, precededByGap: Bool, completion: @escaping (Bool, Error?) -> Void) + func addHeartbeatWithTimeInterval(sinceSeriesStartDate timeInterval: TimeInterval, precededByGap: Bool) async throws -> Bool func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func finishSeries(completion: @escaping (HKHeartbeatSeriesSample?, Error?) -> Void) + func finishSeries() async throws -> HKHeartbeatSeriesSample } diff --git a/watchOS/HealthKit/HKQuantitySeriesSampleBuilder.swift b/watchOS/HealthKit/HKQuantitySeriesSampleBuilder.swift index 73975ab..0bea888 100644 --- a/watchOS/HealthKit/HKQuantitySeriesSampleBuilder.swift +++ b/watchOS/HealthKit/HKQuantitySeriesSampleBuilder.swift @@ -9,6 +9,8 @@ class HKQuantitySeriesSampleBuilder : NSObject { func insert(_ quantity: HKQuantity, for dateInterval: DateInterval) throws func insert(_ quantity: HKQuantity, at date: Date) throws func finishSeries(metadata: [String : Any]?, endDate: Date?, completion: @escaping ([HKQuantitySample]?, Error?) -> Void) + func finishSeries(metadata: [String : Any]?, endDate: Date?) async throws -> [HKQuantitySample] func finishSeries(metadata: [String : Any]?, completion: @escaping ([HKQuantitySample]?, Error?) -> Void) + func finishSeries(metadata: [String : Any]?) async throws -> [HKQuantitySample] func discard() } diff --git a/watchOS/HealthKit/HKWorkoutBuilder.swift b/watchOS/HealthKit/HKWorkoutBuilder.swift index b3eb1e1..4ebc160 100644 --- a/watchOS/HealthKit/HKWorkoutBuilder.swift +++ b/watchOS/HealthKit/HKWorkoutBuilder.swift @@ -9,11 +9,17 @@ class HKWorkoutBuilder : NSObject { var workoutEvents: [HKWorkoutEvent] { get } init(healthStore: HKHealthStore, configuration: HKWorkoutConfiguration, device: HKDevice?) func beginCollection(withStart startDate: Date, completion: @escaping (Bool, Error?) -> Void) + func beginCollection(withStart startDate: Date) async throws -> Bool func add(_ samples: [HKSample], completion: @escaping (Bool, Error?) -> Void) + func add(_ samples: [HKSample]) async throws -> Bool func addWorkoutEvents(_ workoutEvents: [HKWorkoutEvent], completion: @escaping (Bool, Error?) -> Void) + func addWorkoutEvents(_ workoutEvents: [HKWorkoutEvent]) async throws -> Bool func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func endCollection(withEnd endDate: Date, completion: @escaping (Bool, Error?) -> Void) + func endCollection(withEnd endDate: Date) async throws -> Bool func finishWorkout(completion: @escaping (HKWorkout?, Error?) -> Void) + func finishWorkout() async throws -> HKWorkout func discardWorkout() func elapsedTime(at date: Date) -> TimeInterval func statistics(for quantityType: HKQuantityType) -> HKStatistics? diff --git a/watchOS/HealthKit/HKWorkoutRouteBuilder.swift b/watchOS/HealthKit/HKWorkoutRouteBuilder.swift index 866940c..a996238 100644 --- a/watchOS/HealthKit/HKWorkoutRouteBuilder.swift +++ b/watchOS/HealthKit/HKWorkoutRouteBuilder.swift @@ -3,5 +3,7 @@ class HKWorkoutRouteBuilder : HKSeriesBuilder { init(healthStore: HKHealthStore, device: HKDevice?) func addMetadata(_ metadata: [String : Any], completion: @escaping (Bool, Error?) -> Void) + func addMetadata(_ metadata: [String : Any]) async throws -> Bool func finishRoute(with workout: HKWorkout, metadata: [String : Any]?, completion: @escaping (HKWorkoutRoute?, Error?) -> Void) + func finishRoute(with workout: HKWorkout, metadata: [String : Any]?) async throws -> HKWorkoutRoute } diff --git a/watchOS/HomeKit/HMAccessory.swift b/watchOS/HomeKit/HMAccessory.swift index 3a93cc2..6d62b17 100644 --- a/watchOS/HomeKit/HMAccessory.swift +++ b/watchOS/HomeKit/HMAccessory.swift @@ -25,6 +25,7 @@ class HMAccessory : NSObject { @available(watchOS 4.3, *) var supportsIdentify: Bool { get } func identify(completionHandler completion: @escaping (Error?) -> Void) + func identify() async throws } @available(watchOS 2.0, *) protocol HMAccessoryDelegate : NSObjectProtocol { diff --git a/watchOS/HomeKit/HMCameraStream.swift b/watchOS/HomeKit/HMCameraStream.swift index d34852a..f6fec24 100644 --- a/watchOS/HomeKit/HMCameraStream.swift +++ b/watchOS/HomeKit/HMCameraStream.swift @@ -5,4 +5,5 @@ class HMCameraStream : HMCameraSource { @available(watchOS, introduced: 3.0, deprecated: 3.0) func setAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting) func updateAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting, completionHandler completion: @escaping (Error?) -> Void) + func updateAudioStreamSetting(_ audioStreamSetting: HMCameraAudioStreamSetting) async throws } diff --git a/watchOS/HomeKit/HMCharacteristic.swift b/watchOS/HomeKit/HMCharacteristic.swift index e7c6268..1a11381 100644 --- a/watchOS/HomeKit/HMCharacteristic.swift +++ b/watchOS/HomeKit/HMCharacteristic.swift @@ -12,6 +12,9 @@ class HMCharacteristic : NSObject { @available(watchOS 2.0, *) var uniqueIdentifier: UUID { get } func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void) + func writeValue(_ value: Any?) async throws func readValue(completionHandler completion: @escaping (Error?) -> Void) + func readValue() async throws func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) + func enableNotification(_ enable: Bool) async throws } diff --git a/watchOS/HomeKit/HMHome.swift b/watchOS/HomeKit/HMHome.swift index 461c0ce..625f5a1 100644 --- a/watchOS/HomeKit/HMHome.swift +++ b/watchOS/HomeKit/HMHome.swift @@ -42,6 +42,7 @@ extension HMHome { extension HMHome { var actionSets: [HMActionSet] { get } func executeActionSet(_ actionSet: HMActionSet, completionHandler completion: @escaping (Error?) -> Void) + func executeActionSet(_ actionSet: HMActionSet) async throws @available(watchOS 2.0, *) func builtinActionSet(ofType actionSetType: String) -> HMActionSet? } diff --git a/watchOS/Intents/INActivateCarSignalIntent.swift b/watchOS/Intents/INActivateCarSignalIntent.swift index c219ec9..452ce46 100644 --- a/watchOS/Intents/INActivateCarSignalIntent.swift +++ b/watchOS/Intents/INActivateCarSignalIntent.swift @@ -8,7 +8,11 @@ class INActivateCarSignalIntent : INIntent { @available(watchOS 3.2, *) protocol INActivateCarSignalIntentHandling : NSObjectProtocol { func handle(intent: INActivateCarSignalIntent, completion: @escaping (INActivateCarSignalIntentResponse) -> Void) + func handle(intent: INActivateCarSignalIntent) async -> INActivateCarSignalIntentResponse optional func confirm(intent: INActivateCarSignalIntent, completion: @escaping (INActivateCarSignalIntentResponse) -> Void) + optional func confirm(intent: INActivateCarSignalIntent) async -> INActivateCarSignalIntentResponse optional func resolveCarName(for intent: INActivateCarSignalIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INActivateCarSignalIntent) async -> INSpeakableStringResolutionResult optional func resolveSignals(for intent: INActivateCarSignalIntent, with completion: @escaping (INCarSignalOptionsResolutionResult) -> Void) + optional func resolveSignals(for intent: INActivateCarSignalIntent) async -> INCarSignalOptionsResolutionResult } diff --git a/watchOS/Intents/INAddMediaIntent.swift b/watchOS/Intents/INAddMediaIntent.swift index 6f9126b..48557b3 100644 --- a/watchOS/Intents/INAddMediaIntent.swift +++ b/watchOS/Intents/INAddMediaIntent.swift @@ -9,7 +9,11 @@ class INAddMediaIntent : INIntent { @available(watchOS 6.0, *) protocol INAddMediaIntentHandling : NSObjectProtocol { func handle(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + func handle(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func confirm(intent: INAddMediaIntent, completion: @escaping (INAddMediaIntentResponse) -> Void) + optional func confirm(intent: INAddMediaIntent) async -> INAddMediaIntentResponse optional func resolveMediaItems(for intent: INAddMediaIntent, with completion: @escaping ([INAddMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INAddMediaIntent) async -> [INAddMediaMediaItemResolutionResult] optional func resolveMediaDestination(for intent: INAddMediaIntent, with completion: @escaping (INAddMediaMediaDestinationResolutionResult) -> Void) + optional func resolveMediaDestination(for intent: INAddMediaIntent) async -> INAddMediaMediaDestinationResolutionResult } diff --git a/watchOS/Intents/INAddTasksIntent.swift b/watchOS/Intents/INAddTasksIntent.swift index bc8b8c5..40510e1 100644 --- a/watchOS/Intents/INAddTasksIntent.swift +++ b/watchOS/Intents/INAddTasksIntent.swift @@ -13,17 +13,31 @@ class INAddTasksIntent : INIntent { @available(watchOS 4.0, *) protocol INAddTasksIntentHandling : NSObjectProtocol { func handle(intent: INAddTasksIntent, completion: @escaping (INAddTasksIntentResponse) -> Void) + func handle(intent: INAddTasksIntent) async -> INAddTasksIntentResponse optional func confirm(intent: INAddTasksIntent, completion: @escaping (INAddTasksIntentResponse) -> Void) + optional func confirm(intent: INAddTasksIntent) async -> INAddTasksIntentResponse @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTargetTaskListForAddTasks:withCompletion: is deprecated. Use resolveTargetTaskListForAddTasks:completion: instead") optional func resolveTargetTaskList(for intent: INAddTasksIntent, with completion: @escaping (INTaskListResolutionResult) -> Void) + @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTargetTaskListForAddTasks:withCompletion: is deprecated. Use resolveTargetTaskListForAddTasks:completion: instead") + optional func resolveTargetTaskList(for intent: INAddTasksIntent) async -> INTaskListResolutionResult @available(watchOS 6.0, *) optional func resolveTargetTaskList(for intent: INAddTasksIntent, with completion: @escaping (INAddTasksTargetTaskListResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolveTargetTaskList(for intent: INAddTasksIntent) async -> INAddTasksTargetTaskListResolutionResult optional func resolveTaskTitles(for intent: INAddTasksIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + optional func resolveTaskTitles(for intent: INAddTasksIntent) async -> [INSpeakableStringResolutionResult] optional func resolveSpatialEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INSpatialEventTriggerResolutionResult) -> Void) + optional func resolveSpatialEventTrigger(for intent: INAddTasksIntent) async -> INSpatialEventTriggerResolutionResult @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTemporalEventTriggerForAddTasks:withCompletion: is deprecated. Use resolveTemporalEventTriggerForAddTasks:completion: instead") optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INTemporalEventTriggerResolutionResult) -> Void) + @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTemporalEventTriggerForAddTasks:withCompletion: is deprecated. Use resolveTemporalEventTriggerForAddTasks:completion: instead") + optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent) async -> INTemporalEventTriggerResolutionResult @available(watchOS 6.0, *) optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent, with completion: @escaping (INAddTasksTemporalEventTriggerResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolveTemporalEventTrigger(for intent: INAddTasksIntent) async -> INAddTasksTemporalEventTriggerResolutionResult + @available(watchOS 6.0, *) optional func resolvePriority(for intent: INAddTasksIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolvePriority(for intent: INAddTasksIntent) async -> INTaskPriorityResolutionResult } diff --git a/watchOS/Intents/INAppendToNoteIntent.swift b/watchOS/Intents/INAppendToNoteIntent.swift index 6992eed..6b5c20f 100644 --- a/watchOS/Intents/INAppendToNoteIntent.swift +++ b/watchOS/Intents/INAppendToNoteIntent.swift @@ -8,7 +8,11 @@ class INAppendToNoteIntent : INIntent { @available(watchOS 4.0, *) protocol INAppendToNoteIntentHandling : NSObjectProtocol { func handle(intent: INAppendToNoteIntent, completion: @escaping (INAppendToNoteIntentResponse) -> Void) + func handle(intent: INAppendToNoteIntent) async -> INAppendToNoteIntentResponse optional func confirm(intent: INAppendToNoteIntent, completion: @escaping (INAppendToNoteIntentResponse) -> Void) + optional func confirm(intent: INAppendToNoteIntent) async -> INAppendToNoteIntentResponse optional func resolveTargetNote(for intent: INAppendToNoteIntent, with completion: @escaping (INNoteResolutionResult) -> Void) + optional func resolveTargetNote(for intent: INAppendToNoteIntent) async -> INNoteResolutionResult optional func resolveContent(for intent: INAppendToNoteIntent, with completion: @escaping (INNoteContentResolutionResult) -> Void) + optional func resolveContent(for intent: INAppendToNoteIntent) async -> INNoteContentResolutionResult } diff --git a/watchOS/Intents/INCancelWorkoutIntent.swift b/watchOS/Intents/INCancelWorkoutIntent.swift index c1f5a5c..ef32e1b 100644 --- a/watchOS/Intents/INCancelWorkoutIntent.swift +++ b/watchOS/Intents/INCancelWorkoutIntent.swift @@ -7,6 +7,9 @@ class INCancelWorkoutIntent : INIntent { @available(watchOS 3.2, *) protocol INCancelWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INCancelWorkoutIntent, completion: @escaping (INCancelWorkoutIntentResponse) -> Void) + func handle(intent: INCancelWorkoutIntent) async -> INCancelWorkoutIntentResponse optional func confirm(intent: INCancelWorkoutIntent, completion: @escaping (INCancelWorkoutIntentResponse) -> Void) + optional func confirm(intent: INCancelWorkoutIntent) async -> INCancelWorkoutIntentResponse optional func resolveWorkoutName(for intent: INCancelWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INCancelWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INColor.swift b/watchOS/Intents/INColor.swift new file mode 100644 index 0000000..5a19839 --- /dev/null +++ b/watchOS/Intents/INColor.swift @@ -0,0 +1,8 @@ + +@available(watchOS 7.0, *) +class INColor : NSObject, NSCopying, NSSecureCoding { + init(red: Double, green: Double, blue: Double) + var red: Double { get } + var green: Double { get } + var blue: Double { get } +} diff --git a/watchOS/Intents/INCreateNoteIntent.swift b/watchOS/Intents/INCreateNoteIntent.swift index 5c1daf4..f1b099b 100644 --- a/watchOS/Intents/INCreateNoteIntent.swift +++ b/watchOS/Intents/INCreateNoteIntent.swift @@ -9,8 +9,13 @@ class INCreateNoteIntent : INIntent { @available(watchOS 4.0, *) protocol INCreateNoteIntentHandling : NSObjectProtocol { func handle(intent: INCreateNoteIntent, completion: @escaping (INCreateNoteIntentResponse) -> Void) + func handle(intent: INCreateNoteIntent) async -> INCreateNoteIntentResponse optional func confirm(intent: INCreateNoteIntent, completion: @escaping (INCreateNoteIntentResponse) -> Void) + optional func confirm(intent: INCreateNoteIntent) async -> INCreateNoteIntentResponse optional func resolveTitle(for intent: INCreateNoteIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INCreateNoteIntent) async -> INSpeakableStringResolutionResult optional func resolveContent(for intent: INCreateNoteIntent, with completion: @escaping (INNoteContentResolutionResult) -> Void) + optional func resolveContent(for intent: INCreateNoteIntent) async -> INNoteContentResolutionResult optional func resolveGroupName(for intent: INCreateNoteIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveGroupName(for intent: INCreateNoteIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INCreateTaskListIntent.swift b/watchOS/Intents/INCreateTaskListIntent.swift index ce9019e..cebaa46 100644 --- a/watchOS/Intents/INCreateTaskListIntent.swift +++ b/watchOS/Intents/INCreateTaskListIntent.swift @@ -9,8 +9,13 @@ class INCreateTaskListIntent : INIntent { @available(watchOS 4.0, *) protocol INCreateTaskListIntentHandling : NSObjectProtocol { func handle(intent: INCreateTaskListIntent, completion: @escaping (INCreateTaskListIntentResponse) -> Void) + func handle(intent: INCreateTaskListIntent) async -> INCreateTaskListIntentResponse optional func confirm(intent: INCreateTaskListIntent, completion: @escaping (INCreateTaskListIntentResponse) -> Void) + optional func confirm(intent: INCreateTaskListIntent) async -> INCreateTaskListIntentResponse optional func resolveTitle(for intent: INCreateTaskListIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INCreateTaskListIntent) async -> INSpeakableStringResolutionResult optional func resolveTaskTitles(for intent: INCreateTaskListIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + optional func resolveTaskTitles(for intent: INCreateTaskListIntent) async -> [INSpeakableStringResolutionResult] optional func resolveGroupName(for intent: INCreateTaskListIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveGroupName(for intent: INCreateTaskListIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INDeleteTasksIntent.swift b/watchOS/Intents/INDeleteTasksIntent.swift index 1a018cb..0fc9571 100644 --- a/watchOS/Intents/INDeleteTasksIntent.swift +++ b/watchOS/Intents/INDeleteTasksIntent.swift @@ -17,7 +17,11 @@ extension INDeleteTasksIntent { @available(watchOS 6.0, *) protocol INDeleteTasksIntentHandling : NSObjectProtocol { func handle(intent: INDeleteTasksIntent, completion: @escaping (INDeleteTasksIntentResponse) -> Void) + func handle(intent: INDeleteTasksIntent) async -> INDeleteTasksIntentResponse optional func confirm(intent: INDeleteTasksIntent, completion: @escaping (INDeleteTasksIntentResponse) -> Void) + optional func confirm(intent: INDeleteTasksIntent) async -> INDeleteTasksIntentResponse optional func resolveTaskList(for intent: INDeleteTasksIntent, with completion: @escaping (INDeleteTasksTaskListResolutionResult) -> Void) + optional func resolveTaskList(for intent: INDeleteTasksIntent) async -> INDeleteTasksTaskListResolutionResult optional func resolveTasks(for intent: INDeleteTasksIntent, with completion: @escaping ([INDeleteTasksTaskResolutionResult]) -> Void) + optional func resolveTasks(for intent: INDeleteTasksIntent) async -> [INDeleteTasksTaskResolutionResult] } diff --git a/watchOS/Intents/INEndWorkoutIntent.swift b/watchOS/Intents/INEndWorkoutIntent.swift index decca14..885d5f7 100644 --- a/watchOS/Intents/INEndWorkoutIntent.swift +++ b/watchOS/Intents/INEndWorkoutIntent.swift @@ -7,6 +7,9 @@ class INEndWorkoutIntent : INIntent { @available(watchOS 3.2, *) protocol INEndWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INEndWorkoutIntent, completion: @escaping (INEndWorkoutIntentResponse) -> Void) + func handle(intent: INEndWorkoutIntent) async -> INEndWorkoutIntentResponse optional func confirm(intent: INEndWorkoutIntent, completion: @escaping (INEndWorkoutIntentResponse) -> Void) + optional func confirm(intent: INEndWorkoutIntent) async -> INEndWorkoutIntentResponse optional func resolveWorkoutName(for intent: INEndWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INEndWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INGetCarLockStatusIntent.swift b/watchOS/Intents/INGetCarLockStatusIntent.swift index 8b10e7b..e5324df 100644 --- a/watchOS/Intents/INGetCarLockStatusIntent.swift +++ b/watchOS/Intents/INGetCarLockStatusIntent.swift @@ -7,6 +7,9 @@ class INGetCarLockStatusIntent : INIntent { @available(watchOS 3.2, *) protocol INGetCarLockStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetCarLockStatusIntent, completion: @escaping (INGetCarLockStatusIntentResponse) -> Void) + func handle(intent: INGetCarLockStatusIntent) async -> INGetCarLockStatusIntentResponse optional func confirm(intent: INGetCarLockStatusIntent, completion: @escaping (INGetCarLockStatusIntentResponse) -> Void) + optional func confirm(intent: INGetCarLockStatusIntent) async -> INGetCarLockStatusIntentResponse optional func resolveCarName(for intent: INGetCarLockStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INGetCarLockStatusIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INGetCarPowerLevelStatusIntent.swift b/watchOS/Intents/INGetCarPowerLevelStatusIntent.swift index 5162a9e..d6d6dfe 100644 --- a/watchOS/Intents/INGetCarPowerLevelStatusIntent.swift +++ b/watchOS/Intents/INGetCarPowerLevelStatusIntent.swift @@ -7,6 +7,9 @@ class INGetCarPowerLevelStatusIntent : INIntent { @available(watchOS 3.2, *) protocol INGetCarPowerLevelStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetCarPowerLevelStatusIntent, completion: @escaping (INGetCarPowerLevelStatusIntentResponse) -> Void) + func handle(intent: INGetCarPowerLevelStatusIntent) async -> INGetCarPowerLevelStatusIntentResponse optional func confirm(intent: INGetCarPowerLevelStatusIntent, completion: @escaping (INGetCarPowerLevelStatusIntentResponse) -> Void) + optional func confirm(intent: INGetCarPowerLevelStatusIntent) async -> INGetCarPowerLevelStatusIntentResponse optional func resolveCarName(for intent: INGetCarPowerLevelStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INGetCarPowerLevelStatusIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INGetRideStatusIntent.swift b/watchOS/Intents/INGetRideStatusIntent.swift index 83e929d..9c6cb24 100644 --- a/watchOS/Intents/INGetRideStatusIntent.swift +++ b/watchOS/Intents/INGetRideStatusIntent.swift @@ -5,9 +5,11 @@ class INGetRideStatusIntent : INIntent { @available(watchOS 3.2, *) protocol INGetRideStatusIntentHandling : NSObjectProtocol { func handle(intent: INGetRideStatusIntent, completion: @escaping (INGetRideStatusIntentResponse) -> Void) + func handle(intent: INGetRideStatusIntent) async -> INGetRideStatusIntentResponse func startSendingUpdates(for intent: INGetRideStatusIntent, to observer: INGetRideStatusIntentResponseObserver) func stopSendingUpdates(for intent: INGetRideStatusIntent) optional func confirm(intent: INGetRideStatusIntent, completion: @escaping (INGetRideStatusIntentResponse) -> Void) + optional func confirm(intent: INGetRideStatusIntent) async -> INGetRideStatusIntentResponse } @available(watchOS 3.2, *) protocol INGetRideStatusIntentResponseObserver : NSObjectProtocol { diff --git a/watchOS/Intents/INGetVisualCodeIntent.swift b/watchOS/Intents/INGetVisualCodeIntent.swift index 31f89fc..4221a0c 100644 --- a/watchOS/Intents/INGetVisualCodeIntent.swift +++ b/watchOS/Intents/INGetVisualCodeIntent.swift @@ -7,6 +7,9 @@ class INGetVisualCodeIntent : INIntent { @available(watchOS 4.0, *) protocol INGetVisualCodeIntentHandling : NSObjectProtocol { func handle(intent: INGetVisualCodeIntent, completion: @escaping (INGetVisualCodeIntentResponse) -> Void) + func handle(intent: INGetVisualCodeIntent) async -> INGetVisualCodeIntentResponse optional func confirm(intent: INGetVisualCodeIntent, completion: @escaping (INGetVisualCodeIntentResponse) -> Void) + optional func confirm(intent: INGetVisualCodeIntent) async -> INGetVisualCodeIntentResponse optional func resolveVisualCodeType(for intent: INGetVisualCodeIntent, with completion: @escaping (INVisualCodeTypeResolutionResult) -> Void) + optional func resolveVisualCodeType(for intent: INGetVisualCodeIntent) async -> INVisualCodeTypeResolutionResult } diff --git a/watchOS/Intents/INInteraction.swift b/watchOS/Intents/INInteraction.swift index 6e706b6..cd5aa4e 100644 --- a/watchOS/Intents/INInteraction.swift +++ b/watchOS/Intents/INInteraction.swift @@ -24,9 +24,13 @@ enum INInteractionDirection : Int { class INInteraction : NSObject, NSSecureCoding, NSCopying { init(intent: INIntent, response: INIntentResponse?) func donate(completion: ((Error?) -> Void)? = nil) + func donate() async throws class func deleteAll(completion: ((Error?) -> Void)? = nil) + class func deleteAll() async throws class func delete(with identifiers: [String], completion: ((Error?) -> Void)? = nil) + class func delete(with identifiers: [String]) async throws class func delete(with groupIdentifier: String, completion: ((Error?) -> Void)? = nil) + class func delete(with groupIdentifier: String) async throws @NSCopying var intent: INIntent { get } @NSCopying var intentResponse: INIntentResponse? { get } var intentHandlingStatus: INIntentHandlingStatus { get } diff --git a/watchOS/Intents/INListCarsIntent.swift b/watchOS/Intents/INListCarsIntent.swift index 89ad799..a71bedb 100644 --- a/watchOS/Intents/INListCarsIntent.swift +++ b/watchOS/Intents/INListCarsIntent.swift @@ -5,5 +5,7 @@ class INListCarsIntent : INIntent { @available(watchOS 7.0, *) protocol INListCarsIntentHandling : NSObjectProtocol { func handle(intent: INListCarsIntent, completion: @escaping (INListCarsIntentResponse) -> Void) + func handle(intent: INListCarsIntent) async -> INListCarsIntentResponse optional func confirm(intent: INListCarsIntent, completion: @escaping (INListCarsIntentResponse) -> Void) + optional func confirm(intent: INListCarsIntent) async -> INListCarsIntentResponse } diff --git a/watchOS/Intents/INListRideOptionsIntent.swift b/watchOS/Intents/INListRideOptionsIntent.swift index 4676d1f..e34034d 100644 --- a/watchOS/Intents/INListRideOptionsIntent.swift +++ b/watchOS/Intents/INListRideOptionsIntent.swift @@ -8,7 +8,11 @@ class INListRideOptionsIntent : INIntent { @available(watchOS 3.2, *) protocol INListRideOptionsIntentHandling : NSObjectProtocol { func handle(intent: INListRideOptionsIntent, completion: @escaping (INListRideOptionsIntentResponse) -> Void) + func handle(intent: INListRideOptionsIntent) async -> INListRideOptionsIntentResponse optional func confirm(intent: INListRideOptionsIntent, completion: @escaping (INListRideOptionsIntentResponse) -> Void) + optional func confirm(intent: INListRideOptionsIntent) async -> INListRideOptionsIntentResponse optional func resolvePickupLocation(for intent: INListRideOptionsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolvePickupLocation(for intent: INListRideOptionsIntent) async -> INPlacemarkResolutionResult optional func resolveDropOffLocation(for intent: INListRideOptionsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveDropOffLocation(for intent: INListRideOptionsIntent) async -> INPlacemarkResolutionResult } diff --git a/watchOS/Intents/INPauseWorkoutIntent.swift b/watchOS/Intents/INPauseWorkoutIntent.swift index 04b443a..a8fcaa4 100644 --- a/watchOS/Intents/INPauseWorkoutIntent.swift +++ b/watchOS/Intents/INPauseWorkoutIntent.swift @@ -7,6 +7,9 @@ class INPauseWorkoutIntent : INIntent { @available(watchOS 3.2, *) protocol INPauseWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INPauseWorkoutIntent, completion: @escaping (INPauseWorkoutIntentResponse) -> Void) + func handle(intent: INPauseWorkoutIntent) async -> INPauseWorkoutIntentResponse optional func confirm(intent: INPauseWorkoutIntent, completion: @escaping (INPauseWorkoutIntentResponse) -> Void) + optional func confirm(intent: INPauseWorkoutIntent) async -> INPauseWorkoutIntentResponse optional func resolveWorkoutName(for intent: INPauseWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INPauseWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INPayBillIntent.swift b/watchOS/Intents/INPayBillIntent.swift index 5162e10..a0acfab 100644 --- a/watchOS/Intents/INPayBillIntent.swift +++ b/watchOS/Intents/INPayBillIntent.swift @@ -13,12 +13,21 @@ class INPayBillIntent : INIntent { @available(watchOS 3.2, *) protocol INPayBillIntentHandling : NSObjectProtocol { func handle(intent: INPayBillIntent, completion: @escaping (INPayBillIntentResponse) -> Void) + func handle(intent: INPayBillIntent) async -> INPayBillIntentResponse optional func confirm(intent: INPayBillIntent, completion: @escaping (INPayBillIntentResponse) -> Void) + optional func confirm(intent: INPayBillIntent) async -> INPayBillIntentResponse optional func resolveBillPayee(for intent: INPayBillIntent, with completion: @escaping (INBillPayeeResolutionResult) -> Void) + optional func resolveBillPayee(for intent: INPayBillIntent) async -> INBillPayeeResolutionResult optional func resolveFromAccount(for intent: INPayBillIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveFromAccount(for intent: INPayBillIntent) async -> INPaymentAccountResolutionResult optional func resolveTransactionAmount(for intent: INPayBillIntent, with completion: @escaping (INPaymentAmountResolutionResult) -> Void) + optional func resolveTransactionAmount(for intent: INPayBillIntent) async -> INPaymentAmountResolutionResult optional func resolveTransactionScheduledDate(for intent: INPayBillIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveTransactionScheduledDate(for intent: INPayBillIntent) async -> INDateComponentsRangeResolutionResult optional func resolveTransactionNote(for intent: INPayBillIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveTransactionNote(for intent: INPayBillIntent) async -> INStringResolutionResult optional func resolveBillType(for intent: INPayBillIntent, with completion: @escaping (INBillTypeResolutionResult) -> Void) + optional func resolveBillType(for intent: INPayBillIntent) async -> INBillTypeResolutionResult optional func resolveDueDate(for intent: INPayBillIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDueDate(for intent: INPayBillIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/watchOS/Intents/INPlayMediaIntent.swift b/watchOS/Intents/INPlayMediaIntent.swift index 19de51c..36ec643 100644 --- a/watchOS/Intents/INPlayMediaIntent.swift +++ b/watchOS/Intents/INPlayMediaIntent.swift @@ -33,17 +33,31 @@ extension INPlayMediaIntent { @available(watchOS 5.0, *) protocol INPlayMediaIntentHandling : NSObjectProtocol { func handle(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + func handle(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse optional func confirm(intent: INPlayMediaIntent, completion: @escaping (INPlayMediaIntentResponse) -> Void) + optional func confirm(intent: INPlayMediaIntent) async -> INPlayMediaIntentResponse @available(watchOS 6.0, *) optional func resolveMediaItems(for intent: INPlayMediaIntent, with completion: @escaping ([INPlayMediaMediaItemResolutionResult]) -> Void) @available(watchOS 6.0, *) + optional func resolveMediaItems(for intent: INPlayMediaIntent) async -> [INPlayMediaMediaItemResolutionResult] + @available(watchOS 6.0, *) optional func resolvePlayShuffled(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolvePlayShuffled(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(watchOS 6.0, *) optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackRepeatModeResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent) async -> INPlaybackRepeatModeResolutionResult + @available(watchOS 6.0, *) optional func resolveResumePlayback(for intent: INPlayMediaIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolveResumePlayback(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult + @available(watchOS 6.0, *) optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent, with completion: @escaping (INPlaybackQueueLocationResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolvePlaybackQueueLocation(for intent: INPlayMediaIntent) async -> INPlaybackQueueLocationResolutionResult + @available(watchOS 6.0, *) optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent, with completion: @escaping (INPlayMediaPlaybackSpeedResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolvePlaybackSpeed(for intent: INPlayMediaIntent) async -> INPlayMediaPlaybackSpeedResolutionResult } diff --git a/watchOS/Intents/INRelevantShortcutStore.swift b/watchOS/Intents/INRelevantShortcutStore.swift index 1965126..fba5c9a 100644 --- a/watchOS/Intents/INRelevantShortcutStore.swift +++ b/watchOS/Intents/INRelevantShortcutStore.swift @@ -3,4 +3,5 @@ class INRelevantShortcutStore : NSObject { class var `default`: INRelevantShortcutStore { get } func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut], completionHandler: ((Error?) -> Void)? = nil) + func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut]) async throws } diff --git a/watchOS/Intents/INRequestPaymentIntent.swift b/watchOS/Intents/INRequestPaymentIntent.swift index 41961d5..acd068f 100644 --- a/watchOS/Intents/INRequestPaymentIntent.swift +++ b/watchOS/Intents/INRequestPaymentIntent.swift @@ -9,14 +9,25 @@ class INRequestPaymentIntent : INIntent { @available(watchOS 3.2, *) protocol INRequestPaymentIntentHandling : NSObjectProtocol { func handle(intent: INRequestPaymentIntent, completion: @escaping (INRequestPaymentIntentResponse) -> Void) + func handle(intent: INRequestPaymentIntent) async -> INRequestPaymentIntentResponse optional func confirm(intent: INRequestPaymentIntent, completion: @escaping (INRequestPaymentIntentResponse) -> Void) + optional func confirm(intent: INRequestPaymentIntent) async -> INRequestPaymentIntentResponse @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolvePayerForRequestPayment:withCompletion: is deprecated. Use resolvePayerForRequestPayment:completion: instead") optional func resolvePayer(for intent: INRequestPaymentIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolvePayerForRequestPayment:withCompletion: is deprecated. Use resolvePayerForRequestPayment:completion: instead") + optional func resolvePayer(for intent: INRequestPaymentIntent) async -> INPersonResolutionResult @available(watchOS 4.0, *) optional func resolvePayer(for intent: INRequestPaymentIntent, with completion: @escaping (INRequestPaymentPayerResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolvePayer(for intent: INRequestPaymentIntent) async -> INRequestPaymentPayerResolutionResult @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCurrencyAmountForRequestPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForRequestPayment:completion: instead") optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCurrencyAmountForRequestPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForRequestPayment:completion: instead") + optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent) async -> INCurrencyAmountResolutionResult @available(watchOS 4.0, *) optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent, with completion: @escaping (INRequestPaymentCurrencyAmountResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolveCurrencyAmount(for intent: INRequestPaymentIntent) async -> INRequestPaymentCurrencyAmountResolutionResult optional func resolveNote(for intent: INRequestPaymentIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveNote(for intent: INRequestPaymentIntent) async -> INStringResolutionResult } diff --git a/watchOS/Intents/INRequestRideIntent.swift b/watchOS/Intents/INRequestRideIntent.swift index 886eb31..4610bc0 100644 --- a/watchOS/Intents/INRequestRideIntent.swift +++ b/watchOS/Intents/INRequestRideIntent.swift @@ -22,11 +22,19 @@ extension INRequestRideIntent { @available(watchOS 3.2, *) protocol INRequestRideIntentHandling : NSObjectProtocol { func handle(intent: INRequestRideIntent, completion: @escaping (INRequestRideIntentResponse) -> Void) + func handle(intent: INRequestRideIntent) async -> INRequestRideIntentResponse optional func confirm(intent: INRequestRideIntent, completion: @escaping (INRequestRideIntentResponse) -> Void) + optional func confirm(intent: INRequestRideIntent) async -> INRequestRideIntentResponse optional func resolvePickupLocation(for intent: INRequestRideIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolvePickupLocation(for intent: INRequestRideIntent) async -> INPlacemarkResolutionResult optional func resolveDropOffLocation(for intent: INRequestRideIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveDropOffLocation(for intent: INRequestRideIntent) async -> INPlacemarkResolutionResult optional func resolveRideOptionName(for intent: INRequestRideIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveRideOptionName(for intent: INRequestRideIntent) async -> INSpeakableStringResolutionResult optional func resolvePartySize(for intent: INRequestRideIntent, with completion: @escaping (INIntegerResolutionResult) -> Void) + optional func resolvePartySize(for intent: INRequestRideIntent) async -> INIntegerResolutionResult @available(watchOS 3.3, *) optional func resolveScheduledPickupTime(for intent: INRequestRideIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + @available(watchOS 3.3, *) + optional func resolveScheduledPickupTime(for intent: INRequestRideIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/watchOS/Intents/INResumeWorkoutIntent.swift b/watchOS/Intents/INResumeWorkoutIntent.swift index 516c309..0f2c819 100644 --- a/watchOS/Intents/INResumeWorkoutIntent.swift +++ b/watchOS/Intents/INResumeWorkoutIntent.swift @@ -7,6 +7,9 @@ class INResumeWorkoutIntent : INIntent { @available(watchOS 3.2, *) protocol INResumeWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INResumeWorkoutIntent, completion: @escaping (INResumeWorkoutIntentResponse) -> Void) + func handle(intent: INResumeWorkoutIntent) async -> INResumeWorkoutIntentResponse optional func confirm(intent: INResumeWorkoutIntent, completion: @escaping (INResumeWorkoutIntentResponse) -> Void) + optional func confirm(intent: INResumeWorkoutIntent) async -> INResumeWorkoutIntentResponse optional func resolveWorkoutName(for intent: INResumeWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INResumeWorkoutIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INSearchCallHistoryIntent.swift b/watchOS/Intents/INSearchCallHistoryIntent.swift index aa9a78c..f9d0c0a 100644 --- a/watchOS/Intents/INSearchCallHistoryIntent.swift +++ b/watchOS/Intents/INSearchCallHistoryIntent.swift @@ -24,13 +24,23 @@ extension INSearchCallHistoryIntent { @available(watchOS 3.2, *) protocol INSearchCallHistoryIntentHandling : NSObjectProtocol { func handle(intent: INSearchCallHistoryIntent, completion: @escaping (INSearchCallHistoryIntentResponse) -> Void) + func handle(intent: INSearchCallHistoryIntent) async -> INSearchCallHistoryIntentResponse optional func confirm(intent: INSearchCallHistoryIntent, completion: @escaping (INSearchCallHistoryIntentResponse) -> Void) + optional func confirm(intent: INSearchCallHistoryIntent) async -> INSearchCallHistoryIntentResponse @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCallTypeForSearchCallHistory:withCompletion: is deprecated. Use resolveCallTypesForSearchCallHistory:withCompletion: instead") optional func resolveCallType(for intent: INSearchCallHistoryIntent, with completion: @escaping (INCallRecordTypeResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCallTypeForSearchCallHistory:withCompletion: is deprecated. Use resolveCallTypesForSearchCallHistory:withCompletion: instead") + optional func resolveCallType(for intent: INSearchCallHistoryIntent) async -> INCallRecordTypeResolutionResult optional func resolveDateCreated(for intent: INSearchCallHistoryIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INSearchCallHistoryIntent) async -> INDateComponentsRangeResolutionResult optional func resolveRecipient(for intent: INSearchCallHistoryIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + optional func resolveRecipient(for intent: INSearchCallHistoryIntent) async -> INPersonResolutionResult @available(watchOS 4.0, *) optional func resolveCallTypes(for intent: INSearchCallHistoryIntent, with completion: @escaping (INCallRecordTypeOptionsResolutionResult) -> Void) @available(watchOS 4.0, *) + optional func resolveCallTypes(for intent: INSearchCallHistoryIntent) async -> INCallRecordTypeOptionsResolutionResult + @available(watchOS 4.0, *) optional func resolveUnseen(for intent: INSearchCallHistoryIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolveUnseen(for intent: INSearchCallHistoryIntent) async -> INBooleanResolutionResult } diff --git a/watchOS/Intents/INSearchForAccountsIntent.swift b/watchOS/Intents/INSearchForAccountsIntent.swift index e7d7bc2..c017f2e 100644 --- a/watchOS/Intents/INSearchForAccountsIntent.swift +++ b/watchOS/Intents/INSearchForAccountsIntent.swift @@ -10,9 +10,15 @@ class INSearchForAccountsIntent : INIntent { @available(watchOS 4.0, *) protocol INSearchForAccountsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForAccountsIntent, completion: @escaping (INSearchForAccountsIntentResponse) -> Void) + func handle(intent: INSearchForAccountsIntent) async -> INSearchForAccountsIntentResponse optional func confirm(intent: INSearchForAccountsIntent, completion: @escaping (INSearchForAccountsIntentResponse) -> Void) + optional func confirm(intent: INSearchForAccountsIntent) async -> INSearchForAccountsIntentResponse optional func resolveAccountNickname(for intent: INSearchForAccountsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveAccountNickname(for intent: INSearchForAccountsIntent) async -> INSpeakableStringResolutionResult optional func resolveAccountType(for intent: INSearchForAccountsIntent, with completion: @escaping (INAccountTypeResolutionResult) -> Void) + optional func resolveAccountType(for intent: INSearchForAccountsIntent) async -> INAccountTypeResolutionResult optional func resolveOrganizationName(for intent: INSearchForAccountsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveOrganizationName(for intent: INSearchForAccountsIntent) async -> INSpeakableStringResolutionResult optional func resolveRequestedBalanceType(for intent: INSearchForAccountsIntent, with completion: @escaping (INBalanceTypeResolutionResult) -> Void) + optional func resolveRequestedBalanceType(for intent: INSearchForAccountsIntent) async -> INBalanceTypeResolutionResult } diff --git a/watchOS/Intents/INSearchForBillsIntent.swift b/watchOS/Intents/INSearchForBillsIntent.swift index aef1f1e..f87a1b7 100644 --- a/watchOS/Intents/INSearchForBillsIntent.swift +++ b/watchOS/Intents/INSearchForBillsIntent.swift @@ -11,10 +11,17 @@ class INSearchForBillsIntent : INIntent { @available(watchOS 3.2, *) protocol INSearchForBillsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForBillsIntent, completion: @escaping (INSearchForBillsIntentResponse) -> Void) + func handle(intent: INSearchForBillsIntent) async -> INSearchForBillsIntentResponse optional func confirm(intent: INSearchForBillsIntent, completion: @escaping (INSearchForBillsIntentResponse) -> Void) + optional func confirm(intent: INSearchForBillsIntent) async -> INSearchForBillsIntentResponse optional func resolveBillPayee(for intent: INSearchForBillsIntent, with completion: @escaping (INBillPayeeResolutionResult) -> Void) + optional func resolveBillPayee(for intent: INSearchForBillsIntent) async -> INBillPayeeResolutionResult optional func resolvePaymentDateRange(for intent: INSearchForBillsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolvePaymentDateRange(for intent: INSearchForBillsIntent) async -> INDateComponentsRangeResolutionResult optional func resolveBillType(for intent: INSearchForBillsIntent, with completion: @escaping (INBillTypeResolutionResult) -> Void) + optional func resolveBillType(for intent: INSearchForBillsIntent) async -> INBillTypeResolutionResult optional func resolveStatus(for intent: INSearchForBillsIntent, with completion: @escaping (INPaymentStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSearchForBillsIntent) async -> INPaymentStatusResolutionResult optional func resolveDueDateRange(for intent: INSearchForBillsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDueDateRange(for intent: INSearchForBillsIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/watchOS/Intents/INSearchForMediaIntent.swift b/watchOS/Intents/INSearchForMediaIntent.swift index d5b302a..ace89d2 100644 --- a/watchOS/Intents/INSearchForMediaIntent.swift +++ b/watchOS/Intents/INSearchForMediaIntent.swift @@ -8,6 +8,9 @@ class INSearchForMediaIntent : INIntent { @available(watchOS 6.0, *) protocol INSearchForMediaIntentHandling : NSObjectProtocol { func handle(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + func handle(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func confirm(intent: INSearchForMediaIntent, completion: @escaping (INSearchForMediaIntentResponse) -> Void) + optional func confirm(intent: INSearchForMediaIntent) async -> INSearchForMediaIntentResponse optional func resolveMediaItems(for intent: INSearchForMediaIntent, with completion: @escaping ([INSearchForMediaMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INSearchForMediaIntent) async -> [INSearchForMediaMediaItemResolutionResult] } diff --git a/watchOS/Intents/INSearchForMessagesIntent.swift b/watchOS/Intents/INSearchForMessagesIntent.swift index 752399a..c7bac37 100644 --- a/watchOS/Intents/INSearchForMessagesIntent.swift +++ b/watchOS/Intents/INSearchForMessagesIntent.swift @@ -27,13 +27,23 @@ class INSearchForMessagesIntent : INIntent { @available(watchOS 3.2, *) protocol INSearchForMessagesIntentHandling : NSObjectProtocol { func handle(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) + func handle(intent: INSearchForMessagesIntent) async -> INSearchForMessagesIntentResponse optional func confirm(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) + optional func confirm(intent: INSearchForMessagesIntent) async -> INSearchForMessagesIntentResponse optional func resolveRecipients(for intent: INSearchForMessagesIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveRecipients(for intent: INSearchForMessagesIntent) async -> [INPersonResolutionResult] optional func resolveSenders(for intent: INSearchForMessagesIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveSenders(for intent: INSearchForMessagesIntent) async -> [INPersonResolutionResult] optional func resolveAttributes(for intent: INSearchForMessagesIntent, with completion: @escaping (INMessageAttributeOptionsResolutionResult) -> Void) + optional func resolveAttributes(for intent: INSearchForMessagesIntent) async -> INMessageAttributeOptionsResolutionResult optional func resolveDateTimeRange(for intent: INSearchForMessagesIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateTimeRange(for intent: INSearchForMessagesIntent) async -> INDateComponentsRangeResolutionResult @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveGroupNamesForSearchForMessages:withCompletion: is deprecated. Use resolveSpeakableGroupNamesForSearchForMessages:withCompletion: instead") optional func resolveGroupNames(for intent: INSearchForMessagesIntent, with completion: @escaping ([INStringResolutionResult]) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveGroupNamesForSearchForMessages:withCompletion: is deprecated. Use resolveSpeakableGroupNamesForSearchForMessages:withCompletion: instead") + optional func resolveGroupNames(for intent: INSearchForMessagesIntent) async -> [INStringResolutionResult] @available(watchOS 4.0, *) optional func resolveSpeakableGroupNames(for intent: INSearchForMessagesIntent, with completion: @escaping ([INSpeakableStringResolutionResult]) -> Void) + @available(watchOS 4.0, *) + optional func resolveSpeakableGroupNames(for intent: INSearchForMessagesIntent) async -> [INSpeakableStringResolutionResult] } diff --git a/watchOS/Intents/INSearchForNotebookItemsIntent.swift b/watchOS/Intents/INSearchForNotebookItemsIntent.swift index 72bd7ad..c30e433 100644 --- a/watchOS/Intents/INSearchForNotebookItemsIntent.swift +++ b/watchOS/Intents/INSearchForNotebookItemsIntent.swift @@ -21,17 +21,31 @@ class INSearchForNotebookItemsIntent : INIntent { @available(watchOS 4.0, *) protocol INSearchForNotebookItemsIntentHandling : NSObjectProtocol { func handle(intent: INSearchForNotebookItemsIntent, completion: @escaping (INSearchForNotebookItemsIntentResponse) -> Void) + func handle(intent: INSearchForNotebookItemsIntent) async -> INSearchForNotebookItemsIntentResponse optional func confirm(intent: INSearchForNotebookItemsIntent, completion: @escaping (INSearchForNotebookItemsIntentResponse) -> Void) + optional func confirm(intent: INSearchForNotebookItemsIntent) async -> INSearchForNotebookItemsIntentResponse optional func resolveTitle(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveTitle(for intent: INSearchForNotebookItemsIntent) async -> INSpeakableStringResolutionResult optional func resolveContent(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveContent(for intent: INSearchForNotebookItemsIntent) async -> INStringResolutionResult optional func resolveItemType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INNotebookItemTypeResolutionResult) -> Void) + optional func resolveItemType(for intent: INSearchForNotebookItemsIntent) async -> INNotebookItemTypeResolutionResult optional func resolveStatus(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTaskStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSearchForNotebookItemsIntent) async -> INTaskStatusResolutionResult optional func resolveLocation(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocation(for intent: INSearchForNotebookItemsIntent) async -> INPlacemarkResolutionResult optional func resolveLocationSearchType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INLocationSearchTypeResolutionResult) -> Void) + optional func resolveLocationSearchType(for intent: INSearchForNotebookItemsIntent) async -> INLocationSearchTypeResolutionResult optional func resolveDateTime(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateTime(for intent: INSearchForNotebookItemsIntent) async -> INDateComponentsRangeResolutionResult optional func resolveDateSearchType(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INDateSearchTypeResolutionResult) -> Void) + optional func resolveDateSearchType(for intent: INSearchForNotebookItemsIntent) async -> INDateSearchTypeResolutionResult @available(watchOS 6.0, *) optional func resolveTemporalEventTriggerTypes(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTemporalEventTriggerTypeOptionsResolutionResult) -> Void) @available(watchOS 6.0, *) + optional func resolveTemporalEventTriggerTypes(for intent: INSearchForNotebookItemsIntent) async -> INTemporalEventTriggerTypeOptionsResolutionResult + @available(watchOS 6.0, *) optional func resolveTaskPriority(for intent: INSearchForNotebookItemsIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolveTaskPriority(for intent: INSearchForNotebookItemsIntent) async -> INTaskPriorityResolutionResult } diff --git a/watchOS/Intents/INSearchForPhotosIntent.swift b/watchOS/Intents/INSearchForPhotosIntent.swift index f3acd67..0bd5ffe 100644 --- a/watchOS/Intents/INSearchForPhotosIntent.swift +++ b/watchOS/Intents/INSearchForPhotosIntent.swift @@ -15,11 +15,19 @@ class INSearchForPhotosIntent : INIntent { @available(watchOS 3.2, *) protocol INSearchForPhotosIntentHandling : NSObjectProtocol { func handle(intent: INSearchForPhotosIntent, completion: @escaping (INSearchForPhotosIntentResponse) -> Void) + func handle(intent: INSearchForPhotosIntent) async -> INSearchForPhotosIntentResponse optional func confirm(intent: INSearchForPhotosIntent, completion: @escaping (INSearchForPhotosIntentResponse) -> Void) + optional func confirm(intent: INSearchForPhotosIntent) async -> INSearchForPhotosIntentResponse optional func resolveDateCreated(for intent: INSearchForPhotosIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INSearchForPhotosIntent) async -> INDateComponentsRangeResolutionResult optional func resolveLocationCreated(for intent: INSearchForPhotosIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocationCreated(for intent: INSearchForPhotosIntent) async -> INPlacemarkResolutionResult optional func resolveAlbumName(for intent: INSearchForPhotosIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveAlbumName(for intent: INSearchForPhotosIntent) async -> INStringResolutionResult @available(watchOS 4.0, *) optional func resolveSearchTerms(for intent: INSearchForPhotosIntent, with completion: @escaping ([INStringResolutionResult]) -> Void) + @available(watchOS 4.0, *) + optional func resolveSearchTerms(for intent: INSearchForPhotosIntent) async -> [INStringResolutionResult] optional func resolvePeopleInPhoto(for intent: INSearchForPhotosIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolvePeopleInPhoto(for intent: INSearchForPhotosIntent) async -> [INPersonResolutionResult] } diff --git a/watchOS/Intents/INSendMessageIntent.swift b/watchOS/Intents/INSendMessageIntent.swift index d7fdd01..f70ef0a 100644 --- a/watchOS/Intents/INSendMessageIntent.swift +++ b/watchOS/Intents/INSendMessageIntent.swift @@ -19,16 +19,29 @@ class INSendMessageIntent : INIntent { @available(watchOS 3.2, *) protocol INSendMessageIntentHandling : NSObjectProtocol { func handle(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) + func handle(intent: INSendMessageIntent) async -> INSendMessageIntentResponse optional func confirm(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) + optional func confirm(intent: INSendMessageIntent) async -> INSendMessageIntentResponse @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveRecipientsForSendMessage:withCompletion: is deprecated. Use resolveRecipientsForSendMessage:completion: instead") optional func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveRecipientsForSendMessage:withCompletion: is deprecated. Use resolveRecipientsForSendMessage:completion: instead") + optional func resolveRecipients(for intent: INSendMessageIntent) async -> [INPersonResolutionResult] @available(watchOS 4.0, *) optional func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INSendMessageRecipientResolutionResult]) -> Void) + @available(watchOS 4.0, *) + optional func resolveRecipients(for intent: INSendMessageIntent) async -> [INSendMessageRecipientResolutionResult] @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveGroupNameForSendMessage:withCompletion: is deprecated. Use resolveSpeakableGroupNameForSendMessage:withCompletion: instead") optional func resolveGroupName(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveGroupNameForSendMessage:withCompletion: is deprecated. Use resolveSpeakableGroupNameForSendMessage:withCompletion: instead") + optional func resolveGroupName(for intent: INSendMessageIntent) async -> INStringResolutionResult @available(watchOS 7.0, *) optional func resolveOutgoingMessageType(for intent: INSendMessageIntent, with completion: @escaping (INOutgoingMessageTypeResolutionResult) -> Void) + @available(watchOS 7.0, *) + optional func resolveOutgoingMessageType(for intent: INSendMessageIntent) async -> INOutgoingMessageTypeResolutionResult optional func resolveContent(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveContent(for intent: INSendMessageIntent) async -> INStringResolutionResult @available(watchOS 4.0, *) optional func resolveSpeakableGroupName(for intent: INSendMessageIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolveSpeakableGroupName(for intent: INSendMessageIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INSendPaymentIntent.swift b/watchOS/Intents/INSendPaymentIntent.swift index 1e56f51..6388aad 100644 --- a/watchOS/Intents/INSendPaymentIntent.swift +++ b/watchOS/Intents/INSendPaymentIntent.swift @@ -9,14 +9,25 @@ class INSendPaymentIntent : INIntent { @available(watchOS 3.2, *) protocol INSendPaymentIntentHandling : NSObjectProtocol { func handle(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) + func handle(intent: INSendPaymentIntent) async -> INSendPaymentIntentResponse optional func confirm(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) + optional func confirm(intent: INSendPaymentIntent) async -> INSendPaymentIntentResponse @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolvePayeeForSendPayment:withCompletion: is deprecated. Use resolvePayeeForSendPayment:completion: instead") optional func resolvePayee(for intent: INSendPaymentIntent, with completion: @escaping (INPersonResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolvePayeeForSendPayment:withCompletion: is deprecated. Use resolvePayeeForSendPayment:completion: instead") + optional func resolvePayee(for intent: INSendPaymentIntent) async -> INPersonResolutionResult @available(watchOS 4.0, *) optional func resolvePayee(for intent: INSendPaymentIntent, with completion: @escaping (INSendPaymentPayeeResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolvePayee(for intent: INSendPaymentIntent) async -> INSendPaymentPayeeResolutionResult @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCurrencyAmountForSendPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForSendPayment:completion: instead") optional func resolveCurrencyAmount(for intent: INSendPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) + @available(watchOS, introduced: 3.2, deprecated: 4.0, message: "resolveCurrencyAmountForSendPayment:withCompletion: is deprecated. Use resolveCurrencyAmountForSendPayment:completion: instead") + optional func resolveCurrencyAmount(for intent: INSendPaymentIntent) async -> INCurrencyAmountResolutionResult @available(watchOS 4.0, *) optional func resolveCurrencyAmount(for intent: INSendPaymentIntent, with completion: @escaping (INSendPaymentCurrencyAmountResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolveCurrencyAmount(for intent: INSendPaymentIntent) async -> INSendPaymentCurrencyAmountResolutionResult optional func resolveNote(for intent: INSendPaymentIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveNote(for intent: INSendPaymentIntent) async -> INStringResolutionResult } diff --git a/watchOS/Intents/INSetCarLockStatusIntent.swift b/watchOS/Intents/INSetCarLockStatusIntent.swift index b3f8ae2..981b450 100644 --- a/watchOS/Intents/INSetCarLockStatusIntent.swift +++ b/watchOS/Intents/INSetCarLockStatusIntent.swift @@ -16,7 +16,11 @@ extension INSetCarLockStatusIntent { @available(watchOS 3.2, *) protocol INSetCarLockStatusIntentHandling : NSObjectProtocol { func handle(intent: INSetCarLockStatusIntent, completion: @escaping (INSetCarLockStatusIntentResponse) -> Void) + func handle(intent: INSetCarLockStatusIntent) async -> INSetCarLockStatusIntentResponse optional func confirm(intent: INSetCarLockStatusIntent, completion: @escaping (INSetCarLockStatusIntentResponse) -> Void) + optional func confirm(intent: INSetCarLockStatusIntent) async -> INSetCarLockStatusIntentResponse optional func resolveLocked(for intent: INSetCarLockStatusIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveLocked(for intent: INSetCarLockStatusIntent) async -> INBooleanResolutionResult optional func resolveCarName(for intent: INSetCarLockStatusIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveCarName(for intent: INSetCarLockStatusIntent) async -> INSpeakableStringResolutionResult } diff --git a/watchOS/Intents/INSetTaskAttributeIntent.swift b/watchOS/Intents/INSetTaskAttributeIntent.swift index 5673a81..b0e4845 100644 --- a/watchOS/Intents/INSetTaskAttributeIntent.swift +++ b/watchOS/Intents/INSetTaskAttributeIntent.swift @@ -15,16 +15,29 @@ class INSetTaskAttributeIntent : INIntent { @available(watchOS 4.0, *) protocol INSetTaskAttributeIntentHandling : NSObjectProtocol { func handle(intent: INSetTaskAttributeIntent, completion: @escaping (INSetTaskAttributeIntentResponse) -> Void) + func handle(intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeIntentResponse optional func confirm(intent: INSetTaskAttributeIntent, completion: @escaping (INSetTaskAttributeIntentResponse) -> Void) + optional func confirm(intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeIntentResponse optional func resolveTargetTask(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskResolutionResult) -> Void) + optional func resolveTargetTask(for intent: INSetTaskAttributeIntent) async -> INTaskResolutionResult @available(watchOS 6.0, *) optional func resolveTaskTitle(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolveTaskTitle(for intent: INSetTaskAttributeIntent) async -> INSpeakableStringResolutionResult optional func resolveStatus(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskStatusResolutionResult) -> Void) + optional func resolveStatus(for intent: INSetTaskAttributeIntent) async -> INTaskStatusResolutionResult @available(watchOS 6.0, *) optional func resolvePriority(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTaskPriorityResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolvePriority(for intent: INSetTaskAttributeIntent) async -> INTaskPriorityResolutionResult optional func resolveSpatialEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSpatialEventTriggerResolutionResult) -> Void) + optional func resolveSpatialEventTrigger(for intent: INSetTaskAttributeIntent) async -> INSpatialEventTriggerResolutionResult @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTemporalEventTriggerForSetTaskAttribute:withCompletion: is deprecated. Use resolveTemporalEventTriggerForSetTaskAttribute:completion: instead") optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INTemporalEventTriggerResolutionResult) -> Void) + @available(watchOS, introduced: 4.0, deprecated: 6.0, message: "resolveTemporalEventTriggerForSetTaskAttribute:withCompletion: is deprecated. Use resolveTemporalEventTriggerForSetTaskAttribute:completion: instead") + optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent) async -> INTemporalEventTriggerResolutionResult @available(watchOS 6.0, *) optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent, with completion: @escaping (INSetTaskAttributeTemporalEventTriggerResolutionResult) -> Void) + @available(watchOS 6.0, *) + optional func resolveTemporalEventTrigger(for intent: INSetTaskAttributeIntent) async -> INSetTaskAttributeTemporalEventTriggerResolutionResult } diff --git a/watchOS/Intents/INSnoozeTasksIntent.swift b/watchOS/Intents/INSnoozeTasksIntent.swift index 834e681..92b79d0 100644 --- a/watchOS/Intents/INSnoozeTasksIntent.swift +++ b/watchOS/Intents/INSnoozeTasksIntent.swift @@ -17,7 +17,11 @@ extension INSnoozeTasksIntent { @available(watchOS 6.0, *) protocol INSnoozeTasksIntentHandling : NSObjectProtocol { func handle(intent: INSnoozeTasksIntent, completion: @escaping (INSnoozeTasksIntentResponse) -> Void) + func handle(intent: INSnoozeTasksIntent) async -> INSnoozeTasksIntentResponse optional func confirm(intent: INSnoozeTasksIntent, completion: @escaping (INSnoozeTasksIntentResponse) -> Void) + optional func confirm(intent: INSnoozeTasksIntent) async -> INSnoozeTasksIntentResponse optional func resolveTasks(for intent: INSnoozeTasksIntent, with completion: @escaping ([INSnoozeTasksTaskResolutionResult]) -> Void) + optional func resolveTasks(for intent: INSnoozeTasksIntent) async -> [INSnoozeTasksTaskResolutionResult] optional func resolveNextTriggerTime(for intent: INSnoozeTasksIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveNextTriggerTime(for intent: INSnoozeTasksIntent) async -> INDateComponentsRangeResolutionResult } diff --git a/watchOS/Intents/INStartAudioCallIntent.swift b/watchOS/Intents/INStartAudioCallIntent.swift index cfd3852..0396ee7 100644 --- a/watchOS/Intents/INStartAudioCallIntent.swift +++ b/watchOS/Intents/INStartAudioCallIntent.swift @@ -10,8 +10,13 @@ class INStartAudioCallIntent : INIntent { @available(watchOS, introduced: 3.2, deprecated: 6.0, message: "INStartAudioCallIntent is deprecated. Please adopt INStartCallIntent instead") protocol INStartAudioCallIntentHandling : NSObjectProtocol { func handle(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) + func handle(intent: INStartAudioCallIntent) async -> INStartAudioCallIntentResponse optional func confirm(intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) + optional func confirm(intent: INStartAudioCallIntent) async -> INStartAudioCallIntentResponse @available(watchOS 4.0, *) optional func resolveDestinationType(for intent: INStartAudioCallIntent, with completion: @escaping (INCallDestinationTypeResolutionResult) -> Void) + @available(watchOS 4.0, *) + optional func resolveDestinationType(for intent: INStartAudioCallIntent) async -> INCallDestinationTypeResolutionResult optional func resolveContacts(for intent: INStartAudioCallIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolveContacts(for intent: INStartAudioCallIntent) async -> [INPersonResolutionResult] } diff --git a/watchOS/Intents/INStartCallIntent.swift b/watchOS/Intents/INStartCallIntent.swift index 4c1c7d1..fff1fa1 100644 --- a/watchOS/Intents/INStartCallIntent.swift +++ b/watchOS/Intents/INStartCallIntent.swift @@ -15,10 +15,17 @@ class INStartCallIntent : INIntent { @available(watchOS 6.0, *) protocol INStartCallIntentHandling : NSObjectProtocol { func handle(intent: INStartCallIntent, completion: @escaping (INStartCallIntentResponse) -> Void) + func handle(intent: INStartCallIntent) async -> INStartCallIntentResponse optional func confirm(intent: INStartCallIntent, completion: @escaping (INStartCallIntentResponse) -> Void) + optional func confirm(intent: INStartCallIntent) async -> INStartCallIntentResponse @available(watchOS 7.0, *) optional func resolveCallRecordToCallBack(for intent: INStartCallIntent, with completion: @escaping (INCallRecordResolutionResult) -> Void) + @available(watchOS 7.0, *) + optional func resolveCallRecordToCallBack(for intent: INStartCallIntent) async -> INCallRecordResolutionResult optional func resolveDestinationType(for intent: INStartCallIntent, with completion: @escaping (INCallDestinationTypeResolutionResult) -> Void) + optional func resolveDestinationType(for intent: INStartCallIntent) async -> INCallDestinationTypeResolutionResult optional func resolveContacts(for intent: INStartCallIntent, with completion: @escaping ([INStartCallContactResolutionResult]) -> Void) + optional func resolveContacts(for intent: INStartCallIntent) async -> [INStartCallContactResolutionResult] optional func resolveCallCapability(for intent: INStartCallIntent, with completion: @escaping (INStartCallCallCapabilityResolutionResult) -> Void) + optional func resolveCallCapability(for intent: INStartCallIntent) async -> INStartCallCallCapabilityResolutionResult } diff --git a/watchOS/Intents/INStartPhotoPlaybackIntent.swift b/watchOS/Intents/INStartPhotoPlaybackIntent.swift index f63a641..348aa0e 100644 --- a/watchOS/Intents/INStartPhotoPlaybackIntent.swift +++ b/watchOS/Intents/INStartPhotoPlaybackIntent.swift @@ -15,9 +15,15 @@ class INStartPhotoPlaybackIntent : INIntent { @available(watchOS 3.2, *) protocol INStartPhotoPlaybackIntentHandling : NSObjectProtocol { func handle(intent: INStartPhotoPlaybackIntent, completion: @escaping (INStartPhotoPlaybackIntentResponse) -> Void) + func handle(intent: INStartPhotoPlaybackIntent) async -> INStartPhotoPlaybackIntentResponse optional func confirm(intent: INStartPhotoPlaybackIntent, completion: @escaping (INStartPhotoPlaybackIntentResponse) -> Void) + optional func confirm(intent: INStartPhotoPlaybackIntent) async -> INStartPhotoPlaybackIntentResponse optional func resolveDateCreated(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveDateCreated(for intent: INStartPhotoPlaybackIntent) async -> INDateComponentsRangeResolutionResult optional func resolveLocationCreated(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) + optional func resolveLocationCreated(for intent: INStartPhotoPlaybackIntent) async -> INPlacemarkResolutionResult optional func resolveAlbumName(for intent: INStartPhotoPlaybackIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveAlbumName(for intent: INStartPhotoPlaybackIntent) async -> INStringResolutionResult optional func resolvePeopleInPhoto(for intent: INStartPhotoPlaybackIntent, with completion: @escaping ([INPersonResolutionResult]) -> Void) + optional func resolvePeopleInPhoto(for intent: INStartPhotoPlaybackIntent) async -> [INPersonResolutionResult] } diff --git a/watchOS/Intents/INStartWorkoutIntent.swift b/watchOS/Intents/INStartWorkoutIntent.swift index dce7959..8a5a280 100644 --- a/watchOS/Intents/INStartWorkoutIntent.swift +++ b/watchOS/Intents/INStartWorkoutIntent.swift @@ -20,10 +20,17 @@ extension INStartWorkoutIntent { @available(watchOS 3.2, *) protocol INStartWorkoutIntentHandling : NSObjectProtocol { func handle(intent: INStartWorkoutIntent, completion: @escaping (INStartWorkoutIntentResponse) -> Void) + func handle(intent: INStartWorkoutIntent) async -> INStartWorkoutIntentResponse optional func confirm(intent: INStartWorkoutIntent, completion: @escaping (INStartWorkoutIntentResponse) -> Void) + optional func confirm(intent: INStartWorkoutIntent) async -> INStartWorkoutIntentResponse optional func resolveWorkoutName(for intent: INStartWorkoutIntent, with completion: @escaping (INSpeakableStringResolutionResult) -> Void) + optional func resolveWorkoutName(for intent: INStartWorkoutIntent) async -> INSpeakableStringResolutionResult optional func resolveGoalValue(for intent: INStartWorkoutIntent, with completion: @escaping (INDoubleResolutionResult) -> Void) + optional func resolveGoalValue(for intent: INStartWorkoutIntent) async -> INDoubleResolutionResult optional func resolveWorkoutGoalUnitType(for intent: INStartWorkoutIntent, with completion: @escaping (INWorkoutGoalUnitTypeResolutionResult) -> Void) + optional func resolveWorkoutGoalUnitType(for intent: INStartWorkoutIntent) async -> INWorkoutGoalUnitTypeResolutionResult optional func resolveWorkoutLocationType(for intent: INStartWorkoutIntent, with completion: @escaping (INWorkoutLocationTypeResolutionResult) -> Void) + optional func resolveWorkoutLocationType(for intent: INStartWorkoutIntent) async -> INWorkoutLocationTypeResolutionResult optional func resolveIsOpenEnded(for intent: INStartWorkoutIntent, with completion: @escaping (INBooleanResolutionResult) -> Void) + optional func resolveIsOpenEnded(for intent: INStartWorkoutIntent) async -> INBooleanResolutionResult } diff --git a/watchOS/Intents/INTransferMoneyIntent.swift b/watchOS/Intents/INTransferMoneyIntent.swift index 3f5d7fa..ee8df21 100644 --- a/watchOS/Intents/INTransferMoneyIntent.swift +++ b/watchOS/Intents/INTransferMoneyIntent.swift @@ -11,10 +11,17 @@ class INTransferMoneyIntent : INIntent { @available(watchOS 4.0, *) protocol INTransferMoneyIntentHandling : NSObjectProtocol { func handle(intent: INTransferMoneyIntent, completion: @escaping (INTransferMoneyIntentResponse) -> Void) + func handle(intent: INTransferMoneyIntent) async -> INTransferMoneyIntentResponse optional func confirm(intent: INTransferMoneyIntent, completion: @escaping (INTransferMoneyIntentResponse) -> Void) + optional func confirm(intent: INTransferMoneyIntent) async -> INTransferMoneyIntentResponse optional func resolveFromAccount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveFromAccount(for intent: INTransferMoneyIntent) async -> INPaymentAccountResolutionResult optional func resolveToAccount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAccountResolutionResult) -> Void) + optional func resolveToAccount(for intent: INTransferMoneyIntent) async -> INPaymentAccountResolutionResult optional func resolveTransactionAmount(for intent: INTransferMoneyIntent, with completion: @escaping (INPaymentAmountResolutionResult) -> Void) + optional func resolveTransactionAmount(for intent: INTransferMoneyIntent) async -> INPaymentAmountResolutionResult optional func resolveTransactionScheduledDate(for intent: INTransferMoneyIntent, with completion: @escaping (INDateComponentsRangeResolutionResult) -> Void) + optional func resolveTransactionScheduledDate(for intent: INTransferMoneyIntent) async -> INDateComponentsRangeResolutionResult optional func resolveTransactionNote(for intent: INTransferMoneyIntent, with completion: @escaping (INStringResolutionResult) -> Void) + optional func resolveTransactionNote(for intent: INTransferMoneyIntent) async -> INStringResolutionResult } diff --git a/watchOS/Intents/INUpdateMediaAffinityIntent.swift b/watchOS/Intents/INUpdateMediaAffinityIntent.swift index fdc8994..3099718 100644 --- a/watchOS/Intents/INUpdateMediaAffinityIntent.swift +++ b/watchOS/Intents/INUpdateMediaAffinityIntent.swift @@ -9,7 +9,11 @@ class INUpdateMediaAffinityIntent : INIntent { @available(watchOS 6.0, *) protocol INUpdateMediaAffinityIntentHandling : NSObjectProtocol { func handle(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + func handle(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func confirm(intent: INUpdateMediaAffinityIntent, completion: @escaping (INUpdateMediaAffinityIntentResponse) -> Void) + optional func confirm(intent: INUpdateMediaAffinityIntent) async -> INUpdateMediaAffinityIntentResponse optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent, with completion: @escaping ([INUpdateMediaAffinityMediaItemResolutionResult]) -> Void) + optional func resolveMediaItems(for intent: INUpdateMediaAffinityIntent) async -> [INUpdateMediaAffinityMediaItemResolutionResult] optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent, with completion: @escaping (INMediaAffinityTypeResolutionResult) -> Void) + optional func resolveAffinityType(for intent: INUpdateMediaAffinityIntent) async -> INMediaAffinityTypeResolutionResult } diff --git a/watchOS/Intents/INVoiceShortcutCenter.swift b/watchOS/Intents/INVoiceShortcutCenter.swift index 2174e71..4e3800b 100644 --- a/watchOS/Intents/INVoiceShortcutCenter.swift +++ b/watchOS/Intents/INVoiceShortcutCenter.swift @@ -3,6 +3,8 @@ class INVoiceShortcutCenter : NSObject { class var shared: INVoiceShortcutCenter { get } func getAllVoiceShortcuts(completion completionHandler: @escaping ([INVoiceShortcut]?, Error?) -> Void) + func allVoiceShortcuts() async throws -> [INVoiceShortcut] func getVoiceShortcut(with identifier: UUID, completion completionHandler: @escaping (INVoiceShortcut?, Error?) -> Void) + func getVoiceShortcut(with identifier: UUID) async throws -> INVoiceShortcut func setShortcutSuggestions(_ suggestions: [INShortcut]) } diff --git a/watchOS/NaturalLanguage/NLTagger.swift b/watchOS/NaturalLanguage/NLTagger.swift index d0ed345..90e637b 100644 --- a/watchOS/NaturalLanguage/NLTagger.swift +++ b/watchOS/NaturalLanguage/NLTagger.swift @@ -37,6 +37,8 @@ class NLTagger : NSObject { func gazetteers(for tagScheme: NLTagScheme) -> [NLGazetteer] @available(watchOS 6.0, *) class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme, completionHandler: @escaping (NLTagger.AssetsResult, Error?) -> Void) + @available(watchOS 6.0, *) + class func requestAssets(for language: NLLanguage, tagScheme: NLTagScheme) async throws -> NLTagger.AssetsResult } @available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) diff --git a/watchOS/NetworkExtension/NetworkExtension.swift b/watchOS/NetworkExtension/NetworkExtension.swift index 05b08ec..f0a7aa9 100644 --- a/watchOS/NetworkExtension/NetworkExtension.swift +++ b/watchOS/NetworkExtension/NetworkExtension.swift @@ -36,6 +36,8 @@ class NEHotspotNetwork : NSObject { var bssid: String { get } @available(watchOS 7.0, *) class func fetchCurrent(completionHandler: @escaping (NEHotspotNetwork?) -> Void) + @available(watchOS 7.0, *) + class func fetchCurrent() async -> NEHotspotNetwork? } extension NSMutableURLRequest { } @@ -91,9 +93,13 @@ class NEHotspotConfigurationManager : NSObject { @available(watchOS 7.0, *) func apply(_ configuration: NEHotspotConfiguration, completionHandler: ((Error?) -> Void)? = nil) @available(watchOS 7.0, *) + func apply(_ configuration: NEHotspotConfiguration) async throws + @available(watchOS 7.0, *) func removeConfiguration(forSSID SSID: String) @available(watchOS 7.0, *) func getConfiguredSSIDs(completionHandler: @escaping ([String]) -> Void) + @available(watchOS 7.0, *) + func configuredSSIDs() async -> [String] } @available(watchOS 2.0, *) class NEIPv6Route : NSObject, NSSecureCoding, NSCopying { diff --git a/watchOS/PassKit/PKPassLibrary.swift b/watchOS/PassKit/PKPassLibrary.swift index 1066383..f74c3f6 100644 --- a/watchOS/PassKit/PKPassLibrary.swift +++ b/watchOS/PassKit/PKPassLibrary.swift @@ -31,6 +31,8 @@ class PKPassLibrary : NSObject { func replacePass(with pass: PKPass) -> Bool @available(watchOS 3.0, *) func addPasses(_ passes: [PKPass], withCompletionHandler completion: ((PKPassLibraryAddPassesStatus) -> Void)? = nil) + @available(watchOS 3.0, *) + func addPasses(_ passes: [PKPass]) async -> PKPassLibraryAddPassesStatus @available(watchOS, introduced: 2.0, deprecated: 99993, message: "Use -[PKPassLibrary canAddSecureElementPassWithPrimaryAccountIdentifier] instead") func canAddPaymentPass(withPrimaryAccountIdentifier primaryAccountIdentifier: String) -> Bool @available(watchOS 6.4, *) @@ -39,8 +41,12 @@ class PKPassLibrary : NSObject { func canAddFelicaPass() -> Bool @available(watchOS, introduced: 2.0, deprecated: 99993, message: "Use activateSecureElementPass:withActivationData:completion: instead") func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data, completion: ((Bool, Error) -> Void)? = nil) + @available(watchOS, introduced: 2.0, deprecated: 99993, message: "Use activateSecureElementPass:withActivationData:completion: instead") + func activate(_ paymentPass: PKPaymentPass, withActivationData activationData: Data) async -> (Bool, Error) @available(watchOS 6.2, *) func sign(_ signData: Data, using secureElementPass: PKSecureElementPass, completion: @escaping (Data?, Data?, Error?) -> Void) + @available(watchOS 6.2, *) + func sign(_ signData: Data, using secureElementPass: PKSecureElementPass) async throws -> (Data, Data) } struct PKPassLibraryNotificationName : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable { init(_ rawValue: String) diff --git a/watchOS/PassKit/PKPaymentAuthorizationController.swift b/watchOS/PassKit/PKPaymentAuthorizationController.swift index 869a316..3847b28 100644 --- a/watchOS/PassKit/PKPaymentAuthorizationController.swift +++ b/watchOS/PassKit/PKPaymentAuthorizationController.swift @@ -4,8 +4,12 @@ protocol PKPaymentAuthorizationControllerDelegate : NSObjectProtocol { func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) @available(watchOS 4.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) + @available(watchOS 4.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationResult @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didAuthorizePayment:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) + @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didAuthorizePayment:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment) async -> PKPaymentAuthorizationStatus @available(watchOS 3.0, *) optional func paymentAuthorizationControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationController) @available(watchOS 7.0, *) @@ -13,15 +17,27 @@ protocol PKPaymentAuthorizationControllerDelegate : NSObjectProtocol { @available(watchOS 4.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) @available(watchOS 4.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> PKPaymentRequestShippingMethodUpdate + @available(watchOS 4.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) @available(watchOS 4.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> PKPaymentRequestShippingContactUpdate + @available(watchOS 4.0, *) optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, handler completion: @escaping (PKPaymentRequestPaymentMethodUpdate) -> Void) + @available(watchOS 4.0, *) + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectShippingMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod, completion: @escaping (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) -> Void) + @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectShippingMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingMethod shippingMethod: PKShippingMethod) async -> (PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]) @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectShippingContact:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact, completion: @escaping (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) -> Void) + @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectShippingContact:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectShippingContact contact: PKContact) async -> (PKPaymentAuthorizationStatus, [PKShippingMethod], [PKPaymentSummaryItem]) @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectPaymentMethod:handler: instead to provide more granular errors") optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod, completion: @escaping ([PKPaymentSummaryItem]) -> Void) + @available(watchOS, introduced: 3.0, deprecated: 4.0, message: "Use paymentAuthorizationController:didSelectPaymentMethod:handler: instead to provide more granular errors") + optional func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> [PKPaymentSummaryItem] } @available(watchOS 3.0, *) class PKPaymentAuthorizationController : NSObject { @@ -31,5 +47,7 @@ class PKPaymentAuthorizationController : NSObject { weak var delegate: @sil_weak PKPaymentAuthorizationControllerDelegate? init(paymentRequest request: PKPaymentRequest) func present(completion: ((Bool) -> Void)? = nil) + func present() async -> Bool func dismiss(completion: (() -> Void)? = nil) + func dismiss() async } diff --git a/watchOS/PassKit/PKPaymentInformationEventExtension.swift b/watchOS/PassKit/PKPaymentInformationEventExtension.swift index 0afc22b..3eb3e36 100644 --- a/watchOS/PassKit/PKPaymentInformationEventExtension.swift +++ b/watchOS/PassKit/PKPaymentInformationEventExtension.swift @@ -8,7 +8,13 @@ protocol PKPaymentInformationRequestHandling { @available(watchOS 7.0, *) func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest, completion: @escaping PKInformationRequestCompletionBlock) @available(watchOS 7.0, *) + func handleInformationRequest(_ infoRequest: PKBarcodeEventMetadataRequest) async -> PKBarcodeEventMetadataResponse + @available(watchOS 7.0, *) func handle(_ signatureRequest: PKBarcodeEventSignatureRequest, completion: @escaping PKSignatureRequestCompletionBlock) @available(watchOS 7.0, *) + func handle(_ signatureRequest: PKBarcodeEventSignatureRequest) async -> PKBarcodeEventSignatureResponse + @available(watchOS 7.0, *) func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest, completion: @escaping () -> Void) + @available(watchOS 7.0, *) + func handle(_ configurationRequest: PKBarcodeEventConfigurationRequest) async } diff --git a/watchOS/PushKit/PKPushRegistry.swift b/watchOS/PushKit/PKPushRegistry.swift index b642cea..f1edc79 100644 --- a/watchOS/PushKit/PKPushRegistry.swift +++ b/watchOS/PushKit/PKPushRegistry.swift @@ -16,5 +16,7 @@ protocol PKPushRegistryDelegate : NSObjectProtocol { @available(watchOS 6.0, *) optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) @available(watchOS 6.0, *) + optional func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async + @available(watchOS 6.0, *) optional func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) } diff --git a/watchOS/SceneKit/SCNAction.swift b/watchOS/SceneKit/SCNAction.swift index 1420d82..a63ed1b 100644 --- a/watchOS/SceneKit/SCNAction.swift +++ b/watchOS/SceneKit/SCNAction.swift @@ -3,8 +3,10 @@ typealias SCNActionTimingFunction = (Float) -> Float protocol SCNActionable : NSObjectProtocol { func runAction(_ action: SCNAction) func runAction(_ action: SCNAction, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction) async func runAction(_ action: SCNAction, forKey key: String?) func runAction(_ action: SCNAction, forKey key: String?, completionHandler block: (() -> Void)? = nil) + func runAction(_ action: SCNAction, forKey key: String?) async var hasActions: Bool { get } func action(forKey key: String) -> SCNAction? func removeAction(forKey key: String) diff --git a/watchOS/SceneKit/SCNSceneRenderer.swift b/watchOS/SceneKit/SCNSceneRenderer.swift index 93e6a0f..cd14a22 100644 --- a/watchOS/SceneKit/SCNSceneRenderer.swift +++ b/watchOS/SceneKit/SCNSceneRenderer.swift @@ -53,6 +53,7 @@ protocol SCNSceneRenderer : NSObjectProtocol { var isTemporalAntialiasingEnabled: Bool { get set } func prepare(_ object: Any, shouldAbortBlock block: (() -> Bool)? = nil) -> Bool func prepare(_ objects: [Any], completionHandler: ((Bool) -> Void)? = nil) + func prepare(_ objects: [Any]) async -> Bool var showsStatistics: Bool { get set } @available(watchOS 2.0, *) var debugOptions: SCNDebugOptions { get set } diff --git a/watchOS/SoundAnalysis/SNAnalyzer.swift b/watchOS/SoundAnalysis/SNAnalyzer.swift index 54ce701..919d21d 100644 --- a/watchOS/SoundAnalysis/SNAnalyzer.swift +++ b/watchOS/SoundAnalysis/SNAnalyzer.swift @@ -16,5 +16,6 @@ class SNAudioFileAnalyzer : NSObject { func removeAllRequests() func analyze() func analyze(completionHandler: @escaping (Bool) -> Void) + func analyze() async -> Bool func cancelAnalysis() } diff --git a/watchOS/SpriteKit/SKNode.swift b/watchOS/SpriteKit/SKNode.swift index 0076c55..66a4201 100644 --- a/watchOS/SpriteKit/SKNode.swift +++ b/watchOS/SpriteKit/SKNode.swift @@ -56,6 +56,7 @@ class SKNode : NSObject, NSCopying, NSSecureCoding { func inParentHierarchy(_ parent: SKNode) -> Bool func run(_ action: SKAction) func run(_ action: SKAction, completion block: @escaping () -> Void) + func run(_ action: SKAction) async func run(_ action: SKAction, withKey key: String) func hasActions() -> Bool func action(forKey key: String) -> SKAction? diff --git a/watchOS/SpriteKit/SKTexture.swift b/watchOS/SpriteKit/SKTexture.swift index bfd8f7a..4e1524b 100644 --- a/watchOS/SpriteKit/SKTexture.swift +++ b/watchOS/SpriteKit/SKTexture.swift @@ -29,7 +29,9 @@ class SKTexture : NSObject, NSCopying, NSSecureCoding { @available(watchOS 2.0, *) func cgImage() -> CGImage class func preload(_ textures: [SKTexture], withCompletionHandler completionHandler: @escaping () -> Void) + class func preload(_ textures: [SKTexture]) async func preload(completionHandler: @escaping () -> Void) + func preload() async } extension SKTexture : _CustomPlaygroundQuickLookable { diff --git a/watchOS/SpriteKit/SKTextureAtlas.swift b/watchOS/SpriteKit/SKTextureAtlas.swift index b01e8df..04f1d6c 100644 --- a/watchOS/SpriteKit/SKTextureAtlas.swift +++ b/watchOS/SpriteKit/SKTextureAtlas.swift @@ -5,9 +5,13 @@ class SKTextureAtlas : NSObject, NSSecureCoding { convenience init(dictionary properties: [String : Any]) func textureNamed(_ name: String) -> SKTexture class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas], withCompletionHandler completionHandler: @escaping () -> Void) + class func preloadTextureAtlases(_ textureAtlases: [SKTextureAtlas]) async @available(watchOS 2.0, *) class func preloadTextureAtlasesNamed(_ atlasNames: [String], withCompletionHandler completionHandler: @escaping (Error?, [SKTextureAtlas]) -> Void) + @available(watchOS 2.0, *) + class func preloadTextureAtlasesNamed(_ atlasNames: [String]) async throws -> [SKTextureAtlas] func preload(completionHandler: @escaping () -> Void) + func preload() async var textureNames: [String] { get } } diff --git a/watchOS/StoreKit/SKCloudServiceController.swift b/watchOS/StoreKit/SKCloudServiceController.swift index 8c537a2..9da7adb 100644 --- a/watchOS/StoreKit/SKCloudServiceController.swift +++ b/watchOS/StoreKit/SKCloudServiceController.swift @@ -25,12 +25,20 @@ class SKCloudServiceController : NSObject { class func requestAuthorization(_ handler: @escaping (SKCloudServiceAuthorizationStatus) -> Void) @available(watchOS 7.0, *) func requestCapabilities(completionHandler: @escaping (SKCloudServiceCapability, Error?) -> Void) + @available(watchOS 7.0, *) + func requestCapabilities() async throws -> SKCloudServiceCapability @available(watchOS 4.0, *) func requestStorefrontCountryCode(completionHandler: @escaping (String?, Error?) -> Void) + @available(watchOS 4.0, *) + func requestStorefrontCountryCode() async throws -> String @available(watchOS 7.0, *) func requestStorefrontIdentifier(completionHandler: @escaping (String?, Error?) -> Void) @available(watchOS 7.0, *) + func requestStorefrontIdentifier() async throws -> String + @available(watchOS 7.0, *) func requestUserToken(forDeveloperToken developerToken: String, completionHandler: @escaping (String?, Error?) -> Void) + @available(watchOS 7.0, *) + func requestUserToken(forDeveloperToken developerToken: String) async throws -> String } extension NSNotification.Name { @available(watchOS 7.0, *) diff --git a/watchOS/SwiftUI/SwiftUI.swift b/watchOS/SwiftUI/SwiftUI.swift index a3f610c..d1e222e 100644 --- a/watchOS/SwiftUI/SwiftUI.swift +++ b/watchOS/SwiftUI/SwiftUI.swift @@ -3091,7 +3091,7 @@ extension Scene { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct SceneBuilder { +@resultBuilder struct SceneBuilder { static func buildBlock(_ content: Content) -> Content where Content : Scene } @@ -3715,7 +3715,7 @@ extension ToolbarContent { } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) -@_functionBuilder struct ToolbarContentBuilder { +@resultBuilder struct ToolbarContentBuilder { static func buildBlock(_ content: Content) -> some ToolbarContent where Content : ToolbarContent static func buildBlock(_ content: Content) -> some CustomizableToolbarContent where Content : CustomizableToolbarContent @@ -5122,7 +5122,7 @@ extension View { } @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) -@_functionBuilder struct ViewBuilder { +@resultBuilder struct ViewBuilder { @_alwaysEmitIntoClient static func buildBlock() -> EmptyView @_alwaysEmitIntoClient static func buildBlock(_ content: Content) -> Content where Content : View } diff --git a/watchOS/UserNotifications/UNUserNotificationCenter.swift b/watchOS/UserNotifications/UNUserNotificationCenter.swift index 047ebee..a5b5f31 100644 --- a/watchOS/UserNotifications/UNUserNotificationCenter.swift +++ b/watchOS/UserNotifications/UNUserNotificationCenter.swift @@ -22,14 +22,20 @@ class UNUserNotificationCenter : NSObject { var supportsContentExtensions: Bool { get } class func current() -> UNUserNotificationCenter func requestAuthorization(options: UNAuthorizationOptions = [], completionHandler: @escaping (Bool, Error?) -> Void) + func requestAuthorization(options: UNAuthorizationOptions = []) async throws -> Bool func setNotificationCategories(_ categories: Set) func getNotificationCategories(completionHandler: @escaping (Set) -> Void) + func notificationCategories() async -> Set func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void) + func notificationSettings() async -> UNNotificationSettings func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -> Void)? = nil) + func add(_ request: UNNotificationRequest) async throws func getPendingNotificationRequests(completionHandler: @escaping ([UNNotificationRequest]) -> Void) + func pendingNotificationRequests() async -> [UNNotificationRequest] func removePendingNotificationRequests(withIdentifiers identifiers: [String]) func removeAllPendingNotificationRequests() func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) -> Void) + func deliveredNotifications() async -> [UNNotification] func removeDeliveredNotifications(withIdentifiers identifiers: [String]) func removeAllDeliveredNotifications() } @@ -51,5 +57,9 @@ protocol UNUserNotificationCenterDelegate : NSObjectProtocol { @available(watchOS 3.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) @available(watchOS 3.0, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions + @available(watchOS 3.0, *) optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) + @available(watchOS 3.0, *) + optional func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async } diff --git a/watchOS/WatchKit/WKExtension.swift b/watchOS/WatchKit/WKExtension.swift index f3458c1..3dba031 100644 --- a/watchOS/WatchKit/WKExtension.swift +++ b/watchOS/WatchKit/WKExtension.swift @@ -70,6 +70,8 @@ protocol WKExtensionDelegate : NSObjectProtocol { optional func didFailToRegisterForRemoteNotificationsWithError(_ error: Error) @available(watchOS 6.0, *) optional func didReceiveRemoteNotification(_ userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (WKBackgroundFetchResult) -> Void) + @available(watchOS 6.0, *) + optional func didReceiveRemoteNotification(_ userInfo: [AnyHashable : Any]) async -> WKBackgroundFetchResult @available(watchOS 2.0, *) @available(watchOS, deprecated: 3.0, message: "use UNUserNotificationCenterDelegate") optional func handleAction(withIdentifier identifier: String?, forRemoteNotification remoteNotification: [AnyHashable : Any]) diff --git a/watchOS/WatchKit/WKInterfaceController.swift b/watchOS/WatchKit/WKInterfaceController.swift index 43d1593..a24ee1a 100644 --- a/watchOS/WatchKit/WKInterfaceController.swift +++ b/watchOS/WatchKit/WKInterfaceController.swift @@ -118,15 +118,21 @@ class WKInterfaceController : NSObject { func presentController(withNames names: [String], contexts: [Any]?) func dismiss() func presentTextInputController(withSuggestions suggestions: [String]?, allowedInputMode inputMode: WKTextInputMode, completion: @escaping ([Any]?) -> Void) + func presentTextInputController(withSuggestions suggestions: [String]?, allowedInputMode inputMode: WKTextInputMode) async -> [Any]? func presentTextInputControllerWithSuggestions(forLanguage suggestionsHandler: ((String) -> [Any]?)?, allowedInputMode inputMode: WKTextInputMode, completion: @escaping ([Any]?) -> Void) + func presentTextInputControllerWithSuggestions(forLanguage suggestionsHandler: ((String) -> [Any]?)?, allowedInputMode inputMode: WKTextInputMode) async -> [Any]? func dismissTextInputController() @available(watchOS 2.0, *) func presentMediaPlayerController(with URL: URL, options: [AnyHashable : Any]? = nil, completion: @escaping (Bool, TimeInterval, Error?) -> Void) @available(watchOS 2.0, *) + func presentMediaPlayerController(with URL: URL, options: [AnyHashable : Any]? = nil) async throws -> (Bool, TimeInterval) + @available(watchOS 2.0, *) func dismissMediaPlayerController() @available(watchOS 2.0, *) func presentAudioRecorderController(withOutputURL URL: URL, preset: WKAudioRecorderPreset, options: [AnyHashable : Any]? = nil, completion: @escaping (Bool, Error?) -> Void) @available(watchOS 2.0, *) + func presentAudioRecorderController(withOutputURL URL: URL, preset: WKAudioRecorderPreset, options: [AnyHashable : Any]? = nil) async throws -> Bool + @available(watchOS 2.0, *) func dismissAudioRecorderController() func contextForSegue(withIdentifier segueIdentifier: String) -> Any? func contextsForSegue(withIdentifier segueIdentifier: String) -> [Any]?