XCode 13:Storyboard编辑时卡顿严重问题求助
Hey Adam, I feel your pain—Storyboard lag can turn a smooth workflow into a nightmare, especially when you can’t use the usual "delete xcuserdata" fix because of source control and server builds. Let’s go through some targeted fixes that won’t mess with your repo setup:
1. Kill Live Rendering & Previews
Xcode’s real-time rendering is a resource hog, especially for complex Storyboards. Try these quick toggles:
- Open your laggy Storyboard, head to the Editor menu at the top
- Uncheck Automatically Refresh Views (this stops Xcode from re-rendering every tiny change)
- Disable Preview mode (if it’s enabled) via the same Editor menu
- For individual views: Select a custom view, open the Attributes Inspector, and uncheck Live Rendering under the View section—this stops Xcode from trying to render custom logic in the editor
2. Trim Storyboard Bloat (Beyond Splitting)
Splitting into separate Storyboards helps, but even single files can have hidden bloat:
- Use the Document Outline (toggle via the top-right icon in the Storyboard editor) to hunt down unused views, constraints, or hidden elements—delete anything you don’t need
- Replace heavy custom views with placeholder
UIViews in the Storyboard, then load the actual custom view programmatically at runtime. This cuts down on what Xcode has to render in the editor. - Clean up constraint chaos: Use the Resolve Auto Layout Issues tool (bottom-right of the editor) to fix conflicts or redundant constraints—too many nested or conflicting ones force Xcode to waste time recalculating layouts
3. Clear Cached Data & Tweak Xcode Settings
Corrupted cached data is a common culprit, and this won’t touch your source control:
- Go to Xcode > Settings > Locations > Derived Data and click Delete—this clears old build artifacts and cached Storyboard render data
- In Xcode > Settings > General, uncheck Show live issues temporarily. Real-time issue checking can drag down editor performance for large files.
- Launch Xcode in Safe Mode: Quit Xcode, then hold the Shift key while reopening it. This disables third-party plugins that might be conflicting with Storyboard rendering.
4. Optimize Assets in the Storyboard
Heavy or unoptimized images can slow down the editor:
- Replace any raw image files dragged directly into the Storyboard with references from your asset catalog. Xcode handles cached assets better from the catalog.
- Compress your images: Use tools to shrink PNG/JPG sizes (without losing quality) or switch to WebP for smaller file sizes—large images force the GPU to work overtime rendering previews.
5. Check Custom Views & Third-Party Frameworks
Sometimes the issue is in your code, not the Storyboard itself:
- Temporarily swap custom view classes in the Storyboard with standard
UIViews. If the lag disappears, your custom view has inefficient code (like heavydrawRectcalls or unoptimized layout logic). - Update any third-party frameworks you’re using—older versions might have compatibility bugs with your Xcode/MacOS version that cause rendering lag.
Hopefully one of these fixes gets your Storyboard back to being responsive. Let me know if you need more details on any step!
内容的提问来源于stack exchange,提问作者Adam A.

