From 382b9a69c303f7ef6692a64897d9cffa338c7e13 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 16 Feb 2024 19:15:14 +0000 Subject: [PATCH] Fix a retain cycle on MessageText. This was generating warnings about an excessive number of gesture recognisers. --- ElementX/Sources/Other/Pills/MessageText.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Other/Pills/MessageText.swift b/ElementX/Sources/Other/Pills/MessageText.swift index 634fc4c0b7..ff5e116157 100644 --- a/ElementX/Sources/Other/Pills/MessageText.swift +++ b/ElementX/Sources/Other/Pills/MessageText.swift @@ -66,7 +66,8 @@ struct MessageText: UIViewRepresentable { // Need to use TextKit 1 for mentions let textView = MessageTextView(usingTextLayoutManager: false) textView.roomContext = viewModel - textView.updateClosure = { + textView.updateClosure = { [weak textView] in + guard let textView else { return } do { attributedString = try AttributedString(textView.attributedText, including: \.elementX) } catch {