Skip to main content
On this page

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.

The four places the KXBuild extension appears in VS Code
No.LocationWhat it does
①Activity Bar iconOpens the KXBuild view
②View title barBuild & Run, Run, Build and Refresh Devices. The "···" menu on the right has more commands.
③View nodesDevice, build configuration, projects and targets. Click to switch or act on them.
④Status BarCurrent project type, device and configuration. Click to switch devices.

What does each node in the VS Code iOS sidebar do?

NodeShowsClick to
DeviceThe 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 configurationDebug or ReleaseSwitch the build configuration
ProjectEvery .xcworkspace / .xcodeproj in the open folder. With several projects, the startup project has a star.Expand it, or make it the startup project
TargetEvery target in the project, with its type after the name: app, test, extension, framework, library or bundleBuild the target with the inline button. Runnable targets also have Build & Run and Run.
Asset catalogThe .xcassets in the project folderOpen the Asset Catalog Editor

If targets don't load, run doctor once.

Which commands are in the sidebar title bar and context menus?

LocationCommands
Title bar buttonsBuild & Run · Run · Build · Refresh Devices
Title bar "···" menuNew Project · Doctor (fix environment) · Select Build Configuration · Attach to Running App · Select Startup Project · Select Toolchain · Install Toolchain
Right-click a project nodeEdit Project Settings
Right-click a target nodeEdit Target Settings
Right-click a .xcodeproj / .xcworkspace in the ExplorerBuild & 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.

WhatWhere
App output from print, NSLog and os_logOutput panel > KXBuild Console
Build logOutput panel > KXBuild
Compiler errors and warningsProblems 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