Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding method with selector '***' has incompatible type '****' parse

I am using Parse. I am trying to query a list of the object in the database. I am using swift programming language. I think the reason cause this error is because obj-c and swift bridge. Can anyone help me ? Here is my code.

override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {

Only the first line has error.

like image 601
Jimmy Lynn Avatar asked Sep 10 '14 02:09

Jimmy Lynn


1 Answers

EDIT! It has to be like this:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

For some code backward compatibility reasons you can use and the following:

override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell {

Just change the "!" signs with "?". I'm using Xcode 6 GM seed. There are some changes in UITableViewDataSource. Iwas geting the same error, but changing it like this work for me ...

like image 85
Hristo Atanasov Avatar answered Nov 18 '22 02:11

Hristo Atanasov