58

I am having an issue where the code associated with some of my View Controllers is not showing up in the Assistant Editor window to the right of the Storyboard. It says "No Assistant Results" where the swift code should be.

Things I have tried (There are many things):

  • Cleaning project
  • Deleting DerivedData
  • Creating new, identical View Controllers to see if the issue was just in those particular views.(the same issue occurred)
  • Deleting and Reinstalling Xcode
  • Restarting my Computer.

NOTE: I also am getting a warning at the top of the editor: Internal Error has occurred, source Editor functionality is limited.

enter image description here

8
  • @AmitJagesha That question unfortunately does not answer mine, none of the solutions work for me. I included in my question all the solutions I have tried, which are the proposed solutions on the other question. Jul 12, 2016 at 13:28
  • 7.3.1, the latest. I just re-downloaded it to try and fix the problem Jul 12, 2016 at 13:30
  • can you provide zip of your code so we can test it in own xcode? Jul 12, 2016 at 13:47
  • @AmitJagesha I am sorry but my project is almost submission-ready, so I would rather not. Jul 12, 2016 at 13:50

35 Answers 35

49

Ok, I've had this problem before. I couldn't remember how I solved this so I searched on Google and found this question. But this time, nothing helped me. These are the things I did. I believe the last one solved this.

  1. Clear Derived Data. Go to Terminal and enter this: rm -rf ~/Library/Developer/Xcode/DerivedData
  2. Quit the whole Xcode.
  3. Close all tabs of Xcode and make sure to view some class files instead of Interface builder and go try again viewing assistant results.
  4. Remove the assigned class to the View Controller nib you think causes the problem, then assign the class again. Boom! Solved!
6
  • This just helped me after refactoring - Xcode didn't build correctly and also didn't show the Assistant file... Seems to be an issue with the Xcode project file
    – brainray
    Jun 25, 2020 at 11:55
  • 4
    Still happening in Xcode 12.0.1. Quittng xcode works. It's just sad how many annoying problems xcode has with adding/syncing files and this is the 12th major iteration...
    – Govind Rai
    Oct 2, 2020 at 16:13
  • Still happens in XCode 12.3. As above, closing and re-opening XCode and re-selecting the project fixes the problem. Aug 4, 2021 at 23:03
  • 1
    Closing and re-opening XCode didn't work for the latest instance of this problem but renaming the project folder (the one containing .xcodeproj file) did ... Aug 12, 2021 at 8:39
  • Quitting Xcode and reopening is resolving this for me in 13.3.1 but it is disappointing that Apple hasn't fixed this in their flagship IDE May 26, 2022 at 19:36
37

This method worked for me: (Xcode 10.2)

1- Select the broken ViewController on the StoryBoard

2- In Identity Inspector, change the item in Class to another class (any class)

3- Change the Class back to related class

4- Save and close the project

5- Reopen the project

36

What worked for me was to close Xcode entirely, open again, and then I tried assistant.

20

Just do a simple close the app and open the app again. It worked for me

0
13

Go to Assistant Mode on the upper right.

Click Command + Shift + T. New window will be opened and close the old one. You will be able to see something. Now go to Top Level Objects and select your file.

0
8

Deleting derived data did not work for my problem. This is how I solved this when I encountered this issue,

Go to the file that contains your class, go to File inspector > Target Membership, and then make sure that there is a check mark in the target of your project.

File inspector

I hope this solves your issue.

0
7

Click option+alt and click on the view controller you want to present.

3

Argh! This annoyance happens to me all the time.

I'm not 100% sure I know what the fix is, however I think I may have just "fixed" this a few seconds ago using the following voodoo:

1) Delete derived Data

2) Close xcode, reopen Xcode. Maybe Wait for indexing to finish?

3) View a source code file (.m,.h, .swift) in the main editor, the assistant editor should now show "Counterparts".

4) Change this to "Manual" rather than "Automatic"

5) Switch back to your nib/storyboard

6) Change back to "Automatic" rather than "Manual"

7) Probably continue pulling hair out :)

Edit

Seems as though maybe only step 3 is required as this happened again just now.

0
2

I had this issue and was able to resolve it. I resolved it by viewing the storyboard as source. I then removed everything in and including the tags (Saving it to restore later). I then went back and viewed the storyboard normally and created a new ViewController. Once the new ViewController was on the storyboard the assistant editor acted as normal. I then went back and viewed the storyboard as source code once again and replaced the current tags with the one I removed previously. This resolved my issues hopefully it will help for you.

2

For me (Xcode 11) it was cause by installing cocoapods, tried all the trick that I could find. Finally this helped me. Go to Xcode File Menu -> WorkSpace Settings -> enable legacy build systems enter image description here

0
2

The same problem happened to me. I only have to restart Xcode (12.2)

0
2

For any one who is encountering the same problem in Xcode version 13.3

Explanation: for me, the reason why it wasn't working is that I created a controller, view, and model Folder and I put the Main.storyboard inside the view folder and the viewController.swift inside the controller view, therefore when I try to access the assistant Result Xcode doesn't know where the viewController file is, so he is not able to connect between the storyboard file and the latter.

Solution: What worked for me is that I simply ran the app and it automatically connected the viewController with the storyboard.

I hope this was helpful.

1

I don't know if this is still helpful or not, for what is worth, the way I managed to restore this when it's been working perfectly and all of a sudden it stopped is by changing Assistant Editor view-mode.

I usually have it in Assistant Editors at bottom, so just change it to whatever else, such as All Editors Stacked Vertically and go back, and it should be working ok now.

xcode 8.3.2, if it's any use.

1

xcode screenshot of the location

I tried various ideas mentioned here but nothing worked for me. So in the Project navigator, I right clicked on the .DS_Store file, clicked on Delete, and then chose "Move to Trash" on the confirmation prompt. After closing Xcode and opening it again, a new .DS_Store file was created. The Assistant Editor is working again and the .h and .m files appear in the Project navigator again. I am using Visual Studio for Mac which communicates with Xcode. Today I had to close and open both Visual Studio and Xcode after deleting the .DS_Store file.

1
  • Where was this .DS_Store file that you deleted? I'm using Xamarin as well and am facing the same issue.
    – Justin
    Jan 15, 2020 at 17:20
1

you may have changed the name of the .swift file after you connected your IB oulets and IB actions.

select main.storyboard and select your view controller. at the far right select identity inspector. check if the class name is the same name as your .swift file, if it is not you need to put in the file name and the assistant should show up now.

0

In my case, the class name of File's Owner is incorrect (the class doesn't exist). I corrected the class name and it works again

0

Identity Inspector

Go to the view controller Identity Inspector (see the image). Change your controller to something incorrect, then change it back.

0

I had the same problem and I realized that selecting the Outlets option in the top of the Assistant Editor View solves the problem.

In addition to this, I found that if your classes are in several groups for some reason Xcode losses the reference to the class.

enter image description here

0

I setup the folder for the derived data when I installed Xcode in a folder I deleted cleaning my disk! So I created a new folder and I assigned in locations as above. Thats it! I was cleaning a file that didn't exist.in the Xcode->preferences->locations

0

If the problem started after renaming the ViewController, first check whether you've changed the class name inside the ViewController file as well.

enter image description here

0

I have disabled xcode indexing, so after enabling indexing it starts working

0

Faced same issue. For me it happen when I moved my view controllers to the new group. The solution was unfortunate, but at least it worked again - I just moved the files back to the origin folder.

0

In Xcode 12.x, this will happen if you rename your ViewController file after creating it. If this is the case, just simply delete that ViewController file, and create a new one with a file name that you will not change, and then the Assistant window should automatically populate.

0

Please make sure that there is

no error in your project and your project is complining succesfully.

In my case, there was an error om some other class due to which I was not able to see assistant results.

0

After 7 imaginary hours, I finally found the answer. this is only for the storyboard for other people out there reading this is the answer if it does not help I don't care but here it is.

(This is an example project I cloned from GitHub)

Just select veiwcontroller.swift in the document outline, it should work.

Here is a screenshot.

Like i told, example project.

1
  • 3
    Please do not include pictures of code, instead paste the code in your answer.
    – C. Peck
    May 30, 2021 at 4:15
0

Had the same problem on Xcode Version 13.0 (13A233). As Glenn Posadas mentioned, deleting the derived data rm -rf ~/Library/Developer/Xcode/DerivedData then closing and re-opening the project solved the problem for me.

0

I had the same problem, so I re-organized files in folders and it got fixed. If you have the file in a specific folder, please put it outside that folder.

0

Try this (XCode 13.2.1):

  1. In Storyboard, select the object whose class definition you want to bring up in the assistant editor.
  2. Delete the custom class in the Identity Inspector, being sure to press the return key to lock in the change.
  3. Quit XCode and reopen.
  4. Re-enter your custom class name in the Identity Inspector.

I tried all the suggestions above and this was the only thing that worked for me.

0

Xcode 13.3.1

None of these worked but I did a clean and shut everything down and reopened and it worked.

0

One reason for this happening is moving the swift file to a different folder. If I move the swift file out of the folder, the assistant view works again. If I move the swift file back into a folder, it fails again.

After trying several tricks mentioned here, this seems to have finally worked for me:

  1. Close the project,
  2. Rename the project folder in Finder (i.e. the folder containing the .xcodeproj file)
  3. Double click the .xcodeproj file to open the project.

It seems that paths stored in local cache files can be stubborn about being updated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.