新Xcode项目中Main.storyboard文件未显示,寻求技术解决方案
Hey there! Let’s figure out why your new Xcode project isn’t showing the Main.storyboard file—this is super common with newer Xcode versions, so you’re not alone.
Why Main.storyboard Is Missing
Newer Xcode templates (14+) prioritize code-based or SwiftUI setups by default, which skip storyboards entirely:
- If you picked the iOS App template and chose SwiftUI as your interface, Xcode uses
ContentView.swiftas the starting point instead of a storyboard. - For UIKit projects, the default setup now uses programmatic window/scene configuration (via
ViewController.swiftand scene delegates) instead of relying on storyboards.
How to Get Main.storyboard Back
You’ve got a few options depending on whether you want to fix your existing project or start fresh:
Option 1: Add a Storyboard to Your Existing Project
If you want to keep your current project and add Main.storyboard manually:
- Right-click your project folder in the Project Navigator → New File.
- Under the iOS section, select User Interface → Storyboard, then click Next.
- Name the file
Main, double-check it’s added to your project target, and click Create. - Now set it as your app’s main interface:
- Select the top-most project item in the Project Navigator (your project name).
- Switch to the Info tab.
- Scroll down to Application Scene Manifest → Scene Configuration → Application Session Role → Item 0 (Default Configuration).
- Replace the value for Storyboard Name with
Main. - If you’re working with an older project (pre-iOS 13) without scene configuration, look for Main storyboard file base name under Custom iOS Target Properties and set it to
Main.
Option 2: Create a New Project with Storyboards
If you’d rather start over with a storyboard-based setup:
- When creating a new project, select the iOS App template.
- On the configuration screen, set Interface to Storyboard (instead of SwiftUI).
- Fill in the rest of your project details and click Create—you’ll see
Main.storyboardin the Project Navigator immediately.
Option 3: Check if It’s Hidden (Less Common)
Sometimes files get filtered out or misplaced:
- Click the magnifying glass icon (Filter button) in the top-right of the Project Navigator.
- Make sure "All" is selected, or search directly for
Main.storyboardto see if it pops up. - Double-check all folders in your project navigator—maybe the file was accidentally added to a different group.
内容的提问来源于stack exchange,提问作者Siddhant Angore
相关产品推荐
相关产品推荐

