Amit Amit - 19 days ago 6
Objective-C Question

Trick to get appropriate auto complete method in xcode

I have a query what is the best trick to easily get correct method using autocomplete in Xcode for swift.

Like for objective C the trick is use - sign for instance method and + for class methods.

Then next just add return type Xcode will show you appropriate methods.

For example if I want to get the the method

cellForRowAtIndexPath
of tableview datasource.
I have attached two images how result changes when we provide return type.


  1. Without adding return type



enter image description here


  1. With return type.
    enter image description here



Now since in swift syntax of a function or method return type is at the end of the function, what else we can do to easily get required results.

Answer

You just start typing cellForRowAtIndexPath you will get that particular method. No need to type from tableView...blah blah... Just type the methods main phrase, then you will get correct method in suggestion.

enter image description here

Thanks:)

Comments