1

In Xcode, when editing Swift or other files, it is possible to open one file in the Standard Editor and another file in the Assistant Editor. The Assistant Editor can be closed leaving the Standard Editor open.

Two questions:

  1. Is it possible to close the Standard Editor and leave the Assistant Editor open. (In effect making the Assistant Editor into the Standard Editor.)

  2. Is it possible to swap files between the Standard and Assistant Editors?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Vince O'Sullivan
  • 2,611
  • 32
  • 45

3 Answers3

4
  1. You cannot close the primary editor. However you can achieve the same effect by the following two shortcuts (if you have focus in the assistant editor):

    , - Open in Primary Editor
    enter - Show standard editor

  2. How to swap the files between the primary and the assistant editor I have already described here: Is there a command in Xcode 4.2 to swap two views in Assistant Editor mode from left to right and vice versa?

Community
  • 1
  • 1
Marián Černý
  • 15,096
  • 4
  • 70
  • 83
1

While I agree that it would be nice to have a simple button that swaps the files in the editors, the quickest way I've found is to use this button, located at the top of each editors:

enter image description here

It will open a menu, from which you can select the file you want to appear in each editor. Just takes a second or two...

Hope this helps!

rattletrap99
  • 1,469
  • 2
  • 17
  • 36
0

As far as I know you cannot close the Standard (main) editor.


You can

Swap the files between the two editors

but you need a few steps to accomplish that. There's no button or single shortcut to accomplish that (or at least none that I am aware of).

This is how you do it (A = Standard Editor, B = Assistant Editor – or vice versa!):

  1. Load the file from A in B.
    ,

  2. Go one step back in the history of B, but open that file in A.
    ^

You'll need to change the focus between step 1 and 2 by either clicking on the other editor or using another shortcut.

Here's the answer to a similar question that explains it and provides more information for the case when you have multiple assistant editors open.

Mischa
  • 15,816
  • 8
  • 59
  • 117
  • Thanks for your reply. It suggests that there is no - simple - way of taking a file from the Assistant Editor and placing it in the Standard Editor, or of making it the only file visible for editing. I have opened a bug report to put this forward as a suggestion: https://bugreport.apple.com/web/?problemID=32671704 . – Vince O'Sullivan Jun 09 '17 at 10:52
  • While I concur that the ability to close the main editor when an assistant editor is open might be a nice feature, I don't think this is a bug rather than a conscious design decision. However, I don't see the point of swapping the contents of the two editors? How would you benefit from that? – Mischa Jun 09 '17 at 11:02
  • 1). Apple's bug reporting facility is also for making feature requests. That is what I have done. 2). The ability to swap is a minor thing. Personally, I prefer to have the Storyboard on the right when working with that and the UIViewController file open. – Vince O'Sullivan Jun 09 '17 at 20:53