StoryBoard Assistant Editor stopped showing associated file
Asked Answered
I

23

63

Xcode storyboard assistant editor stopped showing related files. "Automatic" is selected and "Class" is filled in Identity Inspector.

It was working before, but know it has stopped. "Auto" or "CounterPart" modes are still woking for other files except StoryBoard.

A few days ago, I tried to update from Xcode 5 to 6, but later on gave up. Would that have something to do with it?

Indiaindiaman answered 11/12, 2014 at 15:25 Comment(6)
have the same problem too with xCode 6.2 beta.Loot
same problem here, could you find a solution?Olsen
I have seen what could be a solution at the video youtube.com/watch?v=wPAUKhlmW1M at time-position 1:31 - please correct if I'm wrongJalisajalisco
why is this such a common and simple issue and yet there's no definitive answer to itAlthing
In my case, I deleted the Derived Folder as mentioned below and selected the Custom Class in Identity Inspector. Hope this helps, Thanks.Conveyor
I just let the indexing process complete and the assistant started working.Walrath
O
74

Found the solution (at least worked for me), it's the same bug that causes you not to be able to create new outlets. You must delete the [DerivedData] folder:

  1. Close the project you are working on with.
  2. Delete the【DerivedData】folder of you project. (This folder may inside your project's folder, or inside ~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere else that were setup by you.
  3. Restart Xcode.

see here.

Olsen answered 9/1, 2015 at 13:34 Comment(5)
Working with XCode 10Lesleelesley
This did not seem to work for me initially, but after Xcode 10.2 had finished indexing after having deleted the derived data, everything was back to normal.Laborsaving
Library may be a hidden folder on your machine. To get there I went to Xcode preferences, Location tab, click on link to the DerivedData location. Quick and easy.Ladybird
Got the same issue on Version 12.4 (12D4e) and above does not fix the problem for me :(Bacchus
Ran into the same issue described above on XCode 12.5. @Anna-Chiara Bellini solution still works 6.5 years after the fact (thanks for that), but I'm stuck with... "Why???" Why is this still an issue? What am I doing to cause the problem in the first place? What can I do to avoid it? It's a bit aggravating that something this annoying persists this long.Lubbi
A
89

With XCode 11 onwards, you can option(alt) + click on the file that you want to view in assistant editor. Simple Fix.

Acrocarpous answered 19/4, 2020 at 17:36 Comment(7)
this helps to open the file in editor, however does not let's you create outlet connections between the prototype in your storyboard and the code that represents the view.Conveyor
If I have the desired file open in storyboard, and in the left sidebar/File Explorer I option + click on the Obj-C/Swift file I want, that code file will then appear in an assistant editor pane partially covering the IB space. I can then click + drag from the outlet I want to either the IB object itself, or to its text label in the left-side inspector. Using Xcode 11.3.1Percale
Upvoted since this is a quick fix but Apple should really get the Assistant working properly. Maybe it is working well in Xcode 12.2 or Xcode 12.3?Execrative
[option + click] on the file on the project navigator.Sikorsky
Good hack. Issue still persists in XCode 13 too. This one worked.Upanddown
@AmitKhetan disagree. Successfully created outlet by this mechanism in XCode 13.1Upanddown
Correct answer for 2022, iOS 13.xRutaceous
O
74

Found the solution (at least worked for me), it's the same bug that causes you not to be able to create new outlets. You must delete the [DerivedData] folder:

  1. Close the project you are working on with.
  2. Delete the【DerivedData】folder of you project. (This folder may inside your project's folder, or inside ~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere else that were setup by you.
  3. Restart Xcode.

see here.

Olsen answered 9/1, 2015 at 13:34 Comment(5)
Working with XCode 10Lesleelesley
This did not seem to work for me initially, but after Xcode 10.2 had finished indexing after having deleted the derived data, everything was back to normal.Laborsaving
Library may be a hidden folder on your machine. To get there I went to Xcode preferences, Location tab, click on link to the DerivedData location. Quick and easy.Ladybird
Got the same issue on Version 12.4 (12D4e) and above does not fix the problem for me :(Bacchus
Ran into the same issue described above on XCode 12.5. @Anna-Chiara Bellini solution still works 6.5 years after the fact (thanks for that), but I'm stuck with... "Why???" Why is this still an issue? What am I doing to cause the problem in the first place? What can I do to avoid it? It's a bit aggravating that something this annoying persists this long.Lubbi
J
15

In same case this worked for me:

  1. Right click on ViewController file(on left pane) and choose Delete -> Remove Reference.
  2. Right click on folder where this ViewController file was and choose Add files to .. and add this ViewController file which your just deleted.
  3. Profit.
Jubilee answered 17/12, 2018 at 22:53 Comment(2)
This helped me at the end, but first attempt in Xcode 11 beta 7 failed. The file was not recognized at all. It was visible / editable but the compiler didn't see it. Solution was to change the source code (just add a blank in an comment) and saved it, after that everything works as before...Swifter
This works in Swift 5.2 and the release version of Xcode 11Beulahbeuthel
N
9

Deleting the Derived Data didn't work for me nor force quitting Xcode and restarting it.

The only thing that worked was deleting both the class and the storyboard (only the reference to them) and adding them back to the project.

Hope to help someone.

Nonoccurrence answered 9/2, 2017 at 2:48 Comment(3)
Fixed it for me alsoSilassilastic
@shelll, it's still happening sometimes. Have you tried forcing the setting of the class, that is to say manually selecting the class you want to associate the view with? Restarting Xcode (or sometimes the whole OS) helps too. Also try deleting the Derived Data (https://mcmap.net/q/301361/-storyboard-assistant-editor-stopped-showing-associated-file) and Clean Build Folder as well (alt + command + Product > Clean Build Folder...).Nonoccurrence
I have tried everything, including system restart, delete derived data, etc. i have already tried xcode 9.4 beta, but that is broken too. none of my xibs work anymore. clicking the arrow next to custom class' name does not open it. cannot pull out new outlets. but manually writing the outlet/action code and then i can connect the ui from xibs there. downgrading to xcode 9.2 fixed the issue.Sascha
C
6

If anyone is wondering how to find Assistant editor in XCode 11 then please find the steps from the below image. You can show this options in storyboard or Xib files on upper left corner.

enter image description here

Chapbook answered 15/11, 2019 at 5:54 Comment(0)
R
6

I have Xcode 13.1 and none of these solutions is working for me, but this simple solution works for me every single time. With your Storyboard and (empty) Assistant Editor open, in the upper right of the Editor window click the "Add Editor on Right" icon Editor On Right Icon, and just as promised, it will open a new editor to the right of your Storyboard and (broken) Assistant Editor, only the Assistant in THIS window will be working! Just find the "Close Window" x on your broken editor, close it, and in its place will be your shiny new working Assistant!

Full Editor View of where to click to open the new Editor On Right

Robbegrillet answered 12/12, 2021 at 3:1 Comment(2)
Thank you! This also works when jump-to-counterpart is broken. Simply add a new editor, confirm it works there, and simply close the broken editor.Emblem
this works like a charm, without having to modify project components. Thanks.Kalbli
R
5

Maybe it's too late but just with the keyboard, you can launch a reset for associated files. Use the keyboard : command + option + shift + z

You can find it in the menu Xcode->View->Assistant Editor->Reset Editor.

Regenerate answered 28/11, 2016 at 17:31 Comment(1)
it looks disabled optionLachrymatory
C
4

Click first on the assistant window, then click on 'option'+'alt' and right click on the view controller that you want.

Chrystalchryste answered 7/3, 2021 at 10:3 Comment(2)
mac os doesnt' have Alt keyReamonn
it's 'option' in mac sorry @ReamonnChrystalchryste
M
4

Tried all the above methods whereas after simply running the app Command + B fixed this issue and I was able to select the screen under automatic.

Metastasis answered 22/5, 2022 at 19:6 Comment(0)
N
2

This command on terminal fixed my issue:

    defaults write com.apple.dt.XCode IDEIndexDisable 0
Nitaniter answered 15/12, 2016 at 7:26 Comment(0)
B
2

simply exiting and reopening Xcode worked for me.

Bcd answered 17/4, 2021 at 14:43 Comment(1)
This did the trick.Doddering
L
1

For Xcode 8+ versions

Check at top process indicator that if Xcode is "indexing" files... if yes, then, please wait until it finishes. Once it get finished. Your file will automatically appear as counterpart in Automatic section.

If Xcode is not showing "indexing" in process bar, then perform as @Anna Chiara's Answer

Lachrymatory answered 7/6, 2017 at 11:40 Comment(0)
N
1
  • I deleted ~/Library/Developer/XCode/DerivedData -> didn't work
  • Xcode->View->Assistant Editor->Reset Editor is disable

Finally, I figured out that the class name of File's Owner of .xib file is incorrect (the class doesn't exist). I corrected it and Assistant Editor works again.

Hope this helps you

Nematode answered 10/10, 2017 at 7:59 Comment(0)
P
1

I had the same problem. Finally this is what worked for me.

  1. Changing the name of the ViewController File.
  2. Change the name of the class to the new name via the Refactor tool

Refactor tool

Pomiferous answered 27/1, 2020 at 19:21 Comment(0)
P
1

The only thing that ended up working for me was copying over the code from the offending ViewController files and completely deleting them, then creating new ones with the exact same name and pasting in the previous code.

The assistant then linked up to the new ViewController files with no issue.

Punctilio answered 12/4, 2021 at 7:9 Comment(0)
B
1

None of these answers worked for me w/ XCode 13. However, the following worked:

  1. Rename the ViewController class to ViewController2

  2. Update the reference in the storyboard to ViewController2

    This made the assistant editor appear.

  3. Change the name of the class back to ViewController. Change the reference in main.storyboard back to ViewController and hit enter (Step 2)

Boston answered 15/10, 2021 at 14:43 Comment(0)
L
0

I had same issue and spent almost 2 hours of trying different aproaches finally I found something to solve problem.

I've created two or more VC at the same swift file and I think that's why IDE confused about the files. So I suggest that you should delete your viewcontroller class and clean than reassign class.

I hope it works for you too.

Ladida answered 15/12, 2015 at 13:12 Comment(0)
B
0

For what it is worth, this was happening to me for the last couple days on 9.3 . I had just added a new build schema for an alternate debug symbol on testflight. It was not until I removed the new schema and then deleted Derived Data and restarted did it start working again. I have re-added the new schema back in and it continues to work. Not sure what the issue was, but that is what solved it for me.

Betake answered 4/6, 2018 at 14:33 Comment(0)
N
0

In case anyone is watching I had a bizarre instance of this (Xcode 11): I deleted a View Controller that I'd done incorrectly; dropped in a new one, created the UIView and associated. BUT I didn't bother to create the outlet from the View Controller on the previous screen. Strange that it let me work for a few minutes, then after I had turned off the assistant editor to do something else, turned it back on and only had the UIResponder.h file. Edit - this happened again. Had to delete the 'wire' to the next screen, then recreate - then option to get to the correct .m and .h files reappeared.

Nailhead answered 30/3, 2020 at 0:2 Comment(0)
V
0

I faced a similar issue and here's what I did I had a swift file and a xib file with its class connected to the swift file like so inside a group folder, and it doesn't show that they're connected.
But when I take them off the folder the assistant works somehow, so I took them off the folder and made an outlet from a UILabel then put them back inside the folder then they're permenantly connected.

Viator answered 11/1, 2022 at 5:48 Comment(0)
G
0

Quite Xcode and reopen it. This is solve my problem.

Garotte answered 28/7, 2022 at 5:23 Comment(0)
S
0

I had the same problem. But my problem was about having the VC's under "View Controller" folder. When I move VC's to main folder instead of "View Controller" folder, I was able to reach the assistant without problem. If you have the same issue like mine, you can solve by deleting all the VC's and create again under your sub folder.

Sheena answered 6/12, 2022 at 15:38 Comment(0)
A
0

Just add the Class on right side of your story board which you want to open in assistant

Arsenical answered 17/2, 2023 at 10:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.