Search code examples
iosxcodeswiftautocompleteprotocols

Auto-implement Swift protocol methods in Xcode


I just started with the swift language and coming from java it looks great so far. But I'm really missing something:

Eclipse had this great feature that when I added "implements XYZ" it provided me a function to automatically implement the necessary function stubs. This is a huge timesaver.

Xcode doesn't seem to have this feature, or am I missing something?

I found the accessorize plugin, but this seems only to work with Objective C..

Is there a solution?

PS. I'm using Xcode 6.1.1


Solution

  • Xcode 9

    Xcode 9 now supports conforming to protocol methods via a "fix it". It will automatically fill the missing methods for you. This was announced in WWDC 2017.

    enter image description here

    Update: This doesn't seem to work for protocols defined by you, unfortunately.