See why "type does not match protocol" in Xcode (fast)

I often have relatively complex protocols with related type restrictions, used in generics, used by extensions like CoreData, etc. Therefore, I often get an error: Type .. does not conform to protocol ... Usually I can figure this out after a while, but the error message is really useless - and usually if the problem is a minor typo in the method signature or something else, the error takes a little time to find. With Java interfaces, IDEs often report something like method ... not implemented or something like that, so I know which method to look in more detail.

Is there a way to make Xcode report information about protocol members that are not in the corresponding type?

+5
source share
1 answer

When you get this error, click on the arrow to expand it. It will show the required functions (s) that are missing.

Here is an example when I implement a UITableViewDataSource, but I forgot to provide the cellForRowAtIndexPath function.

enter image description here

+16
source

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


All Articles