Swift-Watch: How to detect user scrolled to last row in WKInterfaceTable

163 Views Asked by At

I need to detect user scrolled to last row in Watch app.

Code for WKInterfaceTable

func loadTableData() {


    notificationTblView.setNumberOfRows(notifications.count, withRowType: "NotificationCellID")
    var index = 0

    while index < notifications.count {
        let row = notificationTblView.rowController(at: index) as! TableRowController

        let dictofObject = notifications[index]
        row.notificationTitleLbl.setText(dictofObject["title"])
        row.notificationDateLbl.setText(dictofObject["time"])
        index = index + 1
   }
}

In iPhone application, same concept did. Detected user's last row. Code is below.

This for UITableView.

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

    if indexPath.row == (self.notifications.count - 1)
    {
        //print("\n\ncame to last row")
        self.view.showActivityIndicator(activityTag: 1000)
        self.fetchNotificationData(true)
    }
}

Can you guide me for this?

0

There are 0 best solutions below