Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SwiftUI PreviewsNew to Visual Studio Code? Get it now.
SwiftUI Previews

SwiftUI Previews

Kenan Mamedoff

|
19 installs
| (0) | Free
Render SwiftUI previews in VS Code with Apple's Xcode 27 headless MCP server.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SwiftUI Previews

Render SwiftUI previews in Visual Studio Code through Apple’s Xcode 27 headless MCP server.

Requirements

  • macOS with Xcode 27 or newer
  • Visual Studio Code 1.100 or newer
  • A Swift file included in an .xcworkspace or .xcodeproj

Xcode renders previews in the project’s build context, including its scheme, destination, dependencies, resources, and compiler settings. Standalone .swift files are therefore not supported.

Setup

  1. Open the folder containing your Swift source and Xcode project.
  2. Run SwiftUI Previews: Select Xcode Installation.
  3. Run SwiftUI Previews: Set Up and follow any instructions shown in Output.
  4. Open a saved Swift file and run SwiftUI Previews: Open Preview.

Features

  • Tabs for multiple #Preview declarations
  • Xcode preview variants, localization, preview arguments, timelines, and canvas toggles
  • Scheme, run destination, project, and Xcode selection
  • Refresh on save, pinning, configurable toolbar position, zoom, and PNG export
  • Open an interactive preview in Xcode or run the app in Simulator

Limitations

  • Previews are not interactive inside Visual Studio Code. Apple’s headless RenderPreview API returns a rendered image rather than a live view or event session. Use Open Live Preview in Xcode to interact with the preview, or Run App in Simulator to interact with the complete app.
  • Standalone Swift files cannot be rendered because Xcode needs a project or workspace build context.
  • Preview controls are limited to the variants, arguments, timelines, and canvas toggles that Xcode exposes for the selected preview.

Author

Kenan Mamedoff

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft