Wrong assistant editor

Hello everybody

This is my first post because I'm new to work with xcode. Now I have a problem. On the "Main.storyboard" I designed the first and second page. When I open the assistant editor on the first screen, it shows me the correct one with the name "viewController.swift". On the second screen I inserted a "SettingsViewController.swift" under class after creating a new "cocoa touch class" file with the name "SettingsViewController.swift". When I activate the assistant editor on the second screen, it shows me the file called "UIResponder.h". I can not switch it manually. What am I doing wrong? I hope for a helpful answer. And I apologize for my spelling or gramatik.

Thank you very much

Replies

Let's look at it step by step to be sure to understand.


First, which version of XCode ?


On the "Main.storyboard" I designed the first and second page.

1. You have 2 viewControllers in the storyboard. Exact ?

2. The first was created automatically and has a class ViewController. Exact ?

3. You created the second by dragging a ViewController from the object library to the canvas. Exact ?


When I open the assistant editor on the first screen, it shows me the correct one with the name "viewController.swift".

How do you open ? In XCode 10, by clicking on the intertwined OO

On XCode11, by hitting the button at top right with the horizal lines and select Assistant Editor. Then the horizontal lines icon turn into the intertwined OO

5. Which one ?


On the second screen I inserted a "SettingsViewController.swift" under class after creating a new "cocoa touch class" file with the name "SettingsViewController.swift".

6. You created a subclass SettingsViewControlle of UIViewController ?

So in its code (SettingsViewController.swift), you should have:

class SettingsViewController: UIViewController {

7. Exact ?

8. In the identity inspector for the scene, you have a custom class : SettingsViewController. Exact ?


When I activate the assistant editor on the second screen, it shows me the file called "UIResponder.h". I can not switch it manually.

9. You select the second ViewController in IB (not the second screen, but second VC). Exact ?

10. Then the associated class file (SettingsViewController.swift) should display on the right panel

Check that you see AUtomatic written right to the intertwined OO at the top of the right panel.


Thanks to read carefully and answer precisely to each question.

hello claude31


Thank you for your quick response.


My xcode version: 11.1


Now I answer your questions:

  1. correct
  2. correct
  3. correct
  4. i clicked "editor" at the top of the bar and then "assistant".
  5. see point 10
  6. correct
  7. correct
  8. correct
  9. correct
  10. the name is displayed but I keep the horizontal lines when I click on assistant. unfortunately there is no OO to see.


Thank you very much

I experience the same situation after testing on a new project.


But, if you click on Automatic, at the top of the right panel, after selecting the SettingViewController in the storyboard, you should should see 2 submenu items : UIresponder and SettingsViewController.


Selecting the second will lead you to the desired file.


The right configuration is to click on Automatic, then select Top level Object in the pop up menu.


Now, when you select a VC in storyboard, the right file will be displayed.

Unfortunately, it seems to return to Automatic when you reopen the project.


A bit cumbersome.

That is precisely the problem. in the submenu only "UIResponder.h" can be seen. and when I click on "top level objects": "no assistant results".

Did you try both of the following:


- Click on Automatic, at the top of the right panel, after selecting the SettingViewController in the storyboard

-> Do you see 2 submenu items : UIresponder and SettingsViewController.


- Click on Automatic, then select Top level Object in the pop up menu.

-> Does it offer you to select the SettingsVC ?


May be there's a bug ; at least it is very clumsy.


You should file a bug or enhancement request.

- no, only one submenu: "UIresponder.h"


- no, it does not show me anything that I could choose.


yes maybe. the funny thing is that this happens on both of my macbooks. even with a new project.

but thank you for your help.

It is very bizarre.


I have created a new project in XCode11.


IB panel is on the left, the code panel on the right.


And I get, after selecting the second VC in IB:

- Automatic (2), letting me select one of the 2

- Top level objects (1), with only the second VC


Can you select the file from the file browser on the left ?

Is it a SwiftUI project (guess no as you have a storyboard).


Definetely, should file a but

Okay thank you for your help. Today i made a new project and follow your steps. It works now.

Great. Don't forget to close the thread. Good luck for continuation.

I am having the same issue, I have gone too far make a new project and start over. I was wondering if there is an actual fix for this problem

Did you try what I proposed in my post of Oct 9, 2019 9:10 AM

I did yes, I asked this question on stackoverflow and this is the answer i got

"

"In Xcode 11 there is really no such thing as the assistant editor any more. It exists, but it is very limited and automatic, as you see. It isn’t needed any more because now you can just open multiple ordinary editor panes.

So turn off the assistant and just Option click on a file listing in the project navigator to show it in its own pane."


Now i have tried this before i asked but it wouldnt do what I what i was trying to do.

I was trying to connect my storyboard to my code. Upon further inspection it turns out I forgot to set the class within my view controller to the desired one.

  • That is actually great answer ! It helped me with the same problem in Xcode 12.5.1. I feel st-u-p-id now because of such an obvious solution which i haven't figured out by myself => "...you can just open multiple ordinary editor panes..." Thank you!

Add a Comment

I had this same issue, for me, it started to work after I restarted xcode.

Thanks, this was helpful