From 058500f91e13ceaded59ccee5b6bad55dc482c05 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Mon, 11 Mar 2024 09:05:52 +0100 Subject: [PATCH] Swiftformat . --- .../Account/AccountDetailHeaderView.swift | 2 +- .../Sources/Account/AccountDetailView.swift | 2 +- .../List/ConversationsListView.swift | 4 ++-- .../Sources/DesignSystem/SceneDelegate.swift | 2 +- .../Sources/DesignSystem/Theme.swift | 2 +- .../Sources/DesignSystem/Views/ErrorView.swift | 4 +--- .../DesignSystem/Views/NextPageView.swift | 5 +---- Packages/Env/Sources/Env/PreviewEnv.swift | 16 ++++++++-------- Packages/Env/Sources/Env/Router.swift | 4 ++-- .../Explore/Sources/Explore/ExploreView.swift | 8 ++++---- Packages/Models/Sources/Models/Account.swift | 2 +- .../Notifications/NotificationsListView.swift | 4 ++-- .../View/TimelineContentFilterView.swift | 4 ++-- 13 files changed, 27 insertions(+), 32 deletions(-) diff --git a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift index 33a851c5..e27a3771 100644 --- a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift +++ b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift @@ -322,7 +322,7 @@ struct AccountDetailHeaderView: View { .foregroundColor(.accentColor) } } - + @ViewBuilder private func makeNoteView(_ note: String) -> some View { VStack(alignment: .leading, spacing: 4) { diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index 18cfda0d..573952a0 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -371,7 +371,7 @@ public struct AccountDetailView: View { } extension View { - @MainActor + @MainActor func applyAccountDetailsRowStyle(theme: Theme) -> some View { listRowInsets(.init()) .listRowSeparator(.hidden) diff --git a/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift b/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift index 12f96bd8..a94e508d 100644 --- a/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift +++ b/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift @@ -49,8 +49,8 @@ public struct ConversationsListView: View { } } else if conversations.isEmpty, !viewModel.isLoadingFirstPage, !viewModel.isError { PlaceholderView(iconName: "tray", - title: "conversations.empty.title", - message: "conversations.empty.message") + title: "conversations.empty.title", + message: "conversations.empty.message") } else if viewModel.isError { ErrorView(title: "conversations.error.title", message: "conversations.error.message", diff --git a/Packages/DesignSystem/Sources/DesignSystem/SceneDelegate.swift b/Packages/DesignSystem/Sources/DesignSystem/SceneDelegate.swift index 5aa5ad8a..297252e6 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/SceneDelegate.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/SceneDelegate.swift @@ -52,7 +52,7 @@ import UIKit try? await Task.sleep(for: .seconds(0.1)) for delegate in observedSceneDelegate { #if os(visionOS) - let newWidth = delegate.window?.bounds.size.width ?? 0 + let newWidth = delegate.window?.bounds.size.width ?? 0 if delegate.windowWidth != newWidth { delegate.windowWidth = newWidth } diff --git a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift index bfef00c9..38a4f5a5 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift @@ -2,7 +2,7 @@ import Combine import SwiftUI @MainActor -@Observable +@Observable public final class Theme { final class ThemeStorage { enum ThemeKey: String { diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift index ff55bea0..80f06d16 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift @@ -46,7 +46,5 @@ public struct ErrorView: View { #Preview { ErrorView(title: "Error", message: "Error loading. Please try again", - buttonTitle: "Retry") { - - } + buttonTitle: "Retry") {} } diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/NextPageView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/NextPageView.swift index b849862d..afd68073 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/NextPageView.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/NextPageView.swift @@ -52,13 +52,10 @@ public struct NextPageView: View { } } - #Preview { List { Text("Item 1") - NextPageView { - - } + NextPageView {} } .listStyle(.plain) } diff --git a/Packages/Env/Sources/Env/PreviewEnv.swift b/Packages/Env/Sources/Env/PreviewEnv.swift index e2790ee5..be0d9b7a 100644 --- a/Packages/Env/Sources/Env/PreviewEnv.swift +++ b/Packages/Env/Sources/Env/PreviewEnv.swift @@ -1,15 +1,15 @@ -import SwiftUI import Network +import SwiftUI @MainActor public extension View { - func withPreviewsEnv() -> some View{ + func withPreviewsEnv() -> some View { environment(RouterPath()) - .environment(Client(server: "")) - .environment(CurrentAccount.shared) - .environment(UserPreferences.shared) - .environment(CurrentInstance.shared) - .environment(PushNotificationsService.shared) - .environment(QuickLook.shared) + .environment(Client(server: "")) + .environment(CurrentAccount.shared) + .environment(UserPreferences.shared) + .environment(CurrentInstance.shared) + .environment(PushNotificationsService.shared) + .environment(QuickLook.shared) } } diff --git a/Packages/Env/Sources/Env/Router.swift b/Packages/Env/Sources/Env/Router.swift index 9ab5da63..75e5e49e 100644 --- a/Packages/Env/Sources/Env/Router.swift +++ b/Packages/Env/Sources/Env/Router.swift @@ -42,11 +42,11 @@ public enum SheetDestination: Identifiable, Hashable { public static func == (lhs: SheetDestination, rhs: SheetDestination) -> Bool { lhs.id == rhs.id } - + public func hash(into hasher: inout Hasher) { hasher.combine(id) } - + case newStatusEditor(visibility: Models.Visibility) case editStatusEditor(status: Status) case replyToStatusEditor(status: Status) diff --git a/Packages/Explore/Sources/Explore/ExploreView.swift b/Packages/Explore/Sources/Explore/ExploreView.swift index d8ad859c..be1d3ae5 100644 --- a/Packages/Explore/Sources/Explore/ExploreView.swift +++ b/Packages/Explore/Sources/Explore/ExploreView.swift @@ -33,8 +33,8 @@ public struct ExploreView: View { if let results = viewModel.results[viewModel.searchQuery] { if results.isEmpty, !viewModel.isSearching { PlaceholderView(iconName: "magnifyingglass", - title: "explore.search.empty.title", - message: "explore.search.empty.message") + title: "explore.search.empty.title", + message: "explore.search.empty.message") .listRowBackground(theme.secondaryBackgroundColor) .listRowSeparator(.hidden) } else { @@ -54,8 +54,8 @@ public struct ExploreView: View { } } else if viewModel.allSectionsEmpty { PlaceholderView(iconName: "magnifyingglass", - title: "explore.search.title", - message: "explore.search.message-\(client.server)") + title: "explore.search.title", + message: "explore.search.message-\(client.server)") #if !os(visionOS) .listRowBackground(theme.secondaryBackgroundColor) #endif diff --git a/Packages/Models/Sources/Models/Account.swift b/Packages/Models/Sources/Models/Account.swift index 7ac4c9c3..4e27bac6 100644 --- a/Packages/Models/Sources/Models/Account.swift +++ b/Packages/Models/Sources/Models/Account.swift @@ -145,7 +145,7 @@ public final class Account: Codable, Identifiable, Hashable, Sendable, Equatable bot = try container.decode(Bool.self, forKey: .bot) discoverable = try container.decodeIfPresent(Bool.self, forKey: .discoverable) moved = try container.decodeIfPresent(Account.self, forKey: .moved) - + if let displayName, !displayName.isEmpty { cachedDisplayName = .init(stringValue: displayName) } else { diff --git a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift index f9aaf729..7a231554 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift @@ -154,8 +154,8 @@ public struct NotificationsListView: View { case let .display(notifications, nextPageState): if notifications.isEmpty { PlaceholderView(iconName: "bell.slash", - title: "notifications.empty.title", - message: "notifications.empty.message") + title: "notifications.empty.title", + message: "notifications.empty.message") #if !os(visionOS) .listRowBackground(theme.primaryBackgroundColor) #endif diff --git a/Packages/Timeline/Sources/Timeline/View/TimelineContentFilterView.swift b/Packages/Timeline/Sources/Timeline/View/TimelineContentFilterView.swift index 133a149f..15528a21 100644 --- a/Packages/Timeline/Sources/Timeline/View/TimelineContentFilterView.swift +++ b/Packages/Timeline/Sources/Timeline/View/TimelineContentFilterView.swift @@ -1,6 +1,6 @@ import DesignSystem -import SwiftUI import Env +import SwiftUI @MainActor public struct TimelineContentFilterView: View { @@ -32,7 +32,7 @@ public struct TimelineContentFilterView: View { #if !os(visionOS) .listRowBackground(theme.primaryBackgroundColor) #endif - + Section { if currentInstance.isFiltersSupported { Button {