Vasu
Vasu

Reputation: 896

Xcode opens xib File as regular text file

I have a Xcode project with .xib file. When I try to open them Xcode shows the plain text of these file, it does not show the Interface Builder Interface.

How can I make Xcode to show me what I want?

I have already cleaned the project and restarted my computer. Didn't help.

Screenshot of Xcode showing xib file as plain text

Please help me this.

Upvotes: 17

Views: 6588

Answers (2)

rob mayoff
rob mayoff

Reputation: 385600

Xcode 13, Xcode 14 (and maybe 11 and 12?)

The problem is that you are in ‘Code Review’ mode. Xcode has a button to toggle Code Review mode in the top right corner of the editor pane. It is an arrow pointing rightward above and arrow pointing leftward:

top right corner of Xcode window with the Code Review button in its "on" state

You can click the button to turn Code Review off:

top right corner of Xcode window with the Code Review button in its "off" state

You can also disable Code Review using the View > Hide Code Review menu item, which has the default shortcut ⌥⇧⌘⏎ (option shift command return).

Xcode 9 and Earlier

The problem is that you have the version editor selected.

Xcode 6: version editor selected … Xcode 9: version editor selected

The version editor can only display source code. It can't display a xib graphically. You need to switch to the standard editor. Here are three ways to switch to the standard editor:

  • Press Command-Return.

  • Go to the menu bar and choose View > Standard Editor > Show Standard Editor.

  • Click the leftmost button in the “Editor” segmented control in the toolbar:

Xcode 6: standard editor selected … Xcode 9: enter image description here

Upvotes: 38

Phil Ringsmuth
Phil Ringsmuth

Reputation: 2037

On the .xib file in the list of files, you can right-click and select Open As... and choose Source Code or Interface Builder.

Upvotes: 4

Related Questions