Xcode 8 auto-generated quick help documentation
This refers to Xcode 8 (and later) feature, where you can select a method like this:
func foo(bar: Int) -> String { ... }
... and then press ⌘+option+/ (or choose “Structure” » “Add documentation” from Xcode's “Editor” menu) and it will generate the following comments template for you:
/// <#Description#>
///
/// - parameter bar: <#bar description#>
///
/// - returns: <#return value description#>
It just facilitates the writing of documentation for Quick Help.
Note, while this behavior has changed a bit over time, Xcode can be particular about where the cursor must be when you attempt to do this. For example, the cursor has to be somewhere in the function name, foo
in my above example, for this to work. Or just double click on the function name and then press ⌘+option+/
You asked whether this feature replaces tools like Jazzy.
No, it doesn’t replace Jazzy or similar tools. Amongst other things, Jazzy creates stand-alone HTML documentation from this inline documentation. So, it is simply a question of whether you need these stand-alone outputs from Jazzy for any reason. If so, use Jazzy (or similar tool) in conjunction with this integrated documentation. If not (i.e., you are only looking for documentation from within the Xcode IDE), then Jazzy is not needed.
How to include Doxygen method description in Xcode's autocomplete popup?
Good news everyone! Xcode 5 now has built-in support for DOxygen style comments. So, you can comment your methods like this:
/*!
* Provides an NSManagedObjectContext singleton appropriate for use on the main
* thread. If the context doesn't already exist it is created and bound to the
* persistent store coordinator for the application, otherwise the existing
* singleton contextis returned.
* \param someParameter You can even add parameters
* \returns The a shared NSManagedObjectContext for the application.
*/
+ (NSManagedObjectContext *)sharedContext;
Inline help will look like this:
Quick help will look like this:
And sidebar help will look like this:
Here's a handy code snippet you can add the your Xcode Code Snippet library to make method documentation simple:
/**
<#description#>
@param <#parameter#>
@returns <#retval#>
@exception <#throws#>
*/
Now, you can just type "doxy" and poof! You have your doxygen template.
Toggle iOS 8 predictive text while typing
As of now (Xcode 6.0.1) there is no documented feature to enable/disable predictive bar on the go. But there is a way to toggle it programmatically. I also tried some other methods (eg. setNeedsLayout
on input view) but this is the only one that works.
[textfield resignFirstResponder];
[textfield becomeFirstResponder];
It even works in an animation block but awful animations, don't use it :]
XCode Show Function Parameters Hotkey
Just discovered Option + Escape by browsing through the XCode Preferences Hotkeys section. It actually lists the parameter info in a tooltip (no other hotkey I've seen so far does this!), but isn't quite as friendly as Visual Studio's Ctrl+Shift+Space function. For instance, the text selection cursor (caret) must be on the function name (not on a parameter to that function).
Having explored the XCode hotkeys exhaustively, I'm going to assume that this is the best it gets in XCode.
Is there a way to jump to a specific method in Xcode?
I think this is what you're looking for:
Type ctrl-6 to activate the "Show Document Items" in the "Jump Bar". Then start typing part of the method you are looking for to narrow the results.
Example:
To jump straight to - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Type ctrl-6, type "cellFor", arrow down so the method is highlighted, and press Enter. The Editor will jump right to that method.
Incidentally, you can use ctrl-1, ctrl-2, ctrl-3, etc. to access the different sections of the "Jump Bar".
How can I make auto-complete display a list in Xcode
Press the escape key when auto-complete makes the first suggestion. This will display the list.
Related Topics
How to Change the Font Size of a Uilabel in Swift
How to Programmatically Check and Open an Existing App in iOS 8
How to Determine If a Business Is Open Given the Hours of Operation (Swift-Ios)
Make a Uiwebview as Height as Its Content with Auto Layout
Gmsmarker Icon in the Top Left Corner of the View (Ios)
Save Depth Images from Truedepth Camera
How to Get the Nondecoded Attributes from a Decoder Container in Swift 4
iOS Swift - Custom Camera Overlay
Include Pods in Main Target and Not in Watchkit Extension
Recognizing Touch Events Only Inside the Masked View
How to Handle Oauth-Style Log Ins with Imessage Apps in iOS 10, Xcode 8
Please Specify a Platform for This Target in Your Podfile
Restkit, Coredata and Swift - I Can't Seem to Fetch Results Back Out
Saving Contact Address to Unified Contact Results in (Cnerrordomain Error 500)
How to Bridge Nsnumber to Float in JSON Parsing
How to Hide API Keys in Github for iOS (Swift) Projects
How to Make Synchronous Operation with Asynchronous Callback