Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
watt committed Nov 19, 2024
1 parent 3a80e95 commit 45158da
Show file tree
Hide file tree
Showing 173 changed files with 772 additions and 779 deletions.
6 changes: 3 additions & 3 deletions Samples/AlertContainer/Sources/AlertContainerScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct AlertContainerScreen<BaseScreen: Screen>: Screen {
}

public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
return AlertContainerViewController.description(for: self, environment: environment)
AlertContainerViewController.description(for: self, environment: environment)
}
}

Expand Down Expand Up @@ -58,8 +58,8 @@ public struct AlertAction {
}
}

extension AlertAction {
public enum Style {
public extension AlertAction {
enum Style {
case `default`
case cancel
case destructive
Expand Down
21 changes: 11 additions & 10 deletions Samples/AlertContainer/Sources/AlertContainerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<AlertScreen: Screen>: ScreenViewController<AlertContainerScreen<AlertScreen>> {
final class AlertContainerViewController<AlertScreen: Screen>: ScreenViewController<AlertContainerScreen<AlertScreen>> {
private var baseScreenViewController: DescribedViewController

private let dimmingView = UIView()
Expand Down Expand Up @@ -63,7 +63,7 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: 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)
Expand Down Expand Up @@ -104,7 +104,7 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: ScreenVi
)
}
} else {
if let alertView = alertView {
if let alertView {
UIView.animate(
withDuration: 0.1,
delay: 0,
Expand All @@ -126,23 +126,23 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: 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
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

class FakeNetworkManager {
static func makeFakeNetworkRequest() -> FakeRequest {
return FakeRequest()
FakeRequest()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Samples/AsyncWorker/Sources/FakeNetwork/Model.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FakeModel.swift
// Model.swift
// AsyncWorker
//
// Created by Mark Johnson on 6/16/22.
Expand Down
10 changes: 4 additions & 6 deletions Samples/BackStackContainer/Sources/BackStackContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import WorkflowUI
import UIKit
import WorkflowUI

public final class BackStackContainer<Content: Screen>: ScreenViewController<BackStackScreen<Content>>, UINavigationControllerDelegate {
private let navController = UINavigationController()
Expand Down Expand Up @@ -69,14 +69,12 @@ public final class BackStackContainer<Content: Screen>: ScreenViewController<Bac
return
}

let hidden: Bool

switch topScreen.barVisibility {
let hidden = switch topScreen.barVisibility {
case .hidden:
hidden = true
true

case .visible:
hidden = false
false
}
navController.setNavigationBarHidden(hidden, animated: animated)
}
Expand Down
34 changes: 17 additions & 17 deletions Samples/BackStackContainer/Sources/BackStackScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import WorkflowUI
import UIKit
import WorkflowUI

public struct BackStackScreen<ScreenType: Screen>: Screen {
var items: [Item]
Expand All @@ -25,21 +25,21 @@ public struct BackStackScreen<ScreenType: Screen>: Screen {
}

public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
return BackStackContainer.description(for: self, environment: environment)
BackStackContainer.description(for: self, environment: environment)
}
}

extension BackStackScreen {
public extension BackStackScreen {
/// A specific item in the back stack. The key and screen type is used to differentiate reused vs replaced screens.
public struct Item {
struct Item {
public var key: AnyHashable
public var screen: ScreenType
public var barVisibility: BarVisibility

public init<Key: Hashable>(key: Key?, screen: ScreenType, barVisibility: BarVisibility) {
public init(key: (some Hashable)?, screen: ScreenType, barVisibility: BarVisibility) {
self.screen = screen

if let key = key {
if let key {
self.key = AnyHashable(key)
} else {
self.key = AnyHashable(ObjectIdentifier(ScreenType.self))
Expand All @@ -52,7 +52,7 @@ extension BackStackScreen {
self.init(key: key, screen: screen, barVisibility: barVisibility)
}

public init<Key: Hashable>(key: Key?, screen: ScreenType, barContent: BackStackScreen.BarContent) {
public init(key: (some Hashable)?, screen: ScreenType, barContent: BackStackScreen.BarContent) {
self.init(key: key, screen: screen, barVisibility: .visible(barContent))
}

Expand All @@ -61,7 +61,7 @@ extension BackStackScreen {
self.init(key: key, screen: screen, barContent: barContent)
}

public init<Key: Hashable>(key: Key?, screen: ScreenType) {
public init(key: (some Hashable)?, screen: ScreenType) {
let barVisibility: BarVisibility = .visible(BarContent())
self.init(key: key, screen: screen, barVisibility: barVisibility)
}
Expand All @@ -73,15 +73,15 @@ extension BackStackScreen {
}
}

extension BackStackScreen {
public enum BarVisibility {
public extension BackStackScreen {
enum BarVisibility {
case hidden
case visible(BarContent)
}
}

extension BackStackScreen {
public struct BarContent {
public extension BackStackScreen {
struct BarContent {
var title: Title
var leftItem: BarButtonItem
var rightItem: BarButtonItem
Expand All @@ -103,18 +103,18 @@ extension BackStackScreen {
}
}

extension BackStackScreen.BarContent {
public enum Title {
public extension BackStackScreen.BarContent {
enum Title {
case none
case text(String)
}

public enum ButtonContent {
enum ButtonContent {
case text(String)
case icon(UIImage)
}

public struct Button {
struct Button {
var content: ButtonContent
var handler: () -> Void

Expand All @@ -125,7 +125,7 @@ extension BackStackScreen.BarContent {

/// Convenience factory for a default back button.
public static func back(handler: @escaping () -> Void) -> Button {
return Button(content: .text("Back"), handler: handler)
Button(content: .text("Back"), handler: handler)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import WorkflowUI
import UIKit
import WorkflowUI

/**
Wrapper view controller for being hosted in a backstack. Handles updating the bar button items.
Expand Down Expand Up @@ -58,7 +58,7 @@ final class ScreenWrapperViewController<ScreenType: Screen>: UIViewController {
}

func matches(item: BackStackScreen<ScreenType>.Item) -> Bool {
return item.key == key
item.key == key
&& type(of: item.screen) == ScreenType.self
}

Expand Down Expand Up @@ -97,16 +97,16 @@ final class ScreenWrapperViewController<ScreenType: Screen>: UIViewController {
}
}

let title: String
switch barContent.title {
let title: String = switch barContent.title {
case .none:
title = ""
""
case .text(let text):
title = text
text
}
navigationItem.title = title
}

@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand All @@ -127,6 +127,7 @@ extension ScreenWrapperViewController {
update(with: button)
}

@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
4 changes: 2 additions & 2 deletions Samples/ModalContainer/Sources/ModalContainerScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct ModalContainerScreen<BaseScreen: Screen>: Screen {
}

public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
return ModalContainerViewController.description(for: self, environment: environment)
ModalContainerViewController.description(for: self, environment: environment)
}
}

Expand All @@ -55,7 +55,7 @@ public struct ModalContainerScreenModal {
/// A key used to differentiate modal screens during updates
public var key: AnyHashable

public init<Key: Hashable>(screen: AnyScreen, style: Style = .fullScreen, key: Key, animated: Bool = true) {
public init(screen: AnyScreen, style: Style = .fullScreen, key: some Hashable, animated: Bool = true) {
self.screen = screen
self.style = style
self.key = AnyHashable(key)
Expand Down
Loading

0 comments on commit 45158da

Please sign in to comment.