Skip to content

Commit df588ec

Browse files
committed
Added WorkflowOutputPublisher protocol
Changed WorkflowHost and WorkflowHostingController to conform to WorkflowOutputPublisher. Added extension in WorkflowReactiveSwift to WorkflowOutputPublisher for output signal Removed unnecssary extensions on WorkflowHost and WorkflowHostingController
1 parent e9703bb commit df588ec

File tree

8 files changed

+10
-223
lines changed

8 files changed

+10
-223
lines changed

Package.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ let package = Package(
2424
.singleTargetLibrary("WorkflowUI"),
2525
.singleTargetLibrary("WorkflowSwiftUI"),
2626

27-
// MARK: WorkflowUIReactiveSwift
28-
29-
.singleTargetLibrary("WorkflowUIReactiveSwift"),
30-
3127
// MARK: WorkflowReactiveSwift
3228

3329
.singleTargetLibrary("WorkflowReactiveSwift"),
@@ -107,19 +103,6 @@ let package = Package(
107103
path: "WorkflowUI/Tests"
108104
),
109105

110-
// MARK: WorkflowUIReactiveSwift
111-
112-
.target(
113-
name: "WorkflowUIReactiveSwift",
114-
dependencies: ["ReactiveSwift", "Workflow", "WorkflowUI", "ViewEnvironment", "ViewEnvironmentUI"],
115-
path: "WorkflowUIReactiveSwift/Sources"
116-
),
117-
.testTarget(
118-
name: "WorkflowUIReactiveSwiftTests",
119-
dependencies: ["WorkflowUIReactiveSwift", "WorkflowReactiveSwift"],
120-
path: "WorkflowUIReactiveSwift/Tests"
121-
),
122-
123106
// MARK: WorkflowSwiftUI
124107

125108
.target(

Samples/Project.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,6 @@ let project = Project(
255255
.target(name: "TestAppHost"),
256256
]
257257
),
258-
259-
.unitTest(
260-
for: "WorkflowUIReactiveSwift",
261-
sources: "../WorkflowUIReactiveSwift/Tests/**",
262-
dependencies: [
263-
.external(name: "WorkflowUIReactiveSwift"),
264-
.external(name: "WorkflowUI"),
265-
.external(name: "WorkflowReactiveSwift"),
266-
.target(name: "TestAppHost"),
267-
]
268-
),
269258
],
270259
schemes: [
271260
.scheme(

Samples/Workspace.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ let workspace = Workspace(
99
.workflow("Workflow"),
1010
.workflow("WorkflowTesting"),
1111
.workflow("WorkflowUI"),
12-
.workflow("WorkflowUIReactiveSwift"),
1312
.workflow("WorkflowSwiftUI"),
1413
.workflow("WorkflowSwiftUIMacros"),
1514
.workflow("WorkflowReactiveSwift"),

Workflow/Sources/WorkflowHost.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ public protocol WorkflowDebugger {
3030
func didUpdate(snapshot: WorkflowHierarchyDebugSnapshot, updateInfo: WorkflowUpdateDebugInfo)
3131
}
3232

33+
public protocol WorkflowOutputPublisher {
34+
associatedtype Output
35+
36+
var outputPublisher: AnyPublisher<Output, Never> { get }
37+
}
38+
3339
/// Manages an active workflow hierarchy.
34-
public final class WorkflowHost<WorkflowType: Workflow> {
40+
public final class WorkflowHost<WorkflowType: Workflow>: WorkflowOutputPublisher {
3541
// @testable
3642
let rootNode: WorkflowNode<WorkflowType>
3743

WorkflowReactiveSwift/Sources/WorkflowHost+OutputSignal.swift

Lines changed: 0 additions & 27 deletions
This file was deleted.

WorkflowUIReactiveSwift/Sources/WorkflowHostingController+OutputSignal.swift renamed to WorkflowReactiveSwift/Sources/WorkflowOutputPublisher+OutputSignal.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#if canImport(UIKit)
21
import Combine
32
import ReactiveSwift
4-
import WorkflowUI
3+
import Workflow
54

6-
extension WorkflowHostingController {
5+
extension WorkflowOutputPublisher {
76
public var output: Signal<Output, Never> {
87
Signal.unserialized { observer, lifetime in
98
let cancellable = outputPublisher.sink(
@@ -26,4 +25,3 @@ extension WorkflowHostingController {
2625
}
2726
}
2827
}
29-
#endif

WorkflowUI/Sources/Hosting/WorkflowHostingController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import UIKit
2222
import Workflow
2323

2424
/// Drives view controllers from a root Workflow.
25-
public final class WorkflowHostingController<ScreenType, Output>: WorkflowUIViewController where ScreenType: Screen {
25+
public final class WorkflowHostingController<ScreenType, Output>: WorkflowUIViewController, WorkflowOutputPublisher where ScreenType: Screen {
2626
public typealias CustomizeEnvironment = (inout ViewEnvironment) -> Void
2727

2828
/// Emits output events from the bound workflow.

WorkflowUIReactiveSwift/Tests/WorkflowHostingControllerTests.swift

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)