From caac1334d12216950d6f99b3543a4afa35967a88 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Mon, 12 Aug 2024 22:38:23 +0200 Subject: [PATCH] More fix to Archive --- .../Editor/Components/GIF/GIFPickerView.swift | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift index 0227353da..7c8467ed7 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift @@ -1,9 +1,10 @@ #if !os(visionOS) && !DEBUG import DesignSystem - import GiphyUISDK + @preconcurrency import GiphyUISDK import SwiftUI import UIKit - + + @MainActor struct GifPickerView: UIViewControllerRepresentable { @Environment(Theme.self) private var theme @@ -33,6 +34,7 @@ GifPickerView.Coordinator(parent: self) } + @MainActor class Coordinator: NSObject, GiphyDelegate { var parent: GifPickerView @@ -40,13 +42,17 @@ self.parent = parent } - @MainActor func didDismiss(controller _: GiphyViewController?) { - parent.onShouldDismissGifPicker() + nonisolated func didDismiss(controller _: GiphyViewController?) { + Task { @MainActor in + parent.onShouldDismissGifPicker() + } } - @MainActor func didSelectMedia(giphyViewController _: GiphyViewController, media: GPHMedia) { - let url = media.url(rendition: .fixedWidth, fileType: .gif) - parent.completion(url ?? "") + nonisolated func didSelectMedia(giphyViewController _: GiphyViewController, media: GPHMedia) { + Task { @MainActor in + let url = media.url(rendition: .fixedWidth, fileType: .gif) + parent.completion(url ?? "") + } } } }