From 5f9973352d72ebdf46f939a1e91f8217480b5625 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sat, 8 Aug 2020 17:08:06 -0700 Subject: [PATCH] Reformatting --- .../NSMutableAttributedString+Extensions.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Shared/Extensions/NSMutableAttributedString+Extensions.swift b/Shared/Extensions/NSMutableAttributedString+Extensions.swift index 9038738..ae79f47 100644 --- a/Shared/Extensions/NSMutableAttributedString+Extensions.swift +++ b/Shared/Extensions/NSMutableAttributedString+Extensions.swift @@ -8,7 +8,7 @@ import AppKit import Kingfisher extension NSMutableAttributedString { - func insert(emojis: [Emoji], onImageLoad: (() -> Void)?) { + func insert(emojis: [Emoji], onImageLoad: @escaping (() -> Void)) { for emoji in emojis { let token = ":\(emoji.shortcode):" @@ -18,10 +18,11 @@ extension NSMutableAttributedString { replaceCharacters(in: NSRange(tokenRange, in: string), with: attachmentAttributedString) - KingfisherManager.shared.retrieveImage(with: emoji.url) { result in - guard case let .success(value) = result else { return } + KingfisherManager.shared.retrieveImage(with: emoji.url) { + guard case let .success(value) = $0 else { return } + attachment.image = value.image - onImageLoad?() + onImageLoad() } } }