From 9589c689c31456fe430f0cc2884431c10c6dc13a Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 28 Nov 2022 10:32:32 +0200 Subject: [PATCH] Remove unnecessary marks, they bring little value --- .../SwiftUI/ViewModel/StateStoreViewModel.swift | 16 ---------------- .../AnalyticsPromptViewModel.swift | 8 -------- .../AnalyticsPrompt/View/AnalyticsPrompt.swift | 8 -------- .../View/AnalyticsPromptCheckmarkItem.swift | 8 -------- .../Authentication/LoginScreen/LoginModels.swift | 4 ---- .../LoginScreen/LoginViewModel.swift | 8 -------- .../LoginScreen/View/LoginScreen.swift | 6 ------ .../ServerSelection/ServerSelectionModels.swift | 4 ---- .../ServerSelectionViewModel.swift | 10 ---------- .../SoftLogout/SoftLogoutModels.swift | 6 ------ .../SoftLogout/SoftLogoutViewModel.swift | 10 ---------- .../SoftLogout/View/SoftLogoutScreen.swift | 8 -------- .../Screens/BugReport/BugReportModels.swift | 6 ------ .../Screens/BugReport/View/BugReportScreen.swift | 6 ------ .../Screens/FilePreview/FilePreviewModels.swift | 6 ------ .../FilePreview/FilePreviewViewModel.swift | 10 ---------- .../FilePreview/View/FilePreviewScreen.swift | 6 ------ .../Screens/MediaPlayer/MediaPlayerModels.swift | 6 ------ .../MediaPlayer/MediaPlayerViewModel.swift | 10 ---------- .../MediaPlayer/View/MediaPlayerScreen.swift | 4 ---- .../OnboardingScreen/OnboardingModels.swift | 4 ---- .../OnboardingScreen/OnboardingViewModel.swift | 10 ---------- .../View/OnboardingPageIndicator.swift | 6 ------ .../View/OnboardingPageView.swift | 6 ------ .../OnboardingScreen/View/OnboardingScreen.swift | 6 ------ .../SessionVerificationModels.swift | 4 ---- .../SessionVerificationViewModel.swift | 10 ---------- .../View/SessionVerificationScreen.swift | 2 -- .../Screens/Settings/SettingsModels.swift | 6 ------ .../Screens/Settings/SettingsViewModel.swift | 10 ---------- .../Screens/Settings/View/SettingsScreen.swift | 6 ------ .../Screens/VideoPlayer/VideoPlayerModels.swift | 6 ------ .../VideoPlayer/VideoPlayerViewModel.swift | 10 ---------- .../VideoPlayer/View/VideoPlayerScreen.swift | 4 ---- .../Sources/Services/Analytics/Analytics.swift | 4 ---- .../AuthenticationServiceProxy.swift | 8 -------- .../ElementX/TemplateCoordinator.swift | 2 -- .../ElementX/TemplateModels.swift | 6 ------ .../ElementX/TemplateViewModel.swift | 8 -------- .../ElementX/View/TemplateScreen.swift | 6 ------ 40 files changed, 274 deletions(-) diff --git a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift index b932eb2d5..c6668c571 100644 --- a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift +++ b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift @@ -32,14 +32,8 @@ import Foundation @dynamicMemberLookup @MainActor class ViewModelContext: ObservableObject { - // MARK: - Properties - - // MARK: Private - fileprivate let viewActions: PassthroughSubject - // MARK: Public - /// Get-able/Observable `Published` property for the `ViewState` @Published fileprivate(set) var viewState: ViewState @@ -49,15 +43,11 @@ class ViewModelContext: ObservableObject { set { viewState.bindings[keyPath: keyPath] = newValue } } - // MARK: Setup - init(initialViewState: ViewState) { self.viewActions = PassthroughSubject() self.viewState = initialViewState } - // MARK: Public - /// Send a `ViewAction` to the `ViewModel` for processing. /// - Parameter viewAction: The `ViewAction` to send to the `ViewModel`. func send(viewAction: ViewAction) { @@ -74,10 +64,6 @@ class ViewModelContext: ObservableObject { @MainActor class StateStoreViewModel { typealias Context = ViewModelContext - - // MARK: - Properties - - // MARK: Public /// For storing subscription references. /// @@ -91,8 +77,6 @@ class StateStoreViewModel { get { context.viewState } set { context.viewState = newValue } } - - // MARK: Setup init(initialViewState: State) { context = Context(initialViewState: initialViewState) diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptViewModel.swift b/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptViewModel.swift index 5a7254cfc..0386831ae 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptViewModel.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/AnalyticsPromptViewModel.swift @@ -20,17 +20,9 @@ import SwiftUI typealias AnalyticsPromptViewModelType = StateStoreViewModel class AnalyticsPromptViewModel: AnalyticsPromptViewModelType, AnalyticsPromptViewModelProtocol { - // MARK: - Properties - - // MARK: Private - private let termsURL: URL - // MARK: Public - var callback: (@MainActor (AnalyticsPromptViewModelAction) -> Void)? - - // MARK: - Setup /// Initialize a view model with the specified prompt type and app display name. init(termsURL: URL) { diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift index 1fe079102..d8463b4a6 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPrompt.swift @@ -18,18 +18,10 @@ import SwiftUI /// A prompt that asks the user whether they would like to enable Analytics or not. struct AnalyticsPrompt: View { - // MARK: - Properties - - // MARK: Private - private let horizontalPadding: CGFloat = 16 - // MARK: Public - @ObservedObject var context: AnalyticsPromptViewModel.Context - // MARK: Views - var body: some View { GeometryReader { geometry in ScrollView { diff --git a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPromptCheckmarkItem.swift b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPromptCheckmarkItem.swift index 891995f07..a124cf917 100644 --- a/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPromptCheckmarkItem.swift +++ b/ElementX/Sources/Screens/AnalyticsPrompt/View/AnalyticsPromptCheckmarkItem.swift @@ -17,14 +17,8 @@ import SwiftUI struct AnalyticsPromptCheckmarkItem: View { - // MARK: - Properties - - // MARK: Private - private let attributedString: AttributedString - // MARK: - Setup - init(attributedString: AttributedString) { self.attributedString = attributedString } @@ -33,8 +27,6 @@ struct AnalyticsPromptCheckmarkItem: View { attributedString = AttributedString(string) } - // MARK: - Views - var body: some View { Label { Text(attributedString) } icon: { Image(uiImage: Asset.Images.analyticsCheckmark.image) diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginModels.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginModels.swift index 7833ee2df..5a0f63d7e 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginModels.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginModels.swift @@ -16,8 +16,6 @@ import Foundation -// MARK: View model - enum LoginViewModelAction: CustomStringConvertible { /// The user would like to select another server. case selectServer @@ -47,8 +45,6 @@ enum LoginViewModelAction: CustomStringConvertible { } } -// MARK: View - struct LoginViewState: BindableState { /// Data about the selected homeserver. var homeserver: LoginHomeserver diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift index 0faaaf171..d3dccc2c0 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift @@ -19,22 +19,14 @@ import SwiftUI typealias LoginViewModelType = StateStoreViewModel class LoginViewModel: LoginViewModelType, LoginViewModelProtocol { - // MARK: - Properties - - // MARK: Public - var callback: (@MainActor (LoginViewModelAction) -> Void)? - // MARK: - Setup - init(homeserver: LoginHomeserver) { let bindings = LoginBindings() let viewState = LoginViewState(homeserver: homeserver, bindings: bindings) super.init(initialViewState: viewState) } - - // MARK: - Public override func process(viewAction: LoginViewAction) async { switch viewAction { diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift index 5cc71be38..75a46cc51 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift @@ -17,17 +17,11 @@ import SwiftUI struct LoginScreen: View { - // MARK: - Properties - - // MARK: Private - /// The focus state of the username text field. @FocusState private var isUsernameFocused: Bool /// The focus state of the password text field. @FocusState private var isPasswordFocused: Bool - // MARK: Public - @ObservedObject var context: LoginViewModel.Context var body: some View { diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionModels.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionModels.swift index 7ccdab1e4..7cb2e3fa1 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionModels.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionModels.swift @@ -16,8 +16,6 @@ import Foundation -// MARK: View model - enum ServerSelectionViewModelAction { /// The user would like to use the homeserver at the given address. case confirm(homeserverAddress: String) @@ -25,8 +23,6 @@ enum ServerSelectionViewModelAction { case dismiss } -// MARK: View - struct ServerSelectionViewState: BindableState { /// View state that can be bound to from SwiftUI. var bindings: ServerSelectionBindings diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift index d5aa5e65b..25670571b 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift @@ -19,16 +19,8 @@ import SwiftUI typealias ServerSelectionViewModelType = StateStoreViewModel class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: (@MainActor (ServerSelectionViewModelAction) -> Void)? - // MARK: - Setup - init(homeserverAddress: String, isModallyPresented: Bool) { let bindings = ServerSelectionBindings(homeserverAddress: homeserverAddress, slidingSyncProxyAddress: ElementSettings.shared.slidingSyncProxyBaseURLString) @@ -36,8 +28,6 @@ class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionVie super.init(initialViewState: ServerSelectionViewState(bindings: bindings, isModallyPresented: isModallyPresented)) } - - // MARK: - Public override func process(viewAction: ServerSelectionViewAction) async { switch viewAction { diff --git a/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutModels.swift b/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutModels.swift index a5889e828..0c5c84518 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutModels.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutModels.swift @@ -16,8 +16,6 @@ import SwiftUI -// MARK: Data - struct SoftLogoutCredentials { let userId: String let homeserverName: String @@ -25,8 +23,6 @@ struct SoftLogoutCredentials { let deviceId: String? } -// MARK: View model - enum SoftLogoutViewModelAction: CustomStringConvertible { /// Login with password case login(String) @@ -52,8 +48,6 @@ enum SoftLogoutViewModelAction: CustomStringConvertible { } } -// MARK: View - struct SoftLogoutViewState: BindableState { /// Soft logout credentials var credentials: SoftLogoutCredentials diff --git a/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutViewModel.swift b/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutViewModel.swift index 4264c5a9f..705fb6fe9 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogout/SoftLogoutViewModel.swift @@ -19,16 +19,8 @@ import SwiftUI typealias SoftLogoutViewModelType = StateStoreViewModel class SoftLogoutViewModel: SoftLogoutViewModelType, SoftLogoutViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: (@MainActor (SoftLogoutViewModelAction) -> Void)? - // MARK: - Setup - init(credentials: SoftLogoutCredentials, homeserver: LoginHomeserver, keyBackupNeeded: Bool, @@ -40,8 +32,6 @@ class SoftLogoutViewModel: SoftLogoutViewModelType, SoftLogoutViewModelProtocol bindings: bindings) super.init(initialViewState: viewState) } - - // MARK: - Public override func process(viewAction: SoftLogoutViewAction) async { switch viewAction { diff --git a/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift b/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift index 3e0f95af6..1ed175981 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogout/View/SoftLogoutScreen.swift @@ -17,21 +17,13 @@ import SwiftUI struct SoftLogoutScreen: View { - // MARK: - Properties - - // MARK: Private - @State private var showingClearDataConfirmation = false /// The focus state of the password text field. @FocusState private var isPasswordFocused: Bool - // MARK: Public - @ObservedObject var context: SoftLogoutViewModel.Context - // MARK: Views - var body: some View { ScrollView { VStack(spacing: 0) { diff --git a/ElementX/Sources/Screens/BugReport/BugReportModels.swift b/ElementX/Sources/Screens/BugReport/BugReportModels.swift index 0477ba227..4dd49bfe2 100644 --- a/ElementX/Sources/Screens/BugReport/BugReportModels.swift +++ b/ElementX/Sources/Screens/BugReport/BugReportModels.swift @@ -17,10 +17,6 @@ import Foundation import UIKit -// MARK: - Coordinator - -// MARK: View model - enum BugReportViewModelAction { case cancel case submitStarted @@ -28,8 +24,6 @@ enum BugReportViewModelAction { case submitFailed(error: Error) } -// MARK: View - struct BugReportViewState: BindableState { var screenshot: UIImage? var bindings: BugReportViewStateBindings diff --git a/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift b/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift index 596a1dce9..ffb60042c 100644 --- a/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift +++ b/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift @@ -17,20 +17,14 @@ import SwiftUI struct BugReportScreen: View { - // MARK: Private - @Environment(\.horizontalSizeClass) private var horizontalSizeClass private var horizontalPadding: CGFloat { horizontalSizeClass == .regular ? 50 : 16 } - // MARK: Public - @ObservedObject var context: BugReportViewModel.Context - // MARK: Views - var body: some View { GeometryReader { geometry in VStack { diff --git a/ElementX/Sources/Screens/FilePreview/FilePreviewModels.swift b/ElementX/Sources/Screens/FilePreview/FilePreviewModels.swift index 0b07aa280..9305481ac 100644 --- a/ElementX/Sources/Screens/FilePreview/FilePreviewModels.swift +++ b/ElementX/Sources/Screens/FilePreview/FilePreviewModels.swift @@ -16,16 +16,10 @@ import Foundation -// MARK: - Coordinator - -// MARK: View model - enum FilePreviewViewModelAction { case cancel } -// MARK: View - struct FilePreviewViewState: BindableState { let fileURL: URL let title: String? diff --git a/ElementX/Sources/Screens/FilePreview/FilePreviewViewModel.swift b/ElementX/Sources/Screens/FilePreview/FilePreviewViewModel.swift index 0bf5d684e..961951632 100644 --- a/ElementX/Sources/Screens/FilePreview/FilePreviewViewModel.swift +++ b/ElementX/Sources/Screens/FilePreview/FilePreviewViewModel.swift @@ -19,22 +19,12 @@ import SwiftUI typealias FilePreviewViewModelType = StateStoreViewModel class FilePreviewViewModel: FilePreviewViewModelType, FilePreviewViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: ((FilePreviewViewModelAction) -> Void)? - // MARK: - Setup - init(fileURL: URL, title: String? = nil) { super.init(initialViewState: FilePreviewViewState(fileURL: fileURL, title: title)) } - // MARK: - Public - override func process(viewAction: FilePreviewViewAction) async { switch viewAction { case .cancel: diff --git a/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift b/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift index a71ce938b..45d38a318 100644 --- a/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift +++ b/ElementX/Sources/Screens/FilePreview/View/FilePreviewScreen.swift @@ -19,20 +19,14 @@ import SwiftUI import UIKit struct FilePreviewScreen: View { - // MARK: Private - @Environment(\.colorScheme) private var colorScheme var counterColor: Color { colorScheme == .light ? .element.secondaryContent : .element.tertiaryContent } - // MARK: Public - @ObservedObject var context: FilePreviewViewModel.Context - // MARK: Views - var body: some View { PreviewController(fileURL: context.viewState.fileURL, title: context.viewState.title) } diff --git a/ElementX/Sources/Screens/MediaPlayer/MediaPlayerModels.swift b/ElementX/Sources/Screens/MediaPlayer/MediaPlayerModels.swift index 1fe720b20..dc5a3ba20 100644 --- a/ElementX/Sources/Screens/MediaPlayer/MediaPlayerModels.swift +++ b/ElementX/Sources/Screens/MediaPlayer/MediaPlayerModels.swift @@ -16,16 +16,10 @@ import Foundation -// MARK: - Coordinator - -// MARK: View model - enum MediaPlayerViewModelAction { case cancel } -// MARK: View - struct MediaPlayerViewState: BindableState { let mediaURL: URL let autoplay: Bool diff --git a/ElementX/Sources/Screens/MediaPlayer/MediaPlayerViewModel.swift b/ElementX/Sources/Screens/MediaPlayer/MediaPlayerViewModel.swift index 696f3a25f..5a3261235 100644 --- a/ElementX/Sources/Screens/MediaPlayer/MediaPlayerViewModel.swift +++ b/ElementX/Sources/Screens/MediaPlayer/MediaPlayerViewModel.swift @@ -19,23 +19,13 @@ import SwiftUI typealias MediaPlayerViewModelType = StateStoreViewModel class MediaPlayerViewModel: MediaPlayerViewModelType, MediaPlayerViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: ((MediaPlayerViewModelAction) -> Void)? - // MARK: - Setup - init(mediaURL: URL, autoplay: Bool = true) { super.init(initialViewState: MediaPlayerViewState(mediaURL: mediaURL, autoplay: autoplay)) } - // MARK: - Public - override func process(viewAction: MediaPlayerViewAction) async { switch viewAction { case .cancel: diff --git a/ElementX/Sources/Screens/MediaPlayer/View/MediaPlayerScreen.swift b/ElementX/Sources/Screens/MediaPlayer/View/MediaPlayerScreen.swift index 6d35957c2..e80fc6700 100644 --- a/ElementX/Sources/Screens/MediaPlayer/View/MediaPlayerScreen.swift +++ b/ElementX/Sources/Screens/MediaPlayer/View/MediaPlayerScreen.swift @@ -18,11 +18,7 @@ import AVKit import SwiftUI struct MediaPlayerScreen: View { - // MARK: Public - @ObservedObject var context: MediaPlayerViewModel.Context - - // MARK: Views var body: some View { VideoPlayer(player: player()) diff --git a/ElementX/Sources/Screens/OnboardingScreen/OnboardingModels.swift b/ElementX/Sources/Screens/OnboardingScreen/OnboardingModels.swift index 2e6497222..3a9b339ac 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/OnboardingModels.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/OnboardingModels.swift @@ -29,14 +29,10 @@ struct OnboardingPageContent { let image: ImageAsset } -// MARK: View model - enum OnboardingViewModelAction { case login } -// MARK: View - struct OnboardingViewState: BindableState { /// The colours of the background gradient shown behind the 4 pages. private let gradientColors = [ diff --git a/ElementX/Sources/Screens/OnboardingScreen/OnboardingViewModel.swift b/ElementX/Sources/Screens/OnboardingScreen/OnboardingViewModel.swift index 55812dec5..f1dd386a8 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/OnboardingViewModel.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/OnboardingViewModel.swift @@ -20,22 +20,12 @@ import SwiftUI typealias OnboardingViewModelType = StateStoreViewModel class OnboardingViewModel: OnboardingViewModelType, OnboardingViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: ((OnboardingViewModelAction) -> Void)? - // MARK: - Setup - init() { super.init(initialViewState: OnboardingViewState()) } - // MARK: - Public - override func process(viewAction: OnboardingViewAction) async { switch viewAction { case .login: diff --git a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageIndicator.swift b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageIndicator.swift index 522ea2582..58ad7e160 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageIndicator.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageIndicator.swift @@ -17,17 +17,11 @@ import SwiftUI struct OnboardingPageIndicator: View { - // MARK: - Properties - - // MARK: Public - /// The number of pages that are shown. let pageCount: Int /// The index of the current page let pageIndex: Int - // MARK: - Setup - internal init(pageCount: Int, pageIndex: Int) { self.pageCount = pageCount diff --git a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageView.swift b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageView.swift index 0c460baa7..f81c2316b 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageView.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingPageView.swift @@ -17,15 +17,9 @@ import SwiftUI struct OnboardingPageView: View { - // MARK: - Properties - - // MARK: Public - /// The content that this page should display. let content: OnboardingPageContent - // MARK: - Views - var body: some View { VStack { Image(content.image.name) diff --git a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift index 3b8f81b94..60b1abd4b 100644 --- a/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift +++ b/ElementX/Sources/Screens/OnboardingScreen/View/OnboardingScreen.swift @@ -19,10 +19,6 @@ import SwiftUI /// The screen shown at the beginning of the onboarding flow. struct OnboardingScreen: View { - // MARK: - Properties - - // MARK: Private - @Environment(\.colorScheme) private var colorScheme @Environment(\.layoutDirection) private var layoutDirection @@ -34,8 +30,6 @@ struct OnboardingScreen: View { /// The amount of offset to apply when a drag gesture is in progress. @State private var dragOffset: CGFloat = .zero - // MARK: Public - @ObservedObject var context: OnboardingViewModel.Context var body: some View { diff --git a/ElementX/Sources/Screens/SessionVerification/SessionVerificationModels.swift b/ElementX/Sources/Screens/SessionVerification/SessionVerificationModels.swift index a64cbfff9..95ce88815 100644 --- a/ElementX/Sources/Screens/SessionVerification/SessionVerificationModels.swift +++ b/ElementX/Sources/Screens/SessionVerification/SessionVerificationModels.swift @@ -16,14 +16,10 @@ import Foundation -// MARK: View model - enum SessionVerificationViewModelAction { case finished } -// MARK: View - struct SessionVerificationViewState: BindableState { var verificationState: SessionVerificationStateMachine.State = .initial diff --git a/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift b/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift index f63b0bec8..45f810e5a 100644 --- a/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift +++ b/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift @@ -19,20 +19,12 @@ import SwiftUI typealias SessionVerificationViewModelType = StateStoreViewModel class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVerificationViewModelProtocol { - // MARK: - Properties - - // MARK: Private - private let sessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol private var stateMachine: SessionVerificationStateMachine - // MARK: Public - var callback: ((SessionVerificationViewModelAction) -> Void)? - // MARK: - Setup - init(sessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol, initialState: SessionVerificationViewState = SessionVerificationViewState()) { self.sessionVerificationControllerProxy = sessionVerificationControllerProxy @@ -67,8 +59,6 @@ class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVer .store(in: &cancellables) } - // MARK: - Public - override func process(viewAction: SessionVerificationViewAction) async { switch viewAction { case .start: diff --git a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift index da5d6be38..0b8243a03 100644 --- a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift +++ b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift @@ -19,8 +19,6 @@ import SwiftUI struct SessionVerificationScreen: View { @ObservedObject var context: SessionVerificationViewModel.Context - // MARK: Views - var body: some View { NavigationView { ScrollView { diff --git a/ElementX/Sources/Screens/Settings/SettingsModels.swift b/ElementX/Sources/Screens/Settings/SettingsModels.swift index 1a1c2936e..8b19a7c73 100644 --- a/ElementX/Sources/Screens/Settings/SettingsModels.swift +++ b/ElementX/Sources/Screens/Settings/SettingsModels.swift @@ -17,10 +17,6 @@ import Foundation import UIKit -// MARK: - Coordinator - -// MARK: View model - enum SettingsViewModelAction { case close case toggleAnalytics @@ -29,8 +25,6 @@ enum SettingsViewModelAction { case logout } -// MARK: View - struct SettingsViewState: BindableState { var bindings: SettingsViewStateBindings var userID: String diff --git a/ElementX/Sources/Screens/Settings/SettingsViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsViewModel.swift index 7a6faabd5..ac67bb087 100644 --- a/ElementX/Sources/Screens/Settings/SettingsViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsViewModel.swift @@ -19,18 +19,10 @@ import SwiftUI typealias SettingsViewModelType = StateStoreViewModel class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol { - // MARK: - Properties - - // MARK: Private - private let userSession: UserSessionProtocol - // MARK: Public - var callback: ((SettingsViewModelAction) -> Void)? - // MARK: - Setup - init(withUserSession userSession: UserSessionProtocol) { self.userSession = userSession let bindings = SettingsViewStateBindings() @@ -51,8 +43,6 @@ class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol { } } - // MARK: - Public - override func process(viewAction: SettingsViewAction) async { switch viewAction { case .close: diff --git a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift index 17cb172a6..37fd1b55c 100644 --- a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift @@ -17,8 +17,6 @@ import SwiftUI struct SettingsScreen: View { - // MARK: Private - @State private var showingLogoutConfirmation = false @Environment(\.colorScheme) private var colorScheme @ObservedObject private var settings = ElementSettings.shared @@ -27,12 +25,8 @@ struct SettingsScreen: View { @ScaledMetric private var menuIconSize = 30.0 private let listRowInsets = EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16) - // MARK: Public - @ObservedObject var context: SettingsViewModel.Context - // MARK: Views - var body: some View { Form { userSection diff --git a/ElementX/Sources/Screens/VideoPlayer/VideoPlayerModels.swift b/ElementX/Sources/Screens/VideoPlayer/VideoPlayerModels.swift index abdb7dc51..384185774 100644 --- a/ElementX/Sources/Screens/VideoPlayer/VideoPlayerModels.swift +++ b/ElementX/Sources/Screens/VideoPlayer/VideoPlayerModels.swift @@ -16,16 +16,10 @@ import Foundation -// MARK: - Coordinator - -// MARK: View model - enum VideoPlayerViewModelAction { case cancel } -// MARK: View - struct VideoPlayerViewState: BindableState { var videoURL: URL var autoplay: Bool diff --git a/ElementX/Sources/Screens/VideoPlayer/VideoPlayerViewModel.swift b/ElementX/Sources/Screens/VideoPlayer/VideoPlayerViewModel.swift index 0253a6bfa..abb18c176 100644 --- a/ElementX/Sources/Screens/VideoPlayer/VideoPlayerViewModel.swift +++ b/ElementX/Sources/Screens/VideoPlayer/VideoPlayerViewModel.swift @@ -19,23 +19,13 @@ import SwiftUI typealias VideoPlayerViewModelType = StateStoreViewModel class VideoPlayerViewModel: VideoPlayerViewModelType, VideoPlayerViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: ((VideoPlayerViewModelAction) -> Void)? - // MARK: - Setup - init(videoURL: URL, autoplay: Bool = true) { super.init(initialViewState: VideoPlayerViewState(videoURL: videoURL, autoplay: autoplay)) } - // MARK: - Public - override func process(viewAction: VideoPlayerViewAction) async { switch viewAction { case .cancel: diff --git a/ElementX/Sources/Screens/VideoPlayer/View/VideoPlayerScreen.swift b/ElementX/Sources/Screens/VideoPlayer/View/VideoPlayerScreen.swift index d0b688510..fe094c86a 100644 --- a/ElementX/Sources/Screens/VideoPlayer/View/VideoPlayerScreen.swift +++ b/ElementX/Sources/Screens/VideoPlayer/View/VideoPlayerScreen.swift @@ -18,11 +18,7 @@ import AVKit import SwiftUI struct VideoPlayerScreen: View { - // MARK: Public - @ObservedObject var context: VideoPlayerViewModel.Context - - // MARK: Views var body: some View { VideoPlayer(player: player()) diff --git a/ElementX/Sources/Services/Analytics/Analytics.swift b/ElementX/Sources/Services/Analytics/Analytics.swift index 65af5d45e..ad0ed461a 100644 --- a/ElementX/Sources/Services/Analytics/Analytics.swift +++ b/ElementX/Sources/Services/Analytics/Analytics.swift @@ -31,8 +31,6 @@ import PostHog /// into `main`, update the AnalyticsEvents Swift package in `project.yml`. /// class Analytics { - // MARK: - Properties - /// The singleton instance to be used within the Riot target. static let shared = Analytics() @@ -54,8 +52,6 @@ class Analytics { !ElementSettings.shared.hasSeenAnalyticsPrompt && BuildSettings.analyticsConfiguration.isEnabled } - // MARK: - Public - /// Opts in to analytics tracking with the supplied user session. /// - Parameter userSession: The user session to use to when reading/generating the analytics ID. /// The session will be ignored if not running. diff --git a/ElementX/Sources/Services/Authentication/AuthenticationServiceProxy.swift b/ElementX/Sources/Services/Authentication/AuthenticationServiceProxy.swift index d88297517..673295701 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationServiceProxy.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationServiceProxy.swift @@ -19,19 +19,11 @@ import Foundation import MatrixRustSDK class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol { - // MARK: - Properties - - // MARK: Private - private let authenticationService: AuthenticationService private let userSessionStore: UserSessionStoreProtocol - // MARK: Public - private(set) var homeserver = LoginHomeserver(address: BuildSettings.defaultHomeserverAddress, loginMode: .unknown) - // MARK: - Setup - init(userSessionStore: UserSessionStoreProtocol) { self.userSessionStore = userSessionStore authenticationService = AuthenticationService(basePath: userSessionStore.baseDirectory.path) diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift index 57cc8ccdf..7c27867c5 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift @@ -37,8 +37,6 @@ final class TemplateCoordinator: CoordinatorProtocol { viewModel = TemplateViewModel(promptType: parameters.promptType) } - // MARK: - Public - func start() { viewModel.callback = { [weak self] action in guard let self else { return } diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateModels.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateModels.swift index 158482651..2840c78ae 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateModels.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateModels.swift @@ -16,8 +16,6 @@ import Foundation -// MARK: - Coordinator - enum TemplatePromptType { case regular case upgrade @@ -45,15 +43,11 @@ extension TemplatePromptType: Identifiable, CaseIterable { } } -// MARK: View model - enum TemplateViewModelAction { case accept case cancel } -// MARK: View - struct TemplateViewState: BindableState { var promptType: TemplatePromptType var count: Int diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift index d74c822f6..8ab2ebe8f 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift @@ -19,16 +19,8 @@ import SwiftUI typealias TemplateViewModelType = StateStoreViewModel class TemplateViewModel: TemplateViewModelType, TemplateViewModelProtocol { - // MARK: - Properties - - // MARK: Private - - // MARK: Public - var callback: ((TemplateViewModelAction) -> Void)? - // MARK: - Setup - init(promptType: TemplatePromptType, initialCount: Int = 0) { super.init(initialViewState: TemplateViewState(promptType: promptType, count: 0)) } diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift index a4ad94760..bb3718e63 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift @@ -17,20 +17,14 @@ import SwiftUI struct TemplateScreen: View { - // MARK: Private - @Environment(\.colorScheme) private var colorScheme var counterColor: Color { colorScheme == .light ? .element.secondaryContent : .element.tertiaryContent } - // MARK: Public - @ObservedObject var context: TemplateViewModel.Context - // MARK: Views - var body: some View { ScrollView { mainContent