Skip to main content
On this page

Build and run

Switch schemes and configurations, pick an iPhone or a simulator, read build logs, and the ways to run.

Build your iOS app in VS Code and run it on an iPhone or the simulator, with the same result as pressing Run in Xcode. What you built in VS Code doesn't need rebuilding when you switch to Xcode.

The Xcode Project view in the activity bar is where everything starts. From top to bottom:

RowWhat it does
ProjectThe current project; click to switch when the folder has several. Right-click to open project settings or create an asset catalog
SchemeThe scheme to build and run, as defined in the project (shared and user schemes)
ConfigurationDebug, Release or a custom configuration; falls back to kxapp.defaultConfiguration
Run DestinationThe selected simulator or device
Devices & SimulatorsConnected devices and local simulators (grouped by OS version); click one to make it the run destination
TargetsThe project's targets; right-click to edit target settings or set the app icon from an image

The view's title bar has Build & Run, Build, Stop and Refresh Devices; its "…" menu has Clean Build Folder and Show Build Log. The status bar also has the scheme, run destination and a build button, so you can switch without opening the side bar.

Building

Press Cmd+B or click the build button. Progress shows in the status bar, errors and warnings go to the Problems panel (click to jump to the line), and the full log is in Output › kxapp Build.

SettingDescription
kxapp.build.revealOutputShow the build log when a build starts
kxapp.build.extraArgsExtra arguments for every xcodebuild command, such as ["-quiet"]
kxapp.build.allowProvisioningUpdatesLet Xcode create or update provisioning profiles for device builds (on by default)

If a build looks wrong and you suspect stale products, use Clean Build Folder from the "…" menu, the same as Product › Clean Build Folder in Xcode.

Devices and simulators

The list refreshes within seconds when you plug in or unplug an iPhone, or click Refresh Devices. Right-click a simulator to boot or shut it down; a selected simulator is booted automatically when you run. Devices are marked when they're on Wi-Fi or have Developer Mode off.

Running on a device needs the same things as in Xcode:

  • The device is unlocked, trusts this Mac and has Developer Mode on.
  • You're signed in with your Apple ID in Xcode › Settings › Accounts, and the project's signing settings can sign for this device.
  • Xcode has prepared the device (connect it once in Xcode's Devices and Simulators window).

Running

CommandShortcutWhat it does
Build & RunCmd+RBuilds, installs, launches and attaches the debugger
Run Without Debugging—Builds, installs and launches without the debugger; app output still goes to kxapp Console
Run Without Building—Installs the last build and starts debugging
StopCmd+.Ends the debug session and, by default, the app

Cmd+B and Cmd+R apply while the editor has focus and an Xcode project is open; then Cmd+B no longer toggles the side bar. Every other command is in the Command Palette under kxapp. For debugging details see Run and debug.

Next steps