5

I am using swiftUI to write a new app. Every-time I open a new file the Canvas opens up. I want the default view to be "Only Editor" and I can open the canvas whenever I want to manually.

Is there a way to change the default?

thenakulchawla
  • 5,024
  • 7
  • 30
  • 42

2 Answers2

0

Yes you can select "show editor only" via Xcode, this will always open the Editor, check the screenshot

Adjust Editor Option ---- show editor only

or Select any SwiftUI file then press Command + Enter(Return key) this will select the show editor only option.

enter image description here

nivritgupta
  • 1,966
  • 2
  • 20
  • 38
  • I do this everytime I open up a new file. Wanted to know if this could be the default. I don't like the Canvas all the time. – thenakulchawla May 30 '20 at 21:09
  • @thenakulchawla could be an Xcode bug but I am not facing any issue. – nivritgupta May 31 '20 at 12:04
  • 2
    I did it. Multiple times, started XCode again but the new files still open up with Canvas. Frustrating.Maybe it is an Xcode. Will see today, if I am still facing the issue, I will file a bug. – thenakulchawla May 31 '20 at 21:22
  • Same here, drives me crazy. You can uncheck "Canvas" and Hit "Show editor only", but the next time a SwiftUI View file opens, e.g. when hitting a breakpoint while debugging, the Canvas is right back there. – Steffen Funke Apr 23 '21 at 07:01
0

Just uncheck Canvas as shown below and this state will persists and for new files and after Xcode restart. (Tested with Xcode 11.4)

demo

Caution: Without Canvas opened SwiftUI contextual menu items are not available in Editor. Just be aware.

Asperi
  • 228,894
  • 20
  • 464
  • 690