In Xcode 8, if you declare that a class (or struct) conforms to a protocol, but haven't implemented the required methods (functions?) Xcode will give this message "Type 'ClassName
' does not conform to protocol 'ProtocolName
'" which is true.
If you open the error by clicking the disclosure triangle, you will see a number of items with grey exclamation mark icons. Each item says "Protocol requires function ... do you want to add a stub?" I do want to add a stub! How do I tell it to add a stub for me?
The answer of raphh is right but xcode is still a little buggy here (at least for me),
If you don't select the Fix-it
right after compiling the dot mark transform to exclamation mark and you can't make it appear again unless you try to build one more time.
Right after building : Dot error icon
When you don't do the Fix-it
right away :
exclamation mark error icon
You have to re-build to get the dot icon again when you have several methods to implement and you did do the Fix-it
for the first one.
Simply click on Fix-it
and Xcode will add you the stub for that method you need to implement.
Like this. See :
Thank you Xcode 8, finally !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With