Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", from: "6.3.0"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.44.14"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", .exact("0.44.14")),
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import TutorialViews
import Workflow
import WorkflowUI
import TutorialViews

struct TodoListScreen: Screen {
// The titles of the todo items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension TodoListWorkflow {
TodoModel(
title: "Take the cat for a walk",
note: "Cats really need their outside sunshine time. Don't forget to walk Charlie. Hamilton is less excited about the prospect."
)
),
],
step: .list
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension TodoWorkflow {
TodoModel(
title: "Take the cat for a walk",
note: "Cats really need their outside sunshine time. Don't forget to walk Charlie. Hamilton is less excited about the prospect."
)
),
],
step: .list
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension TodoWorkflow {
TodoModel(
title: "Take the cat for a walk",
note: "Cats really need their outside sunshine time. Don't forget to walk Charlie. Hamilton is less excited about the prospect."
)
),
],
step: .list
)
Expand Down Expand Up @@ -106,7 +106,7 @@ extension TodoWorkflow {
case .discardChanges:
// When a discard action is received, return to the list.
state.step = .list

case .saveChanges(todo: let todo, index: let index):
// When changes are saved, update the state of that `todo` item and return to the list.
state.todos[index] = todo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,17 @@ class RootWorkflowTests: XCTestCase {
// Save the changes by tapping the right bar button.
// This also validates that the navigation bar was described as expected.
switch backStack.items[2].barVisibility {

case .hidden:
XCTFail("Expected a visible navigation bar")

case .visible(let barContent):
switch barContent.rightItem {

case .none:
XCTFail("Expected a right bar button")

case .button(let button):

switch button.content {

case .text(let text):
XCTAssertEqual("Save", text)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TodoEditWorkflowTests: XCTestCase {
.verifyOutput { output in
switch output {
case .discard:
break // Expected
break // Expected
default:
XCTFail("Expected an output of `.discard`")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TodoListWorkflowTests: XCTestCase {
// The `.onBack` action should emit an output of `.back`.
switch output {
case .back:
break // Expected
break // Expected
default:
XCTFail("Expected an output of `.back`")
}
Expand All @@ -47,7 +47,7 @@ class TodoListWorkflowTests: XCTestCase {
// The `.new` action should emit a `.newTodo` output.
switch output {
case .newTodo:
break // Expected
break // Expected
default:
XCTFail("Expected an output of `.newTodo`")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ class TodoWorkflowTests: XCTestCase {
step: .list
))
// We only expect the TodoListWorkflow to be rendered.
.expectWorkflow(
type: TodoListWorkflow.self,
producingRendering: BackStackScreen<AnyScreen>.Item(
screen: TodoListScreen(todoTitles: ["Title"], onTodoSelected: { _ in }).asAnyScreen()
),
// Simulate selecting the first todo.
producingOutput: .selectTodo(index: 0)
)
.render { items in
// Just validate that there is one item in the back stack.
// Additional validation could be done on the screens returned, if desired.
XCTAssertEqual(1, items.count)
}
// Assert that the state was updated after the render pass with the output from the TodoListWorkflow.
.assert(state: TodoWorkflow.State(
todos: [TodoModel(title: "Title", note: "Note")],
step: .edit(index: 0)
))
.expectWorkflow(
type: TodoListWorkflow.self,
producingRendering: BackStackScreen<AnyScreen>.Item(
screen: TodoListScreen(todoTitles: ["Title"], onTodoSelected: { _ in }).asAnyScreen()
),
// Simulate selecting the first todo.
producingOutput: .selectTodo(index: 0)
)
.render { items in
// Just validate that there is one item in the back stack.
// Additional validation could be done on the screens returned, if desired.
XCTAssertEqual(1, items.count)
}
// Assert that the state was updated after the render pass with the output from the TodoListWorkflow.
.assert(state: TodoWorkflow.State(
todos: [TodoModel(title: "Title", note: "Note")],
step: .edit(index: 0)
))
}

func testSavingTodo() throws {
Expand Down
4 changes: 2 additions & 2 deletions WorkflowRxSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Pod::Spec.new do |s|
s.source_files = 'WorkflowRxSwift/Sources/**/*.swift'

s.dependency 'Workflow', "#{s.version}"
s.dependency 'RxSwift', '>= 4.4.0'
s.dependency 'RxAtomic', '>= 4.4.0'
s.dependency 'RxSwift', '~> 4.4.0'
s.dependency 'RxAtomic', '~> 4.4.0'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'WorkflowRxSwift/Tests/**/*.swift'
Expand Down