Post

Replies

Boosts

Views

Activity

Reply to Table view's `cellForRow(at:)` is `nil` in Unit Test
Guys, did you try reloading the table view altogether? I used table view over a view controller and it worked for me.     func test_firstRow() {         let tableView = myViewController().tableView // Reload data         tableView?.reloadData()         let indexPath0 = IndexPath(item: 0, section: 0)         let cell0 = tableView!.cellForRow(at: indexPath0)         let visibleRows = tableView?.indexPathsForVisibleRows         XCTAssert(visibleRows != nil)         XCTAssertTrue(((tableView?.indexPathsForVisibleRows!.contains(indexPath0)) != nil))         XCTAssert(cell0 != nil)     }
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’21