From 95db590aba258019ef35f193a1ce5bf4b28e66f0 Mon Sep 17 00:00:00 2001 From: Alexis Bronchart Date: Tue, 15 Oct 2024 09:57:29 +0200 Subject: [PATCH] Perform emoji selection on main thread --- Sources/ElegantEmojiPicker.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/ElegantEmojiPicker.swift b/Sources/ElegantEmojiPicker.swift index cdb6af9..ed951c2 100644 --- a/Sources/ElegantEmojiPicker.swift +++ b/Sources/ElegantEmojiPicker.swift @@ -339,8 +339,10 @@ extension ElegantEmojiPicker: UICollectionViewDelegate, UICollectionViewDataSour } public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let selection = searchResults?[indexPath.row] ?? emojiSections[indexPath.section].emojis[indexPath.row] - didSelectEmoji(selection) + DispatchQueue.main.async { + let selection = searchResults?[indexPath.row] ?? emojiSections[indexPath.section].emojis[indexPath.row] + didSelectEmoji(selection) + } } public func scrollViewDidScroll(_ scrollView: UIScrollView) {