Somehow my Xcode settings got messed up as it would only show my Main.storyboard file as XML code. I've been told this can be fixed by selecting the Interface Builder from the "Open As" menu, but there is nothing under the menu (the only "selection" is a greyed-out "<None>"). I've cleared my Xcode caches, but this does not help. Other than that, my project still compiles properly.
How can this be resolved?
You have SwiftUI enabled in your project, which does not use storyboards anymore. Your layout is inside the ContentView. swift file. If you do want to work the old way, with storyboards, you should uncheck 'Use SwiftUI' in the project creation screen.
Select the SingleViewApplication when the templates are presented. Now let's add a button to the app – select the Main. storyboard from the Project Navigator (on the left side of Xcode). Once the Storyboard loads in the center pane, use the Object library to add a button to the storyboard.
I know that I need to open Storyboard as source code using right clicking on the file and using menu Open as... . Then I can open Storyboard as xml file. My problem is sometimes the source is opened as text - there are no colour differences on the comments for example.
Those exact steps (I am using XCode 4.5 and iOS 6.0 ): Add new storyboard to the project by File->New->File... ->Userinterface->storyboard. Go to project summary and select MainStoryboard and select the storyboard name you just created.
As so many people have pointed out, right-click on the file and hover over Open As
and select Default - Interface Builder
.
However, if this is not an option for you because Open As
shows <None>
, make sure you are in the standard editor and not the version editor. Go up to View in Xcode menu --> view --> hover over Standard Editor and select Show Standard Editor. Now repeat the steps others have suggested and you should get the results you're looking for.
change to Standard Editor by clicking 'Command + Enter' key . Then Main.storyboard may show as Interface Builder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With