The overriding method with the selector '***' has an incompatible type '****' parse

I am using Parse. I am trying to query a list of objects in a database. I use a fast programming language. I think the reason is that this error is caused by obj-c and fast bridge. Can someone help me? Here is my code.

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

Only the first line has an error.

+5
source share
2 answers

CHANGE! It should be like this:

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

For some backward compatibility considerations, you can use the following:

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

Just change the "!" characters with the letter "?". I use Xcode 6 GM seeds. There are some changes to the UITableViewDataSource. I get the same error, but change it like this work for me ...

+9
source

You can delete! after UITableView, NSIndexPath and UITableViewCell as the "UITableViewDataSource protocol" have the signature below:

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

Hristo Atanasov's answer also worked for me.

0
source

Source: https://habr.com/ru/post/1202205/


All Articles