Skip to content

Commit

Permalink
d - show snippets in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreid committed Dec 21, 2023
1 parent a2d2769 commit d3eb896
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
* [Checking Markdown Update](#checking-markdown-update)<!-- endToc -->

## Checking Markdown Update
test

<!-- snippet: task -->

<!-- snippet: number-of-rows -->

<!-- snippet: test-example -->
4 changes: 4 additions & 0 deletions SampleApp/SampleApp/TableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ class TableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(BookCell.self, forCellReuseIdentifier: cellReuseIdentifier)
// begin-snippet: task
Task {
await viewModel.load()
self.tableView.reloadData()
}
// end-snippet
}

// begin-snippet: number-of-rows
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
viewModel.result.count
}
// end-snippet

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier, for: indexPath)
Expand Down
2 changes: 2 additions & 0 deletions SampleApp/SampleAppTests/TableViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ class TableViewControllerTests: XCTestCase {
}

func test_numberOfRows() throws {
// begin-snippet: test-example
try expectToEventuallyEqual(
actual: { tableDataSource.tableView(sut.tableView, numberOfRowsInSection: 0) },
expected: 2
)
// end-snippet
}

func test_secondRowShowsBookTitle() throws {
Expand Down

0 comments on commit d3eb896

Please sign in to comment.