How to make Xcode automatically conform to a protocol

When I use a prototype table view, I always have to conform to the protocol TableViewDataSource. I always forget what methods I need to implement, so I have to look at the source of the protocol every time. This is really time consuming.

I think Xcode must have a feature that automatically implements the needed methods for you, right? Just like IntelliJ IDEA, Eclipse, and Visual Studio.

  • Understanding this use of “(Private)” in @interface declaration
  • Varieties of @interface declarations, some with parentheses
  • Viewing the code generated by @synthesize for getter/setter
  • Xcode code generation
  • Cannot assign class instance to its protocol type?
  • Is it necessary to declare ivars in @interface to match properties?
  • I want to know where can I find this feature. If there’s isn’t, is there a workaround for this? At least I don’t have to open the source code of the protocol each time I conform to it.

    If you don’t understand what I mean, here’s some code:

    I have a protocol

    protocol Hello {
        func doStuff ()

    When I conform to it,

    class MyClass: Hello {

    I often don’t remember the names of the methods that I need to implement. If Xcode has a feature that turns the above code, into this:

    class MyClass: Hello {
        func doStuff () {

    Now you understand what I mean? I just want to ask where to find such a feature.

    3 Solutions Collect From Internet About “How to make Xcode automatically conform to a protocol”

    Well if i understood your problem then here is a workaround:

    try to define methods with protocol as prefix like here hello then you’ll not have to remember the methods just start typing protocol name and XCODE will prompt you with all available methods see here:

    enter image description here

    And if you want autocomplete protocol try

    Xcode 9, takes care of implementation of mandatory methods of Swift Datasource & Delegates.

    Look at these snapshots, with example of UICollectionViewDataSource:

    Indicating warning to implement protocol methods:

    enter image description here

    By clicking on ‘Fix’ button, it has added all mandatory methods:

    enter image description here

    Xcode won’t do it for you.

    If you look at the documentation for the protocol, it’s clearly marked which functions you have to implement: