4

First of all it's not the duplicate of this question because i couldn't find any discussion about offline documentation, suitable answers and about future release of updates in Xcode there.

Actually I am from android and java background and currently starting to develop iOS apps too. As we all know we use to implement all methods of an Interface easily with the help of suggestions given in IDE by pressing Alt + Enter.

And here in the iOS we have to see the reference each time and search for all required & optional methods, and implement them manually one by one which consumes times It's fine for a moment But

My Questions are :

  1. Is there Any easiest way to view all required method at first lookup in documentation OR implement all required methods of protocol with the help of IDE ?
  2. Is it possible that we will get this feature in future release of Xcode's update ?
  3. I can't be ensure availability of Internet all the time, And How can I see the documentation at that time ?
Community
  • 1
  • 1
Shree Krishna
  • 8,474
  • 6
  • 40
  • 68
  • 1
    this is not the solution but, i use snippet for mostly used protocols like `UITableViewDelegate` however it is not possible to create snippet for all protocols. I hope that XCode will have this feature in the future releases. – meth Jan 21 '16 at 11:37

2 Answers2

9

Just go ahead and declare that your class adopts the protocol in question.

Xcode will point the error if you fail to implement any of the required methods:

enter image description here

From the list under the disclosure triangle (items with gray "!" icons), you can get a hint of the names of the missing methods. You can start to type and autocomplete will do the rest.


Update for Xcode 9:

It looks like now, you can auto-fill the methods with one click:

Refactoring

  • Rename a symbol in a single file or in a project across Swift, C, Objective-C, C++ files, and Interface Builder files.
  • View all the possible changes in one editor pane.
  • Convert method signatures between Swift and Objective-C formats.
  • Update properties, getters, setters, and synthesized iVars as needed.
  • Apply a fix-it everywhere with one button.
  • Automatically fill in missing cases in switch statements, and mandatory methods for protocol conformance with one click.
  • Extract method functionality for all supported languages, along with other language-specific local refactoring.

(emphasis mine)

And indeed:

enter image description here

Clicking "Fix" adds the necessary method stubs.

Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
  • Thank you very much !!I was trying to search required methods in the whole reference.. – Shree Krishna Feb 03 '16 at 06:11
  • I couldn't find the Fix-it at first but this made it appear for me: If you see a red exclamation mark instead of a Fix-it then look for more information on the error by clicking on the disclosure triangle in the Issues Navigator. If you see something about 'Candidate is not a function' then remove or comment out that code first and then the Fix-it will appear. – Steve Moser Dec 12 '17 at 14:29
2

Go to Xcode -> preferences(on top-left corner) -> downloads -> here you will see list of items that can be downloaded. Download the documentation for iOS x.x version. So now, whenever you are offline.. you can go to help(top bar in window) -> documentation and search for whole ios documentation.. all the development guides etc

Akshay Patel
  • 157
  • 5