Xcode 8: custom description in suggestion - xcode

I'm trying to have custom description for my functions shown in the suggestions box which shows up as I type said function names, the same way it works for swift functions: e.g the UIActivityIndicatorView.startAnimating() description is shown both in the
QuickHelp menu AND in the completion box
in Xcode 7 I would just add a comment line with the /** */ tags prior to the function declaration and the ide would recognize it accordingly e.g.
but for some reason doing so with Xcode 8 only shows the custom description within the QuickHelp tab of the Utilities menu, and not in the suggestion box.
Is there any suggestion about how I may obtain the same behavior with this new version of Xcode? I would appreciate it a lot!

Hear i found some solution. You need to change User Header Search Path No to Yes under Build settings. And then restart your xcode.
This is working fine for me.

It is because of Indexing.... just go to your project name at the top of navigation and Clean (cmd+shift+k) then come again to the file where you wanna work type any word you will see suggestion popUp. that it..
Other way is that just quit your xcode and open it again and wait for a moment let xcode indexing the files then type any word you will see suggestion popUp. that it..

Related

Xcode assistant editor won't show some of the code

First of all, I would like you to know that the class IS set to the correct file in each ViewController - I know that because it did work before, but then I got a "crash" in Xcode that blinked quickly without me being able to read it before it went off again.
MY PROBLEM IS:
I have a lot of ViewControllers in my Xcode, everything was working fine, I was making some more features to the ViewControllers.
Then I got the "crash" as mentioned above, and it would not show any of the files/classes related to their ViewController in assistant editor.
Assistant editor just said: No Assistant Results. Then I read that I could just show the files inside my XCode project and delete project.xcworkplace and xcuserdata. And I thought it worked at first, but it did not work on every viewcontroller unfortunately - only on some of them.
Now, I still have plenty of ViewControllers left to edit that aren't working, and I would hate if I had to recreate every single one.
Does anyone have a better solution to this? I really hope you do :-)
Make sure you set Automatic not Manual.
There was some related answer but I can't find it. Anyhow: what I do to fix it is to uncheck the Target Membership in the File Inspector for the XIB and then turn it on again. That fixes the issue (in most cases) for me.
Also try restarting/clearing the different caches of XCode.
I was similarly not able to view code/classes relating to the View Controller. In my particular case, it appears i might have caused the issue- I turned OFF Indexing because Xcode was running terribly slow and around that time I started getting the issue and the message “No assistant results”.
To resolve this in my case, I turned indexing back ON and set the Assistant editor to “Automatic”.
To turn Indexing On or Off, open up the Terminal using either of the below commands-
Turn Indexing OFF:
defaults write com.apple.dt.XCode IDEIndexDisable 1
Turn Indexing ON :
defaults write com.apple.dt.XCode IDEIndexDisable 0
From accepted answer regarding Indexing: Stopping xcode from indexing
xcode 9.0
Open project.
Click on "Show the assistant editor".(top right side middle button - circle shape)
Code was show after do second step.
I cloned a project and found that I have the same problem. But all I did to fix it was to just sign the app at Signing and Capabilities and the option for the right View Controller pops up in the top bar of the Assisntant in my View

Xcode 6 - Main.storyboard only showing up as source code, Interface Builder missing

Somehow my Xcode settings got messed up as it would only show my Main.storyboard file as XML code. I've been told this can be fixed by selecting the Interface Builder from the "Open As" menu, but there is nothing under the menu (the only "selection" is a greyed-out "<None>"). I've cleared my Xcode caches, but this does not help. Other than that, my project still compiles properly.
How can this be resolved?
As so many people have pointed out, right-click on the file and hover over Open As and select Default - Interface Builder.
However, if this is not an option for you because Open As shows <None>, make sure you are in the standard editor and not the version editor. Go up to View in Xcode menu --> view --> hover over Standard Editor and select Show Standard Editor. Now repeat the steps others have suggested and you should get the results you're looking for.
Hide Code Review helped here (Xcode 12.2).
You might be in code review mode and Xcode thinks you want to compare the XMLs
change to Standard Editor by clicking 'Command + Enter' key . Then Main.storyboard may show as Interface Builder.
I had the same issue, where "Open As" wasn't an option on the main storyboard, and xibs were also showing as XML.
The solution that worked for me was to right click on an xib which did have the "Open as --> Interface Builder" option. Then, I went back to storyboard, and the main storyboard showed up properly.
Tap on the Arrows icon that are left and right, see image below:
If you go over to the project outline and control click on the storyboard file and hold down the cursor, you will see the option to open as, this will let you open the storyboard as a certain type. Click on that and choose open as story board. Good luck!
EDIT#1
Sorry, I think I misread your post. I thought you were doing those steps from the menu bar. Not the outline. I am assuming you have restarted Xcode and your computer.
I had this issue with Xcode 8, no luck with Open As > menu... and the solution was as follow:
Make sure the Type is Default - Interface Builder in the Identity and Type right panel (see screenshot). In my case it was "Swift source code" selected :
Now, in the left pane, right-click on your storyboard, and magically then the option Open As > Interface Builder - Storyboard appeared !
I had "Main.storyboard.xml" in Xcode 9 folder but can not see "Default - Interface Builder" in the list of extensions proposed in "Identity and type".
I simply deleted the .xml extension in the name of "Identity and type" and then I can see again "Default - Interface Builder" in Open as.
This is just a quick fix/ long shot, and depending on the specifics of your situation it might not be helpful at all, but you can import and open storyboard files in other projects.
So, try importing your storyboard file in a new project and see if it displayed correctly there.
Has helped me in the past with misbehaving nib files.
Took some doing but I found how to fix this every time... When you click on the storyboard and it is showing as source, click on the icon that shows the utilities view on the righthand side.. Look for the identity type.. Type should be Default - Interface Builder.. Mine got switch to C Source Code.. Not sure how.. but...
I was stuck at (Hide Code Review helped here . You might be in code review mode and Xcode thinks you want to compare the XMLs)
left and right arrow icons is code review Mode

Add Swift code snippet in Xcode 6

I want to add the following code to Xcode's user code snippets:
println(" = \()")
I drag it to the code snippets area, I give it a Title, a Summary, a Completion shortcut, and a Completion scope of All
Why doesn't it show up in Xcode's auto-complete suggestions?
I am using Xcode 6.0.1 (6A317)
Your issue is you have a conflicting completion shortcut with one that already exists in XODE: "println". You need to choose something unique. There are some good explanations of the dos and don'ts here:
http://nshipster.com/xcode-snippets/

Delete a User Code Snippet in Xcode

How ??? I can not delete a custom code snippet in Xcode.
I did these steps :
Select needed code snippet and press Delete key.
A pop-up window will appear , and select Delete button.
Remember that : this action cannot be undone.
In the Library select the code snippet you want to delete and press Backspace. A confirm dialog will show up, click "Delete".
Good question, I haven't found a way to do it from within Xcode, but they can be deleted from the Finder. The snippets are stored at ~/Library/Developer/Xcode/UserData/CodeSnippets/. Each one is a separate file that you can delete. Unfortunately they're named with an ID and don't give an indication of which one is which. They're XML files though, so either use a text editor or QuickLook to see the contents and recognise them.
Also, I've had to restart Xcode in order to get the deleted snippets to no longer show up.
I was having trouble, and after messing around a bit it finally worked. You select the user snip and hit the delete key. I tried this multiple times but it didn't work initially. This may be due to me running a prerelease version of Xcode though.
In Xcode 10, select snippet from snippet pop-up dialog.
Then press Shift+⌘
After that just confirm your removal.
Note: This process cannot be undo at this moment.
I was trying forever to delete the useless (to me) C++ ones, but apparently you can only delete the user-created ones in Xcode 10. Bummer.
User-created code snippets are located in
~/Library/Developer/Xcode/UserData/CodeSnippets.
If your XCode UI for deletings snippets doesn't work as in my Xcode 10.2.1, you can navigate to this folder and
either delete all user snippets with rm * or use some kind of cat/grep to find the ones you want to delete.
In xcode select the code snippet
Delete title and shortcut and save it after that select the same and press delete a confirmation box pops up asking you to delete or cancel the code snippet.

How can I make auto-complete display a list in Xcode

How can I use auto-complete in Xcode like I can in Visual Studio and Eclipse? Specifically in VS and Eclipse auto-complete displays a list of choices... while Xcode just displays a single choice.
For example Xcode might suggest "myVariable" when I type in "myV". That's fine but what if I have the following objects in the scope of my function: "myInt1" and "myInt2"? Xcode will suggest "myInt1" when I type "myI" but I'd like to have a list. Or it would be great to, say, tab through the various possibilities like in some shells. So typing "myI" would get the suggestions "myInt1" and then pressing tab would change the suggestion to "myInt2".
Cheers!
Press the escape key when auto-complete makes the first suggestion. This will display the list.
control + space also works in the latest Xcode.

Resources