Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot override mutable property 'refreshControl' of type 'UIRefreshControl?' with covariant type 'UIRefreshControl'

I use a UIRefreshControl in my tableview for pull new data. But when I define the control, below error shows. I've googled for a while, but find nothing useful.

I use Xcode Version 9.2 (9C40b), swift4, IOS11.2

Cannot override mutable property 'refreshControl' of type 'UIRefreshControl?' with covariant type 'UIRefreshControl'

var refreshControl = UIRefreshControl()

enter image description here

like image 265
LF00 Avatar asked Jan 17 '18 11:01

LF00


1 Answers

If you want to define another control, then change the name... refreshControl is a UIScrollView/UITableViewController ivar since iOS10/iOS6 [respectively]. You're trying to redefine it and that is what causing the error. Or you can use the supplied one of course.

You probably meant something like self.refreshControl = UIRefreshControl()

like image 69
Alladinian Avatar answered Sep 19 '22 14:09

Alladinian