Xcode interface - reset

Somehow I have lost the Canvas in the interface.

I think it’s because I have made the coding section too big and there is not enough room left.

Please can you help?

Thanks, Geoff

Hi Geoff,

The canvas will only be visible when you are editing a View and that you also have at least the basic code that makes the Preview work. ie, in the case of ContentView in a newly created project you have at least this.

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
    }
}

#Preview {
    ContentView()
}

It could be that you inadvertently presses a keyboard combination that closed the canvas.

To get it back, press the keyboard key comnbination Option + Command + Return. That key combination is a toggle.

If you remove the #Preview code the canvas will not show at all.

The solution Chris Parker gave (Command + Option + return) will bring the “Canvas” back on screen to the right of the editor/code you have for your app.

The other way to toggle the display of the Canvas is thru the “Editor” menu. Look in the Editor menu for “Canvas” (It should be the second item in the Editor choices) and choose it with your mouse pointer.

The keyboard method is faster, but knowing there is more than one way to get the same result helps you become smarter and is a safeguard if your keyboard becomes disabled.