yohannes / Thoughtless

An iOS app that lets user quickly jot down thoughts with Markdown support
MIT License
27 stars 6 forks source link

Add pull-to-refresh logic in table view controller #83

Closed yohannes closed 7 years ago

yohannes commented 7 years ago

var refreshControl: UIRefreshControl!

//in viewDidLoad self.refreshControl = UIRefreshControl() self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh notes" self.refreshControl.addTarget(self, action: "loadEntries", forControlEvents: .valueChanged) self.tableView.addSubview(self.refreshControl)

//place the following in the function loadEntries after weakSelf.tableView.reloadData self.refreshControl.endRefreshing()

yohannes commented 7 years ago

Solution: https://github.com/yoha/Thoughtless/commit/67ea94ff1fdbf4710bb2ce92dde5f25955384f19