VS Code iOS Sidebar: Switch Devices, Configurations and Projects
Where the extension lives in VS Code. What each KXBuild view node, title bar button, context menu item and Status Bar item does, where to pick your iPhone once it's connected, and which panel shows app output and build logs.
Last updated
The VS Code iOS sidebar is the KXBuild view in the Activity Bar. Open it to switch devices, pick Debug or Release, change the startup project, and build and run your app from the title bar buttons. The extension shows up in 4 places in VS Code: the Activity Bar icon, the view title bar, the view nodes and the Status Bar. App output from print and NSLog and the build log go to two channels in the Output panel, as described below.
| No. | Location | What it does |
|---|---|---|
| ① | Activity Bar icon | Opens the KXBuild view |
| ② | View title bar | Build & Run, Run, Build and Refresh Devices. The "···" menu on the right has more commands. |
| ③ | View nodes | Device, build configuration, projects and targets. Click to switch or act on them. |
| ④ | Status Bar | Current project type, device and configuration. Click to switch devices. |
What does each node in the VS Code iOS sidebar do?
| Node | Shows | Click to |
|---|---|---|
| Device | The current device name, connection and iOS version, for example USB · iOS 17.5. Shows "click to set up" when the device driver is missing. | Switch devices, or install the driver |
| Build configuration | Debug or Release | Switch the build configuration |
| Project | Every .xcworkspace / .xcodeproj in the open folder. With several projects, the startup project has a star. | Expand it, or make it the startup project |
| Target | Every target in the project, with its type after the name: app, test, extension, framework, library or bundle | Build the target with the inline button. Runnable targets also have Build & Run and Run. |
| Asset catalog | The .xcassets in the project folder | Open the Asset Catalog Editor |
If targets don't load, run doctor once.
Which commands are in the sidebar title bar and context menus?
| Location | Commands |
|---|---|
| Title bar buttons | Build & Run · Run · Build · Refresh Devices |
| Title bar "···" menu | New Project · Doctor (fix environment) · Select Build Configuration · Attach to Running App · Select Startup Project · Select Toolchain · Install Toolchain |
| Right-click a project node | Edit Project Settings |
| Right-click a target node | Edit Target Settings |
| Right-click a .xcodeproj / .xcworkspace in the Explorer | Build & Run · Build · Mark as Startup Project · Generate compile_commands.json · Project Settings… |
In the Command Palette all of these start with KXBuild:, so press Ctrl+Shift+P and type KXBuild to find them.
What does the Status Bar show, and how do I switch devices with it?
The bottom-right corner shows project type · device name · Debug. A spinner appears while KXBuild is busy, and hovering shows the current state. Click it to switch devices. To switch the configuration, use the build configuration node in the view.
Where do I pick my iPhone and read app logs?
Plug in your iPhone with a cable and it shows up right away in the device node and the Status Bar. No refresh is needed when you plug or unplug. With several devices connected, click the device node or the Status Bar to pick one. F5 and Build & Run both install to that device. If the device node says "click to set up", the device driver isn't installed yet. Click it and follow the prompts. See connect an iPhone to Windows for debugging.
| What | Where |
|---|---|
| App output from print, NSLog and os_log | Output panel > KXBuild Console |
| Build log | Output panel > KXBuild |
| Compiler errors and warnings | Problems panel. Click one to jump to the source. |
Open the Output panel with Ctrl+Shift+U and use the drop-down in its top-right corner to switch between KXBuild and KXBuild Console. When a build or run fails, the notification has a Show Output button that takes you straight to the log.
With several projects in one window, which one does F5 run?
When a window holds several projects, F5, the title bar buttons and the Status Bar all act on the startup project. Click a project node to switch, or right-click a .xcodeproj in the Explorer and choose Mark as Startup Project. To build one library or extension on its own, click the button on its target row. You don't need to switch the startup project.
Once the device, build configuration and startup project are set, the VS Code iOS sidebar is ready. Press F5 or click Build & Run in the title bar to start debugging; for breakpoints and launch modes, see debug iOS apps on iPhone in VS Code.
Next steps
Run and debug
Three ways to start (Build & Run, Run and Attach), what you see if a step fails after F5, panels and output during a debug session, launch.json fields and Dart debugging for Flutter.
Commands and settings
Every KXBuild command in the Command Palette, grouped by purpose and showing where else you can find it. Every setting with its default and effect, the launch and attach fields of the kxbuild debugger, and the four output channels.