8 ways I used ChatGPT to help me build my first SwiftUI app

Nate Chan
4 min readMar 16, 2023

--

I built my first SwiftUI app in only one week, using ChatGPT to teach me SwiftUI concepts, write code for me, solve problems quickly, and ultimately launch a fully working app in SwiftUI to the App Store.

Without ChatGPT, it would’ve easily taken me 2–3x longer and a LOT of extra, tedious work. Here are 8 ways I prompted ChatGPT to level up my coding process…

My first SwiftUI app — generate custom AI stories for your kids, powered by ChatGPT (yes, very meta)!

1. Use equivalence

I asked ChatGPT how to do things in SwiftUI using context I understood well — in this case, Swift. Prompting with “what’s the equivalent of XYZ in <language>” was a quick way to help me understand concepts through a familiar language, alongside copy-paste-ready starter code.

2. Write code for me

ChatGPT acted as my ghostwriter for a ton of tasks. There was no need to search for example blog posts anymore. I just told ChatGPT what I wanted, and occasionally even pasted in my existing code for it to update — and voila, the code was written for me!

3. Error detection

When I couldn’t find a bug or was hitting a pesky error, I just pasted in my code to have ChatGPT explain what was wrong! It was remarkable at spotting issues and giving clear explainers, letting me avoid having to Google search for generic error messages. Bye bye hundreds of StackOverflow tabs!

4. Deep understanding

I treated ChatGPT like a mentor. Asking high-level questions led to detailed answers with examples to help me better understand concepts. I then asked follow-up questions when I wanted to know more — again, just as I would with a real-life mentor.

5. How-to help

When I needed help with setup or tooling, ChatGPT provided step-by-step instructions on how to do it in Xcode. It completely beat sifting through Apple documentation or looking for tutorials!

6. Hard-to-ask questions

I came across many questions that Google simply didn’t have the answer to. In this case: what was the system name for what many use as the “settings” icon (⚙️)? Somehow, ChatGPT nailed it — and even wrote out the syntax on how to use it in SwiftUI!

7. Gather summarized info

At one point I was designing a part of my UI where screen dimensions across device models were a major factor. So I asked ChatGPT to gather all that information for recent iPhone models and I magically had everything I needed, neatly summarized!

8. Format anything

This one was a trifecta. I needed:

  1. a bunch of story prompt ideas
  2. variety in their wording, in a specific format
  3. the output as an array of strings in Swift

ChatGPT saved me from having to do a ton of manual work or write a custom Python script. I just copy-and-pasted the array of strings straight into Xcode!

Before you go…

ChatGPT has been a huge productivity boost for me, both as an experienced developer but also as a developer always learning new languages and concepts. I hope this post helps with using ChatGPT to level up your coding process!

And for the parents out there, check out my new SwiftUI app for generating custom AI stories for your kids, powered by ChatGPT (yes, very meta)!

You can reach me on Twitter @nathanwchan, or leave a comment below!

--

--