From 122a0052ae25de79feb7a1106dcc3dd8dd8e578a Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 23 Jun 2026 11:55:01 +0300 Subject: [PATCH] Drop the unnecessary @Sendable from the composer attribute enumeration `NSMutableAttributedString.enumerateAttribute(_:in:options:using:)` runs its closure synchronously on the calling thread and its `using:` parameter isn't `@Sendable`. The explicit `@Sendable` on the closure literals was therefore unnecessary and was the only thing triggering the "capture of non-Sendable NSMutableAttributedString" and "mutation of captured var in concurrently- executing code" warnings. Removing it clears all six with no behaviour change. --- .../RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift index 0609d252a..018da435e 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift @@ -405,7 +405,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool repeat { // Don't enumerate and mutate at the same time, big no no shouldMakeAnotherPass = false - attributedString.enumerateAttribute(.link, in: .init(location: 0, length: attributedString.length), options: []) { @Sendable value, range, stop in + attributedString.enumerateAttribute(.link, in: .init(location: 0, length: attributedString.length), options: []) { value, range, stop in guard let value else { return } shouldMakeAnotherPass = true @@ -429,7 +429,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool repeat { shouldMakeAnotherPass = false - attributedString.enumerateAttribute(.MatrixAllUsersMention, in: .init(location: 0, length: attributedString.length), options: []) { @Sendable value, range, stop in + attributedString.enumerateAttribute(.MatrixAllUsersMention, in: .init(location: 0, length: attributedString.length), options: []) { value, range, stop in guard value != nil else { return } shouldMakeAnotherPass = true