Live SwiftUI preview for VS Code on any platform. No Mac, no Xcode, no simulators required.
Preview your SwiftUI code instantly with automatic updates as you type. Built with tree-sitter parser and HTML/CSS renderer.
π¨ 42 SwiftUI Views - VStack, HStack, NavigationView, TabView, AsyncImage, and more
π§ 71+ Modifiers - Layout, navigation, colors, effects, typography, accessibility
π± Device Mockups - iPhone, iPad, desktop with Dynamic Island
π Live Updates - See changes instantly with 300ms debounce
π Visual Effects - Glass materials, gradients, shadows, blur, animations
π§ Navigation - Full NavigationView, NavigationStack, NavigationLink support
π Tab Interfaces - Interactive TabView with badges
π Remote Content - AsyncImage for loading images from URLs
π¦ State Visualization - @State, @Binding, and property wrapper badges
πΈ PNG Export - One-click snapshot export for documentation and sharing
βΏ Accessibility - Screen reader attributes and labels
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "SwiftUI CrossPreview"
- Click Install
Or install from: VS Code Marketplace
- Open any Swift file with SwiftUI code
- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Run:
SwiftUI CrossPreview: Open Preview - Your SwiftUI code renders instantly in a side panel
- Edit your code and watch the preview update live!
TabView {
NavigationView {
List {
NavigationLink("Profile") {
ProfileView()
}
}
.navigationTitle("Home")
}
.tabItem { Label("Home", systemImage: "house") }
.badge(3)
}VStack {
Text("Glass Card")
.font(.largeTitle)
.foregroundColor(.white)
}
.padding(32)
.background(.ultraThinMaterial)
.cornerRadius(20)
.shadow(radius: 12)Form {
TextField("Name", text: "John Doe")
Slider(value: 0.5)
DatePicker("Date", selection: Date())
ColorPicker("Color", selection: .blue)
Toggle("Enabled", isOn: true)
}AsyncImage(url: URL(string: "https://..."))
.frame(width: 200, height: 200)
.clipShape(Circle())Layouts
- VStack, HStack, ZStack, LazyVStack, LazyHStack
- Grid, Group, GeometryReader
Navigation & App Structure β NEW in v1.3.0
- NavigationView, NavigationStack, NavigationLink, NavigationSplitView
- TabView with interactive tab switching
Content β v1.3.0 Enhanced
- Text, Image, Spacer
- AsyncImage (remote images)
- TextEditor (multi-line input)
- DisclosureGroup (expandable sections)
Lists & Forms
- List, Form, Section, ScrollView, ForEach
Input Controls
- Button, Toggle, Picker
- TextField, SecureField, TextEditor
- Slider, Stepper, DatePicker, ColorPicker
Shapes
- Rectangle, Circle, RoundedRectangle, Capsule, Ellipse
Graphics
- LinearGradient, RadialGradient
UI Elements
- Divider, Label, ProgressView, Link, Menu
Layout & Positioning
.padding(),.frame(),.offset(),.position().aspectRatio(),.scaledToFit(),.scaledToFill().clipped(),.clipShape(),.mask()
Navigation β NEW in v1.3.0
.navigationTitle(),.navigationBarTitleDisplayMode().toolbar(),.toolbarBackground().navigationBarBackButtonHidden(),.searchable()
Tabs β NEW in v1.3.0
.tabItem(),.badge()
Colors & Styling
.foregroundColor(),.foregroundStyle(),.background(),.tint().opacity(),.brightness(),.contrast(),.saturation(),.hueRotation()
Glass Materials
.background(.ultraThinMaterial),.background(.thinMaterial),.background(.regularMaterial)
Typography
.font(),.bold(),.italic(),.underline(),.strikethrough().fontWeight(),.kerning(),.tracking(),.baselineOffset().multilineTextAlignment(),.lineLimit()
Visual Effects
.cornerRadius(),.shadow(),.blur(),.border()
Shapes
.fill(),.stroke()
Transforms
.rotationEffect(),.scaleEffect(),.offset()
Animation
.animation(),.transition()
Interaction
.onTapGesture(),.onLongPressGesture(),.disabled()
Additional β NEW in v1.3.0
.id(),.refreshable(),.swipeActions(),.contextMenu().sheet(),.fullScreenCover(),.alert()
Lifecycle
.onAppear(),.onDisappear()
Accessibility
.accessibilityLabel(),.accessibilityHint(),.accessibilityValue()
Layering
.overlay()
- π± Phone - iPhone 15 Pro mockup with Dynamic Island (390Γ844)
- π± Tablet - iPad Pro (1024Γ1366)
- π» Desktop - Large display (1440Γ900)
- βοΈ Custom - Set your own width Γ height
red, blue, green, yellow, purple, pink, orange, mint, teal, cyan, indigo, brown, white, gray, black
largeTitle, title, title2, title3, headline, body, callout, subheadline, footnote, caption, caption2
β
No Mac Required - Preview SwiftUI on Windows, Linux, or macOS
β
No Xcode - Work entirely in VS Code
β
No Simulators - Instant rendering without heavy iOS simulators
β
Fast Iteration - See changes in 300ms
β
Accurate Rendering - Faithful to SwiftUI's visual appearance
β
Complete Apps - Preview navigation, tabs, forms, and more
β
Open Source - MIT license, community-driven
Perfect for developers learning SwiftUI who don't have access to a Mac or Xcode.
Build SwiftUI interfaces on Windows or Linux before testing on actual devices.
Rapidly iterate on UI designs without waiting for Xcode builds or simulator launches.
Create SwiftUI code examples and see them rendered inline.
Demonstrate SwiftUI concepts with instant visual feedback.
Swift Code β Tree-Sitter Parser β ViewNode Tree β HTML/CSS Renderer β VS Code Webview
- Parser - Uses tree-sitter-swift for robust AST parsing with detailed error messages
- ViewNode Tree - Converts AST to internal representation of SwiftUI view hierarchy
- Renderer - Generates HTML/CSS that closely matches SwiftUI's visual appearance
- Webview - Displays in VS Code with live updates as you type
Key Technologies:
- tree-sitter - Incremental parsing
- tree-sitter-swift - Swift grammar
- TypeScript - Extension logic
- HTML/CSS - Visual rendering
Auto-updates preview 300ms after you stop typing. No need to save or rebuild.
One-click export to high-resolution PNG (2x scale for crisp images). Perfect for documentation, design reviews, and sharing previews with your team. Click the "πΈ Export PNG" button in the header.
Shows clear error messages when Swift code cannot be parsed, with line numbers and suggestions.
Smart zoom-to-fit ensures your preview always fits the available space.
Properly handles // single-line comments in SwiftUI code.
Supports nested stacks, ForEach loops, List/Form structures, and conditional rendering.
- β¨ NavigationView, NavigationStack, NavigationLink, NavigationSplitView
- β¨ TabView with interactive tab switching and badges
- β¨ AsyncImage for remote image loading
- β¨ TextEditor for multi-line text input
- β¨ DisclosureGroup for expandable content
- β¨ State visualization (@State, @Binding, @StateObject badges)
- β¨ PNG Export (2x high-resolution snapshots)
- β¨ 14 new modifiers (navigationTitle, tabItem, badge, searchable, and more)
- π Now supports 42 views and 71+ modifiers
- Added Slider, Stepper, DatePicker, ColorPicker, ProgressView, Menu
- Lazy layouts (LazyVStack, LazyHStack, Grid)
- Color adjustments (brightness, contrast, saturation, hueRotation)
- Advanced layout modifiers
- Shape views (Rectangle, Circle, RoundedRectangle, Capsule, Ellipse)
- LinearGradient and RadialGradient
- Text styling modifiers
- Animation indicators
We welcome contributions! Here's how you can help:
Report Bugs: GitHub Issues
Request Features: Open an issue with the enhancement label
Submit PRs: Fork, code, test, and submit pull requests
Areas for Contribution:
- Adding more SwiftUI views and modifiers
- Improving parsing accuracy
- Enhancing visual rendering
- Documentation and examples
- Performance optimizations
- CHANGELOG.md - Release history
- DEVELOPMENT.md - Development guide
- FEATURES_v1.3.0.md - Latest features
- RELEASE_v1.3.0.md - v1.3.0 release notes
This is a preview tool, not a SwiftUI runtime. Some limitations:
- No actual code execution (SwiftUI logic doesn't run)
- Property wrappers shown visually but don't execute (@State, @Binding visualized only)
- Navigation doesn't actually navigate (shows structure only)
- Button actions don't execute
- Animations show indicators but don't animate
- Some advanced SwiftUI features not yet supported
Best for: Visual preview, layout exploration, learning, prototyping, documentation (with PNG export)
Not for: Debugging logic, testing interactivity, performance profiling
Upcoming Features:
- State visualization (@State, @Binding badges) β¨ NEW in v1.3.0
- Swift Charts support
- MapKit basic support
- Custom shapes and Canvas
- Matched geometry effects
- Environment values display
- Improved animation previews
Long-term Goals:
- Interactive component library
- Export to Figma/Sketch
- Collaborative preview sharing
- Theme customization
MIT License - See LICENSE file for details
- tree-sitter - Parsing library
- tree-sitter-swift - Swift grammar
- Apple SwiftUI - Design inspiration
- VS Code Extension API - Platform
Questions? Open a GitHub Discussion
Bugs? Report an Issue
Feature Ideas? Share in Discussions
Made with β€οΈ for the SwiftUI community
β Star us on GitHub if you find this useful!