Skip to content

Commit 5203d3c

Browse files
committed
chore: run formatter
1 parent a8d7792 commit 5203d3c

File tree

189 files changed

+754
-761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+754
-761
lines changed

Samples/AlertContainer/Sources/AlertContainerScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct AlertContainerScreen<BaseScreen: Screen>: Screen {
3030
}
3131

3232
public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
33-
return AlertContainerViewController.description(for: self, environment: environment)
33+
AlertContainerViewController.description(for: self, environment: environment)
3434
}
3535
}
3636

Samples/AlertContainer/Sources/AlertContainerViewController.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import UIKit
1818
import Workflow
1919
import WorkflowUI
2020

21-
private struct AlertStyleConstants {
21+
private enum AlertStyleConstants {
2222
static let viewWidth: CGFloat = 343.0
2323
static let buttonTitleColor = UIColor(red: 41 / 255, green: 150 / 255, blue: 204 / 255, alpha: 1.0)
2424
static let titleFont = UIFont.systemFont(ofSize: 18, weight: .medium)
2525
}
2626

27-
internal final class AlertContainerViewController<AlertScreen: Screen>: ScreenViewController<AlertContainerScreen<AlertScreen>> {
27+
final class AlertContainerViewController<AlertScreen: Screen>: ScreenViewController<AlertContainerScreen<AlertScreen>> {
2828
private var baseScreenViewController: DescribedViewController
2929

3030
private let dimmingView = UIView()
@@ -63,7 +63,7 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: ScreenVi
6363
baseScreenViewController.update(screen: screen.baseScreen, environment: environment)
6464

6565
if let alert = screen.alert {
66-
if let alertView = alertView {
66+
if let alertView {
6767
alertView.alert = alert
6868
} else {
6969
let inAlertView = AlertView(alert: alert)
@@ -104,7 +104,7 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: ScreenVi
104104
)
105105
}
106106
} else {
107-
if let alertView = alertView {
107+
if let alertView {
108108
UIView.animate(
109109
withDuration: 0.1,
110110
delay: 0,
@@ -126,23 +126,23 @@ internal final class AlertContainerViewController<AlertScreen: Screen>: ScreenVi
126126
}
127127

128128
override var childForStatusBarStyle: UIViewController? {
129-
return baseScreenViewController
129+
baseScreenViewController
130130
}
131131

132132
override var childForStatusBarHidden: UIViewController? {
133-
return baseScreenViewController
133+
baseScreenViewController
134134
}
135135

136136
override var childForHomeIndicatorAutoHidden: UIViewController? {
137-
return baseScreenViewController
137+
baseScreenViewController
138138
}
139139

140140
override var childForScreenEdgesDeferringSystemGestures: UIViewController? {
141-
return baseScreenViewController
141+
baseScreenViewController
142142
}
143143

144144
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
145-
return baseScreenViewController.supportedInterfaceOrientations
145+
baseScreenViewController.supportedInterfaceOrientations
146146
}
147147
}
148148

@@ -173,7 +173,7 @@ private final class AlertView: UIView {
173173
}
174174

175175
private func commonInit() {
176-
guard let alert = alert else {
176+
guard let alert else {
177177
return
178178
}
179179
title.text = alert.title
@@ -253,6 +253,7 @@ private final class AlertButton: UIButton {
253253
addTarget(self, action: #selector(triggerActionHandler), for: .touchUpInside)
254254
}
255255

256+
@available(*, unavailable)
256257
required init?(coder aDecoder: NSCoder) {
257258
fatalError("init(coder:) has not been implemented")
258259
}

Samples/AsyncWorker/Sources/AsyncWorkerWorkflow.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension AsyncWorkerWorkflow {
2222
}
2323

2424
func makeInitialState() -> AsyncWorkerWorkflow.State {
25-
return State(model: Model(message: "Initial State"))
25+
State(model: Model(message: "Initial State"))
2626
}
2727

2828
func workflowDidChange(from previousWorkflow: AsyncWorkerWorkflow, state: inout State) {}

Samples/AsyncWorker/Sources/FakeNetwork/FakeNetworkManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99

1010
class FakeNetworkManager {
1111
static func makeFakeNetworkRequest() -> FakeRequest {
12-
return FakeRequest()
12+
FakeRequest()
1313
}
1414
}
1515

Samples/AsyncWorker/Sources/FakeNetwork/Model.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// FakeModel.swift
2+
// Model.swift
33
// AsyncWorker
44
//
55
// Created by Mark Johnson on 6/16/22.

Samples/BackStackContainer/Sources/BackStackContainer.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import WorkflowUI
1817
import UIKit
18+
import WorkflowUI
1919

2020
public final class BackStackContainer<Content: Screen>: ScreenViewController<BackStackScreen<Content>>, UINavigationControllerDelegate {
2121
private let navController = UINavigationController()
@@ -69,14 +69,12 @@ public final class BackStackContainer<Content: Screen>: ScreenViewController<Bac
6969
return
7070
}
7171

72-
let hidden: Bool
73-
74-
switch topScreen.barVisibility {
72+
let hidden = switch topScreen.barVisibility {
7573
case .hidden:
76-
hidden = true
74+
true
7775

7876
case .visible:
79-
hidden = false
77+
false
8078
}
8179
navController.setNavigationBarHidden(hidden, animated: animated)
8280
}

Samples/BackStackContainer/Sources/BackStackScreen.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import WorkflowUI
1817
import UIKit
18+
import WorkflowUI
1919

2020
public struct BackStackScreen<ScreenType: Screen>: Screen {
2121
var items: [Item]
@@ -25,7 +25,7 @@ public struct BackStackScreen<ScreenType: Screen>: Screen {
2525
}
2626

2727
public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
28-
return BackStackContainer.description(for: self, environment: environment)
28+
BackStackContainer.description(for: self, environment: environment)
2929
}
3030
}
3131

@@ -36,10 +36,10 @@ extension BackStackScreen {
3636
public var screen: ScreenType
3737
public var barVisibility: BarVisibility
3838

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

42-
if let key = key {
42+
if let key {
4343
self.key = AnyHashable(key)
4444
} else {
4545
self.key = AnyHashable(ObjectIdentifier(ScreenType.self))
@@ -52,7 +52,7 @@ extension BackStackScreen {
5252
self.init(key: key, screen: screen, barVisibility: barVisibility)
5353
}
5454

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

@@ -61,7 +61,7 @@ extension BackStackScreen {
6161
self.init(key: key, screen: screen, barContent: barContent)
6262
}
6363

64-
public init<Key: Hashable>(key: Key?, screen: ScreenType) {
64+
public init(key: (some Hashable)?, screen: ScreenType) {
6565
let barVisibility: BarVisibility = .visible(BarContent())
6666
self.init(key: key, screen: screen, barVisibility: barVisibility)
6767
}
@@ -125,7 +125,7 @@ extension BackStackScreen.BarContent {
125125

126126
/// Convenience factory for a default back button.
127127
public static func back(handler: @escaping () -> Void) -> Button {
128-
return Button(content: .text("Back"), handler: handler)
128+
Button(content: .text("Back"), handler: handler)
129129
}
130130
}
131131
}

Samples/BackStackContainer/Sources/ScreenWrapperViewController.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import WorkflowUI
1817
import UIKit
18+
import WorkflowUI
1919

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

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

@@ -97,16 +97,16 @@ final class ScreenWrapperViewController<ScreenType: Screen>: UIViewController {
9797
}
9898
}
9999

100-
let title: String
101-
switch barContent.title {
100+
let title: String = switch barContent.title {
102101
case .none:
103-
title = ""
102+
""
104103
case .text(let text):
105-
title = text
104+
text
106105
}
107106
navigationItem.title = title
108107
}
109108

109+
@available(*, unavailable)
110110
required init?(coder aDecoder: NSCoder) {
111111
fatalError("init(coder:) has not been implemented")
112112
}
@@ -127,6 +127,7 @@ extension ScreenWrapperViewController {
127127
update(with: button)
128128
}
129129

130+
@available(*, unavailable)
130131
required init?(coder aDecoder: NSCoder) {
131132
fatalError("init(coder:) has not been implemented")
132133
}

Samples/ModalContainer/Sources/ModalContainerScreen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct ModalContainerScreen<BaseScreen: Screen>: Screen {
3030
}
3131

3232
public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
33-
return ModalContainerViewController.description(for: self, environment: environment)
33+
ModalContainerViewController.description(for: self, environment: environment)
3434
}
3535
}
3636

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

58-
public init<Key: Hashable>(screen: AnyScreen, style: Style = .fullScreen, key: Key, animated: Bool = true) {
58+
public init(screen: AnyScreen, style: Style = .fullScreen, key: some Hashable, animated: Bool = true) {
5959
self.screen = screen
6060
self.style = style
6161
self.key = AnyHashable(key)

0 commit comments

Comments
 (0)