Do You Vibe Code?
I have to admit that, up until recently, I didn’t fully understand what the term Vibe Coding actually meant. By definition, vibe coding is a programming approach that uses AI, specifically large language models (LLMs), to generate software code based on natural language prompts.
Instead of manually writing code, programmers describe what they want to achieve, and the LLM generates the code. This shifts the focus to guiding, testing, and refining the AI-generated output.
Have You Tried This?
There are lots of options for vibe coding when using Xcode. Apple has hinted at this direction but has yet to deliver a full solution. In the meantime, if you’re creating iOS apps, you can use tools like Cursor AI, the GitHub Copilot extension for Xcode, or Alex Sidebar, all right within Xcode. I’ve personally been using ChatGPT for macOS.
That’s right. ChatGPT for macOS has been updated with tight integration into Xcode. Without modifying anything in Xcode itself, you can easily invoke ChatGPT with your current file or selected lines as context for your prompt. This works either directly within the ChatGPT app or via the ChatBar, which I prefer since I’ve set up a keyboard shortcut for quick access.
If you have Xcode running and invoke the ChatBar, once you’ve enabled Xcode by tapping the button shown here, it will recognize your current view:
You can ask ChatGPT anything:
It will churn away. You can choose to have it automatically apply the changes to your code, or just show a diff that you can review and apply manually:
I’m not a huge user of vibe coding, but I do like using it to generate suggestions, whether to improve existing code, create mock data, or provide quick examples I can use in my videos.
It’s far from perfect. You’ll get the best results by pointing out mistakes and asking it to refine its output.
If you have code that just isn’t working, let ChatGPT take a crack at figuring out the problem.
I like having the option, but I hesitate to recommend relying on it to build your app. Nothing beats experience. The more you know, and the more specific your prompts are, the better the results you’ll get.
For the SF Symbol Browser app I’m developing, I knew exactly what I wanted to accomplish for the Mac menu bar app portion, but I had no idea how to do it. I had always used MenuBarExtra
in SwiftUI, but it didn’t give me what I needed, so I had to turn to using an AppDelegate
.
I had no idea what I was doing, so I created a very simple sample project and asked ChatGPT to iterate with me on what I wanted to achieve. By working incrementally outside of my main project, I was able to have a productive back-and-forth with ChatGPT until I had a working solution. It wasn’t immediate. ChatGPT gave me lots of bad or broken code, but I persisted and eventually got there. After that, it was easy to integrate the working code into my main project.
As an aside, I really dislike Xcode’s predictive code completion and have turned it off. I’m comfortable enough with my coding skills that I don’t need Xcode second-guessing me, and I found it was just slowing me down.
How About You?
I’d love to hear your thoughts and experiences with vibe coding. Are you using any AI tools in your Xcode workflow?