To run Swift from VS Code on an iPhone, you need a Mac with Xcode installed and one free VS Code extension, KXApp. Open your Xcode project and Swift code completion works right away. Press Cmd+R to build and run on a simulator or iPhone, and inspect variables when a breakpoint hits. This guide walks through the whole flow in order: installing the extension, opening the project, writing code, running and debugging on a simulator and an iPhone, and finally editing Info.plist and the app icon in VS Code. Current as of October 2026, for Xcode 16 and later.
Before you start: Xcode is installed on the Mac and has been opened once (so its components are installed), and xcode-select -p in Terminal prints a path inside Xcode.app. If the extension isn’t installed yet, follow the install page.
Step 1: Which extension do you need to write Swift in VS Code?
Open the Extensions view (Cmd+Shift+X), search for kxapp and install KXApp. In Cursor, search and install it the same way from the Extensions view (it comes from Open VSX).
Step 2: How do you open an Xcode project?
Use File › Open Folder… and pick the folder that contains your .xcodeproj or .xcworkspace. Once the project is detected:
- The Xcode Project view appears in the activity bar, listing schemes, build configurations, the run destination, devices and simulators.
- The status bar shows the scheme, the run destination and a build button.
CocoaPods projects open the .xcworkspace automatically. Nothing gets converted, and teammates who open the same project in Xcode aren’t affected.
Step 3: Does Swift in VS Code get code completion?
Yes. Open any .swift file and type . to see the completion list. Press F12 to go to a definition, hover for docs, and errors are underlined as you type. SwiftUI and Objective-C work the same way.
The first time you open a project, the extension runs one build in the background. Completion for third-party libraries such as Swift packages and CocoaPods appears once that build finishes, usually within a few seconds to a couple of minutes. After that, completion follows the current scheme and run destination, matching what you get in Xcode. If completion doesn’t show up, see the code completion guide.
Step 4: How do you build and run Swift from VS Code on the simulator?
- Click the scheme in the status bar and pick the app to run.
- Click the run destination and pick a simulator (it boots automatically if it isn’t running).
- Press Cmd+R. The extension builds, installs and launches the app, then attaches the debugger.
Compile errors go to the Problems panel; click one to jump to the line. The app’s print output shows up in Output › kxapp Console.
Step 5: How do you run Swift code on a real iPhone?
Connect the iPhone with a cable, select it as the run destination and press Cmd+R. The first time you use a particular phone, do the following, exactly as you would with Xcode:
| What to do | Where |
|---|---|
| Unlock the phone and tap Trust This Computer | Prompt on the iPhone |
| Turn on Developer Mode (iOS 16 and later) and restart when asked | iPhone Settings › Privacy & Security › Developer Mode |
| Sign in with your Apple ID and use automatic signing | Xcode › Settings… › Accounts; pick a Team under the target’s Signing & Capabilities |
| Let Xcode prepare the device once | Connect the phone once in Xcode’s Window › Devices and Simulators |
After that, every time you change code and press Cmd+R, the new build is installed and launched on the phone (if a debug session is still running, press Cmd+. to stop it first). For more on running on a device, see run an iOS app on your iPhone.
Step 6: How do you debug Swift with breakpoints in VS Code?
Click to the left of a line number to set a breakpoint, then press Cmd+R. When it hits, the Run and Debug view shows variables, the call stack and threads; type po self in the Debug Console to print an object. Conditional breakpoints and logpoints (print a line without stopping) work too; see debug Swift code for details. Press Cmd+. to stop.

Step 7: How do you edit Info.plist, the app icon and localization?
Files you’d normally go back to Xcode for open as visual editors in VS Code:
Info.plist,.entitlementsand privacy manifests: keys and types shown the way Xcode shows them, with rows you can add and remove.Assets.xcassets: right-click AppIcon and fill every size from a single 1024×1024 image..xcstrings: edit translations in one column per language, plurals included.- Project settings: General and Build Settings, with the value at every level.

See the visual editors guide for details, edit Info.plist for permission keys and app icon sizes for icons. Interface Builder, Instruments and archiving for upload still happen in Xcode. It’s the same project, so you can switch at any time and keep writing Swift in VS Code, running and debugging for everything else.
FAQ
Do I still need Xcode to write Swift in VS Code?
Yes. The extension builds, signs and debugs with the Xcode installed on your Mac, which is why the results match Xcode. Once it’s set up, day-to-day coding, running and debugging can all happen in VS Code alone.
Can I use VS Code on Windows to write Swift and run it on an iPhone?
No, the extension is Mac-only. It relies on the Mac’s Xcode to build, sign and install the app.
Is KXApp free?
Yes. It’s free, needs no account, and every feature works out of the box.
Does it work in Cursor?
Yes. In Cursor, Windsurf or VSCodium, search for kxapp in the Extensions view and install it; everything works the same way.
Why does nothing happen when I press Cmd+R?
Cmd+R only works when the editor has focus, an Xcode project is open and no debug session is running. Click in the code editor first; if you’re debugging, press Cmd+. to stop, then Cmd+R. You can also click Build & Run in the Xcode Project view’s title bar (the wrench icon in the status bar is Build, which compiles without running).