Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added back button for nav bar #141

Closed
Closed
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 1.8.0
stefanrenne marked this conversation as resolved.
Show resolved Hide resolved
- Add back button support to NavBar. (issue #51)

## 1.7.1

### Fixed
Expand Down
3 changes: 1 addition & 2 deletions Example/TABTestKit_ExampleUITests/TableSelectionScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ struct TableSelectionScreen: Screen {

let trait = View(id: "TableSelection")
let navBar = NavBar()
let backButton = Button(id: "Table")

let backButton = NavBar().backButton(titled: "Table")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be navBar.backButton instead?

Suggested change
let backButton = NavBar().backButton(titled: "Table")
let backButton = navBar.backButton(titled: "Table")

}
8 changes: 7 additions & 1 deletion TABTestKit/Classes/Elements/NavBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ public struct NavBar: Element {
self.id = id
self.parent = parent
}


/// - Parameter titled: The title of the back button. Typically the title of the previous screen.
/// - Returns: A button representing a back button in the nav bar.
public func backButton(titled title: String = "Back") -> Button {
return Button(id: title, parent: self)
}
stefanrenne marked this conversation as resolved.
Show resolved Hide resolved

}