From 45158daa4c4b66c3ec6249b8101b740759e6e219 Mon Sep 17 00:00:00 2001 From: Andrew Watt Date: Mon, 18 Nov 2024 17:16:53 -0800 Subject: [PATCH] chore: run formatter --- .../Sources/AlertContainerScreen.swift | 6 +- .../AlertContainerViewController.swift | 21 +-- .../Sources/AsyncWorkerWorkflow.swift | 2 +- .../FakeNetwork/FakeNetworkManager.swift | 2 +- .../Sources/FakeNetwork/Model.swift | 2 +- .../Sources/BackStackContainer.swift | 10 +- .../Sources/BackStackScreen.swift | 34 ++-- .../Sources/ScreenWrapperViewController.swift | 13 +- .../Sources/ModalContainerScreen.swift | 4 +- .../ModalContainerViewController.swift | 80 ++++----- .../Sources/CounterWorkflow.swift | 4 +- Samples/Project.swift | 11 +- Samples/SampleApp/Sources/AppDelegate.swift | 2 +- .../Sources/CrossFadeContainer.swift | 12 +- Samples/SampleApp/Sources/DemoScreen.swift | 4 +- Samples/SampleApp/Sources/DemoWorkflow.swift | 19 +-- .../SampleApp/Sources/ReversingWorkflow.swift | 2 +- Samples/SampleApp/Sources/RootWorkflow.swift | 6 +- Samples/SampleApp/Sources/WelcomeScreen.swift | 4 +- .../SampleApp/Sources/WelcomeWorkflow.swift | 2 +- .../DemoApp/AppDelegate.swift | 2 +- .../DemoApp/BarScreen.swift | 6 +- .../DemoApp/DemoWorkflow.swift | 4 +- .../DemoApp/FooScreen.swift | 4 +- ...itScreenContainerScreenSnapshotTests.swift | 2 +- .../Sources/ContainerView.swift | 2 +- .../Sources/Environment+SplitScreen.swift | 6 +- .../Sources/SplitScreenContainerScreen.swift | 4 +- .../SplitScreenContainerViewController.swift | 14 +- .../AuthenticationService.swift | 24 +-- .../AuthenticationWorkflow.swift | 20 +-- .../Authentication/LoadingScreen.swift | 4 +- .../Sources/Authentication/LoginScreen.swift | 12 +- .../Authentication/LoginWorkflow.swift | 2 +- .../Authentication/TwoFactorScreen.swift | 4 +- .../Sources/Game/ConfirmQuitScreen.swift | 10 +- .../Sources/Game/ConfirmQuitWorkflow.swift | 3 +- .../Sources/Game/GamePlayScreen.swift | 34 ++-- .../Sources/Game/NewGameScreen.swift | 4 +- .../Sources/Game/RunGameWorkflow.swift | 4 +- .../Sources/Game/TakeTurnsWorkflow.swift | 3 +- .../TicTacToe/Sources/Main/MainWorkflow.swift | 6 +- Samples/Tuist/Config.swift | 6 +- .../Project+Workflow.swift | 15 +- .../AppHost/Sources/AppDelegate.swift | 2 +- .../Edit/TodoEditSampleViewController.swift | 1 + .../List/TodoListSampleViewController.swift | 1 + .../TutorialHostingViewController.swift | 1 + .../Sources/Welcome/WelcomeScreen.swift | 2 +- .../Sources/Welcome/WelcomeWorkflow.swift | 4 +- .../Sources/RootWorkflow.swift | 4 +- .../Edit/TodoEditSampleViewController.swift | 1 + .../Sources/Todo/List/TodoListScreen.swift | 2 +- .../Sources/Todo/List/TodoListWorkflow.swift | 4 +- .../TutorialHostingViewController.swift | 1 + .../Sources/Welcome/WelcomeScreen.swift | 2 +- .../Sources/Welcome/WelcomeWorkflow.swift | 4 +- .../Sources/RootWorkflow.swift | 4 +- .../Sources/Todo/Edit/TodoEditScreen.swift | 2 +- .../Sources/Todo/Edit/TodoEditWorkflow.swift | 4 +- .../Sources/Todo/List/TodoListScreen.swift | 2 +- .../Sources/Todo/List/TodoListWorkflow.swift | 4 +- .../TutorialHostingViewController.swift | 1 + .../Sources/Welcome/WelcomeScreen.swift | 2 +- .../Sources/Welcome/WelcomeWorkflow.swift | 4 +- .../Sources/RootWorkflow.swift | 4 +- .../Sources/Todo/Edit/TodoEditScreen.swift | 2 +- .../Sources/Todo/Edit/TodoEditWorkflow.swift | 4 +- .../Sources/Todo/List/TodoListScreen.swift | 2 +- .../Sources/Todo/List/TodoListWorkflow.swift | 10 +- .../Sources/Todo/TodoWorkflow.swift | 4 +- .../TutorialHostingViewController.swift | 1 + .../Sources/Welcome/WelcomeScreen.swift | 2 +- .../Sources/Welcome/WelcomeWorkflow.swift | 4 +- .../Sources/RootWorkflow.swift | 4 +- .../Sources/Todo/Edit/TodoEditScreen.swift | 2 +- .../Sources/Todo/Edit/TodoEditWorkflow.swift | 4 +- .../Sources/Todo/List/TodoListScreen.swift | 2 +- .../Sources/Todo/List/TodoListWorkflow.swift | 10 +- .../Sources/Todo/TodoWorkflow.swift | 4 +- .../TutorialHostingViewController.swift | 1 + .../Sources/Welcome/WelcomeScreen.swift | 2 +- .../Sources/Welcome/WelcomeWorkflow.swift | 4 +- .../Tests/RootWorkflowTests.swift | 2 + .../Edit/TodoEditSampleViewController.swift | 1 + .../List/TodoListSampleViewController.swift | 1 + .../TutorialHostingViewController.swift | 1 + .../Welcome/WelcomeSampleViewController.swift | 1 + .../TutorialViews/Sources/TodoListView.swift | 3 +- .../TutorialViews/Sources/WelcomeView.swift | 1 + Samples/Tutorial/Project.swift | 4 +- .../AppDelegate.swift | 2 +- Samples/Workspace.swift | 5 +- .../AppHost/Sources/AppDelegate.swift | 2 - ViewEnvironment/Sources/ViewEnvironment.swift | 6 +- ...ontroller+ViewEnvironmentPropagating.swift | 2 +- .../Sources/ViewEnvironmentObserving.swift | 10 +- .../Sources/ViewEnvironmentPropagating.swift | 36 ++--- .../Tests/ViewEnvironmentObservingTests.swift | 10 +- Workflow/Sources/AnyWorkflow.swift | 38 ++--- Workflow/Sources/AnyWorkflowConvertible.swift | 40 ++--- Workflow/Sources/Debugging.swift | 14 +- Workflow/Sources/DispatchQueue+Workflow.swift | 4 +- Workflow/Sources/RenderContext.swift | 14 +- Workflow/Sources/Sink.swift | 4 +- Workflow/Sources/StateMutationSink.swift | 4 +- Workflow/Sources/SubtreeManager.swift | 63 ++++---- Workflow/Sources/Workflow.swift | 18 +-- Workflow/Sources/WorkflowAction.swift | 12 +- Workflow/Sources/WorkflowHost.swift | 4 +- Workflow/Sources/WorkflowLogger.swift | 30 ++-- Workflow/Sources/WorkflowNode.swift | 2 +- Workflow/Sources/WorkflowObserver.swift | 10 +- Workflow/Tests/AnyWorkflowActionTests.swift | 2 +- Workflow/Tests/AnyWorkflowTests.swift | 8 +- Workflow/Tests/ConcurrencyTests.swift | 11 +- Workflow/Tests/PerformanceTests.swift | 8 +- Workflow/Tests/SubtreeManagerTests.swift | 6 +- Workflow/Tests/TestUtilities.swift | 2 +- Workflow/Tests/WorkflowHostTests.swift | 8 +- Workflow/Tests/WorkflowNodeTests.swift | 27 ++-- Workflow/Tests/WorkflowObserverTests.swift | 6 +- .../Sources/Publisher+Extensions.swift | 11 +- WorkflowCombine/Sources/Worker.swift | 8 +- .../TestingTests/TestingTests.swift | 2 +- WorkflowCombine/Tests/WorkerTests.swift | 4 +- .../Sources/AsyncOperationWorker.swift | 4 +- WorkflowConcurrency/Sources/Worker.swift | 10 +- .../TestingTests/TestingTests.swift | 4 +- .../Tests/AsyncOperationWorkerTests.swift | 4 +- WorkflowConcurrency/Tests/WorkerTests.swift | 20 +-- WorkflowReactiveSwift/Sources/Logger.swift | 8 +- .../Sources/QueueScheduler+Workflow.swift | 2 +- .../Sources/SignalProducerWorkflow.swift | 2 +- .../Sources/SignalWorker.swift | 2 +- WorkflowReactiveSwift/Sources/Worker.swift | 10 +- .../TestingTests/TestingTests.swift | 4 +- .../Tests/SignalProducerTests.swift | 2 +- WorkflowReactiveSwift/Tests/WorkerTests.swift | 4 +- WorkflowRxSwift/Sources/Logger.swift | 8 +- WorkflowRxSwift/Sources/Worker.swift | 8 +- .../TestingTests/TestingTests.swift | 2 +- WorkflowRxSwift/Tests/ObservableTests.swift | 2 +- .../Tests/Rx+ReactiveWorkers.swift | 2 +- WorkflowRxSwift/Tests/WorkerTests.swift | 4 +- WorkflowSwiftUI/Sources/Store+Preview.swift | 12 +- .../Tests/Derived/ObservableStateTests.swift | 12 +- .../Sources/ObservableValue.swift | 10 +- .../Sources/Derived/Availability.swift | 14 +- .../Sources/Derived/Extensions.swift | 16 +- .../Derived/ObservableStateMacro.swift | 152 ++++++++---------- .../Sources/Internal/RenderExpectations.swift | 10 +- .../Internal/RenderTester+TestContext.swift | 26 ++- .../Sources/RenderTesterResult.swift | 26 +-- .../Sources/WorkflowActionTester.swift | 26 +-- .../WorkflowRenderTesterFailureTests.swift | 4 +- .../Tests/WorkflowRenderTesterTests.swift | 2 +- .../Hosting/WorkflowHostingController.swift | 23 +-- .../WorkflowUIViewController.swift | 4 +- .../Screen/AdaptedEnvironmentScreen.swift | 8 +- .../Sources/Screen/AnyScreen/AnyScreen.swift | 8 +- WorkflowUI/Sources/Screen/Screen.swift | 8 +- .../Sources/Screen/ScreenContaining.swift | 4 +- .../Sources/Screen/ScreenViewController.swift | 8 +- .../DescribedViewController.swift | 18 +-- .../UIViewController+Extensions.swift | 9 +- .../ViewControllerDescription.swift | 13 +- .../Tests/DescribedViewControllerTests.swift | 10 +- .../UIViewControllerExtensionTests.swift | 1 + .../ViewControllerDescriptionTests.swift | 4 +- .../WorkflowHostingControllerTests.swift | 13 +- .../Tests/WorkflowUIObservationTestCase.swift | 4 +- WorkflowUI/Tests/XCTestCase+Extensions.swift | 4 +- 173 files changed, 772 insertions(+), 779 deletions(-) diff --git a/Samples/AlertContainer/Sources/AlertContainerScreen.swift b/Samples/AlertContainer/Sources/AlertContainerScreen.swift index dc84afe0d..fb9a6954a 100644 --- a/Samples/AlertContainer/Sources/AlertContainerScreen.swift +++ b/Samples/AlertContainer/Sources/AlertContainerScreen.swift @@ -30,7 +30,7 @@ public struct AlertContainerScreen: Screen { } public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription { - return AlertContainerViewController.description(for: self, environment: environment) + AlertContainerViewController.description(for: self, environment: environment) } } @@ -58,8 +58,8 @@ public struct AlertAction { } } -extension AlertAction { - public enum Style { +public extension AlertAction { + enum Style { case `default` case cancel case destructive diff --git a/Samples/AlertContainer/Sources/AlertContainerViewController.swift b/Samples/AlertContainer/Sources/AlertContainerViewController.swift index 1a6011787..a864f540f 100644 --- a/Samples/AlertContainer/Sources/AlertContainerViewController.swift +++ b/Samples/AlertContainer/Sources/AlertContainerViewController.swift @@ -18,13 +18,13 @@ import UIKit import Workflow import WorkflowUI -private struct AlertStyleConstants { +private enum AlertStyleConstants { static let viewWidth: CGFloat = 343.0 static let buttonTitleColor = UIColor(red: 41 / 255, green: 150 / 255, blue: 204 / 255, alpha: 1.0) static let titleFont = UIFont.systemFont(ofSize: 18, weight: .medium) } -internal final class AlertContainerViewController: ScreenViewController> { +final class AlertContainerViewController: ScreenViewController> { private var baseScreenViewController: DescribedViewController private let dimmingView = UIView() @@ -63,7 +63,7 @@ internal final class AlertContainerViewController: ScreenVi baseScreenViewController.update(screen: screen.baseScreen, environment: environment) if let alert = screen.alert { - if let alertView = alertView { + if let alertView { alertView.alert = alert } else { let inAlertView = AlertView(alert: alert) @@ -104,7 +104,7 @@ internal final class AlertContainerViewController: ScreenVi ) } } else { - if let alertView = alertView { + if let alertView { UIView.animate( withDuration: 0.1, delay: 0, @@ -126,23 +126,23 @@ internal final class AlertContainerViewController: ScreenVi } override var childForStatusBarStyle: UIViewController? { - return baseScreenViewController + baseScreenViewController } override var childForStatusBarHidden: UIViewController? { - return baseScreenViewController + baseScreenViewController } override var childForHomeIndicatorAutoHidden: UIViewController? { - return baseScreenViewController + baseScreenViewController } override var childForScreenEdgesDeferringSystemGestures: UIViewController? { - return baseScreenViewController + baseScreenViewController } override public var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return baseScreenViewController.supportedInterfaceOrientations + baseScreenViewController.supportedInterfaceOrientations } } @@ -173,7 +173,7 @@ private final class AlertView: UIView { } private func commonInit() { - guard let alert = alert else { + guard let alert else { return } title.text = alert.title @@ -253,6 +253,7 @@ private final class AlertButton: UIButton { addTarget(self, action: #selector(triggerActionHandler), for: .touchUpInside) } + @available(*, unavailable) required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift b/Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift index 9bb62d667..a90fcb726 100644 --- a/Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift +++ b/Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift @@ -22,7 +22,7 @@ extension AsyncWorkerWorkflow { } func makeInitialState() -> AsyncWorkerWorkflow.State { - return State(model: Model(message: "Initial State")) + State(model: Model(message: "Initial State")) } func workflowDidChange(from previousWorkflow: AsyncWorkerWorkflow, state: inout State) {} diff --git a/Samples/AsyncWorker/Sources/FakeNetwork/FakeNetworkManager.swift b/Samples/AsyncWorker/Sources/FakeNetwork/FakeNetworkManager.swift index 60669614b..b6a40b1c1 100644 --- a/Samples/AsyncWorker/Sources/FakeNetwork/FakeNetworkManager.swift +++ b/Samples/AsyncWorker/Sources/FakeNetwork/FakeNetworkManager.swift @@ -9,7 +9,7 @@ import Foundation class FakeNetworkManager { static func makeFakeNetworkRequest() -> FakeRequest { - return FakeRequest() + FakeRequest() } } diff --git a/Samples/AsyncWorker/Sources/FakeNetwork/Model.swift b/Samples/AsyncWorker/Sources/FakeNetwork/Model.swift index 833347a08..01bdb42f5 100644 --- a/Samples/AsyncWorker/Sources/FakeNetwork/Model.swift +++ b/Samples/AsyncWorker/Sources/FakeNetwork/Model.swift @@ -1,5 +1,5 @@ // -// FakeModel.swift +// Model.swift // AsyncWorker // // Created by Mark Johnson on 6/16/22. diff --git a/Samples/BackStackContainer/Sources/BackStackContainer.swift b/Samples/BackStackContainer/Sources/BackStackContainer.swift index 6293d0b72..89abfc48c 100644 --- a/Samples/BackStackContainer/Sources/BackStackContainer.swift +++ b/Samples/BackStackContainer/Sources/BackStackContainer.swift @@ -14,8 +14,8 @@ * limitations under the License. */ -import WorkflowUI import UIKit +import WorkflowUI public final class BackStackContainer: ScreenViewController>, UINavigationControllerDelegate { private let navController = UINavigationController() @@ -69,14 +69,12 @@ public final class BackStackContainer: ScreenViewController