From 6ec1f0eb100a4c9e9c2127f47d4ca61c28bcbe54 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 8 Jun 2026 10:46:34 +0200 Subject: [PATCH] swiftformat --- .../View/GlobalSearchScreen.swift | 10 ++-- .../View/MediaEventsTimelineScreen.swift | 50 +++++++++---------- .../View/MessageComposerTextField.swift | 14 +++--- .../Timeline/View/Style/TimelineStyler.swift | 2 +- .../LiveLocationRoomTimelineView.swift | 2 +- 5 files changed, 36 insertions(+), 42 deletions(-) diff --git a/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift b/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift index be40fc3a7..24e4ac9dd 100644 --- a/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift +++ b/ElementX/Sources/Screens/GlobalSearchScreen/View/GlobalSearchScreen.swift @@ -92,13 +92,11 @@ struct GlobalSearchScreen: View { } private var keyboardShortcuts: some View { - Group { - Button("") { - context.send(viewAction: .dismiss) - } - // Need this to enable escape on the textField and forward the presses - .keyboardShortcut(.escape, modifiers: []) + Button("") { + context.send(viewAction: .dismiss) } + // Need this to enable escape on the textField and forward the presses + .keyboardShortcut(.escape, modifiers: []) } private func backgroundColor(for room: GlobalSearchRoom) -> Color { diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/MediaEventsTimelineScreen.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/MediaEventsTimelineScreen.swift index ac2d535d2..d42cce220 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/MediaEventsTimelineScreen.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/MediaEventsTimelineScreen.swift @@ -187,36 +187,34 @@ struct MediaEventsTimelineScreen: View { } bottomContent: { EmptyView() } } + @ViewBuilder private var emptyMedia: some View { - Group { - BigIcon(icon: \.image) - - Text(L10n.screenMediaBrowserMediaEmptyStateTitle) - .foregroundColor(.compound.textPrimary) - .font(.compound.headingMDBold) - .multilineTextAlignment(.center) - - Text(L10n.screenMediaBrowserMediaEmptyStateSubtitle) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodyMD) - .multilineTextAlignment(.center) - } + BigIcon(icon: \.image) + + Text(L10n.screenMediaBrowserMediaEmptyStateTitle) + .foregroundColor(.compound.textPrimary) + .font(.compound.headingMDBold) + .multilineTextAlignment(.center) + + Text(L10n.screenMediaBrowserMediaEmptyStateSubtitle) + .foregroundColor(.compound.textSecondary) + .font(.compound.bodyMD) + .multilineTextAlignment(.center) } + @ViewBuilder private var emptyFiles: some View { - Group { - BigIcon(icon: \.document) - - Text(L10n.screenMediaBrowserFilesEmptyStateTitle) - .foregroundColor(.compound.textPrimary) - .font(.compound.headingMDBold) - .multilineTextAlignment(.center) - - Text(L10n.screenMediaBrowserFilesEmptyStateSubtitle) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodyMD) - .multilineTextAlignment(.center) - } + BigIcon(icon: \.document) + + Text(L10n.screenMediaBrowserFilesEmptyStateTitle) + .foregroundColor(.compound.textPrimary) + .font(.compound.headingMDBold) + .multilineTextAlignment(.center) + + Text(L10n.screenMediaBrowserFilesEmptyStateSubtitle) + .foregroundColor(.compound.textSecondary) + .font(.compound.bodyMD) + .multilineTextAlignment(.center) } @ToolbarContentBuilder diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift index e70ed505d..48396bd22 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift @@ -42,13 +42,11 @@ struct MessageComposerTextField: View { } private var keyboardShortcuts: some View { - Group { - Button("") { - keyHandler(.keyboardEscape) - } - // Need this to enable escape on the textView and forward the presses - .keyboardShortcut(.escape, modifiers: []) + Button("") { + keyHandler(.keyboardEscape) } + // Need this to enable escape on the textView and forward the presses + .keyboardShortcut(.escape, modifiers: []) } } @@ -346,8 +344,8 @@ struct MessageComposerTextField_Previews: PreviewProvider, TestablePreview { @State var text: NSAttributedString init(text: String) { - _text = .init(initialValue: .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body), - .foregroundColor: UIColor.compound.textPrimary])) + self.text = .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body), + .foregroundColor: UIColor.compound.textPrimary]) } var body: some View { diff --git a/ElementX/Sources/Screens/Timeline/View/Style/TimelineStyler.swift b/ElementX/Sources/Screens/Timeline/View/Style/TimelineStyler.swift index e2d16acee..9e1378144 100644 --- a/ElementX/Sources/Screens/Timeline/View/Style/TimelineStyler.swift +++ b/ElementX/Sources/Screens/Timeline/View/Style/TimelineStyler.swift @@ -21,7 +21,7 @@ struct TimelineStyler: View { init(timelineItem: EventBasedTimelineItemProtocol, @ViewBuilder content: @escaping () -> Content) { self.timelineItem = timelineItem self.content = content - _adjustedDeliveryStatus = State(initialValue: timelineItem.properties.deliveryStatus) + adjustedDeliveryStatus = timelineItem.properties.deliveryStatus } var body: some View { diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift index bbf8b4c8b..48c4c67b6 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift @@ -18,7 +18,7 @@ struct LiveLocationRoomTimelineView: View { init(currentDate: Date = .now, timelineItem: LiveLocationRoomTimelineItem, isStopped: Bool = false) { self.currentDate = currentDate self.timelineItem = timelineItem - _hasExpired = State(initialValue: isStopped || currentDate >= timelineItem.content.timeoutDate) + hasExpired = isStopped || currentDate >= timelineItem.content.timeoutDate } /// A publisher that fires once when the timeoutDate is reached, setting `hasExpired` to true.