Header logo.
small hallucinations
homeyearstagsaboutrss

A lightweight Swift workflow with Zed

I played with Swift over the weekend, and Xcode felt sluggish from time to time on my machine. I also had to ask Codex for help quite often just to navigate Xcode's UI.

When I tried coding with Zed, it failed to recognize structs, variables, and the like defined in other files in the project.

Quick googling led me to a very helpful blog post, “How I Got Zed Editor Working with Swift Projects,” and this GitHub repository: xcode-build-server.

Following the instructions in the blog post, I installed xcode-build-server, generated a buildServer.json file, and configured Zed accordingly.

Zed could now recognize the project's symbols.

I wanted to use the simulator without opening Xcode. After some back and forth, I got hot reload working too. This is what I did:

  • Navigate to the project directory and run open -a Simulator.
  • Run xcodebuild to build the codebase as an .app bundle.
  • Run xcrun to install and launch the built bundle in the simulator.

I've shared the Bash script I'm using in a GitHub Gist. Update values such as the project name, scheme, and directories, then install fswatch to watch for file changes. Now you can run this command and have fun:

open -a Simulator && dev.sh