From cb1b35c008a8be8cd0871913d26a3dbb9cbeca4d Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Sun, 18 Dec 2022 01:17:35 +0100 Subject: [PATCH] Fix iOS 15-deprecation-warning --- .../Sources/MastodonCore/Vendor/ItemProviderLoader.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift index 9899620fe..ad26e0ceb 100644 --- a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift +++ b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift @@ -48,13 +48,13 @@ extension ItemProviderLoader { let maxPixelSize: Int = 1536 // fit 120MB RAM limit #endif - let downsampleOptions = [ + let downsampleOptions: [CFString: Any] = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: maxPixelSize, - ] as CFDictionary + ] - guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else { + guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions as CFDictionary) else { // fallback to loadItem when create thumbnail failure itemProvider.loadItem(forTypeIdentifier: UTType.image.identifier, options: nil) { image, error in if let error = error { @@ -77,7 +77,7 @@ extension ItemProviderLoader { } let data = NSMutableData() - guard let imageDestination = CGImageDestinationCreateWithData(data, kUTTypeJPEG, 1, nil) else { + guard let imageDestination = CGImageDestinationCreateWithData(data, UTType.jpeg.identifier as CFString, 1, nil) else { promise(.success(nil)) return }