I am trying to implement pull to update in an application to view a table. I looked through examples of people, and I realized that this is pretty much the point:
var refreshControl:UIRefreshControl!
override func viewDidLoad()
{
super.viewDidLoad()
self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
self.tableView.addSubview(refreshControl)
}
func refresh(sender:AnyObject)
{
}
However, the only examples I can find are some time ago, and I know that the language has changed a lot since then! When I try to use the code above, I get the following error next to my refreshControl declaration:
Cannot override with a stored property 'refresh control'
My first thought before reading other examples is that I would have to declare a variable like this:
var refreshControl:UIRefreshControl = UIRefreshControl()
Like me, with some other variables, but I think not. Any ideas what the problem is?
source
share