This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cellAtIndexPath [0, 0] | |
will display cell [0, 0] | |
cellAtIndexPath [0, 1] | |
will display cell [0, 1] | |
cellAtIndexPath [0, 2] | |
will display cell [0, 2] | |
cellAtIndexPath [0, 3] | |
will display cell [0, 3] | |
cellAtIndexPath [0, 4] | |
will display cell [0, 4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cellAtIndexPath [0, 0] | |
will display cell [0, 0] | |
cellAtIndexPath [0, 1] | |
will display cell [0, 1] | |
cellAtIndexPath [0, 2] | |
will display cell [0, 2] | |
cellAtIndexPath [0, 3] | |
will display cell [0, 3] | |
cellAtIndexPath [0, 4] | |
will display cell [0, 4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
if let visibleIndexPaths = tableView.indexPathsForVisibleRows, visibleIndexPaths.contains(indexPath) { | |
print("will display cell \(indexPath)") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cellAtIndexPath [0, 0] | |
will display cell [0, 0] | |
cellAtIndexPath [0, 1] | |
will display cell [0, 1] | |
cellAtIndexPath [0, 2] | |
will display cell [0, 2] | |
cellAtIndexPath [0, 3] | |
will display cell [0, 3] | |
cellAtIndexPath [0, 4] | |
will display cell [0, 4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TableViewPaginationTest: XCTestCase { | |
func testExample() { | |
XCUIApplication().launch() | |
print(XCUIApplication().tables.cells.count) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UITableViewController { | |
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 20 | |
} | |
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
print("will display cell \(indexPath)") | |
} | |
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return dataSource.count + moreItemsToLoad ? 1 : 0 | |
} | |
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
if cell is TableViewCellLoadingCell { | |
fetchNewItems() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testCustomBlock() { | |
let someObjectToInject: AnyObject = ... | |
// this will invoke the code of block in ViewController.swift | |
app.performCustomCommandNamed("myCustomCommandKey", object: someObjectToInject) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testRequestMonitor() { | |
// listen to all calls made to `(.*)apple(.*)` | |
app.monitorRequestsWithRegex("(.*)myserver(.*)") | |
// interact with UI | |
// check that there's everything you're expecting | |
let requests: [SBTMonitoredNetworkRequest] = app.monitoredRequestsFlushAll() | |
for request in requests { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testFilesystem() { | |
let pathToFile = "MyFakeDB.sqlite" | |
app.uploadItemAtPath(pathToFile, toPath: "/db/db.sqlite", relativeTo: .DocumentDirectory) | |
// interact with UI | |
let uploadData = app.downloadItemFromPath("/db/db.sqlite", relativeTo: .DocumentDirectory) | |
// check that file was modified as expected | |
} |