heikomania
heikomania

Reputation: 455

SwiftUI Inspector gone in Project

In one of my Xcode projects, the SwiftUI Inspector won't show anymore.

Example: enter image description here

When I create a new project, I have the inspector:

enter image description here

Any idea what is causing this? Can I maybe reset the settings of the project?

Upvotes: 6

Views: 3690

Answers (4)

Q Z
Q Z

Reputation: 121

As of Xcode 15.0.1, this is what I found makes the SwiftUI Inspector work. You no longer use Command-Click to select the Canvas element and then open the SwiftUI Inspector. It's unfortunate that the "Introducing SwiftUI" tutorial hasn't updated the instructions yet.

  1. Open the Canvas panel. Editor > Canvas or option + command + return
  2. Switch to the Selectable mode by clicking on the cursor button, which is the second button from the left in the bottom-left toolbox of Canvas.
  3. Open the Inspector panel. View > Inspectors > Show Inspector or option + command + 0.
  4. Now if you click on a view on the Canvas, the Inspector will display relevant information for the selected view. If you want to edit the attributes of the view, switch to the Attributes panel (rightmost tab in Inspector view).

Below is a screenshot of what the Canvas & Inspector half of the Xcode window could look like: enter image description here

Note that, in the source editor, you can still select a snippet of SwiftUI code and right-click on it to reveal the "Show SwiftUI Inspector" option (as well as other helpful options) in the context menu.

Upvotes: 0

CodeOverRide
CodeOverRide

Reputation: 4471

Just ran into this issue where I couldn't see Show SwiftUI Inspector on Xcode 14.2. Turned out that there are couple things you need to do.

  1. Have turn on Canvas if it's not already on. Go to Editor -> Canvas

enter image description here

  1. In Content View, change it to Selectable

enter image description here

  1. CMD + Click on an element. Now you should see Show Swift UI Inspector...

enter image description here

Upvotes: 0

Asperi
Asperi

Reputation: 257711

You must have Canvas opened to have SwiftUI context menu items in Editor (including SwfitUI Inspector)

Activating canvas

Upvotes: 14

Messy04
Messy04

Reputation: 57

XCode 12 Update

Even after enabling the Canvas if the inspect option is not showing up because, Its been renamed to Show SwiftUI Inspector

Canvas https://i.sstatic.net/BmpVW.png

Editor https://i.sstatic.net/D74Ml.png

Upvotes: 2

Related Questions