Building My Workout Tracker with GPT-4 and SwiftUI
Discover how I finally got started with building my own workout tracker with the help of GPT-4 and SwiftUI. In this blog post, we’ll take you through my “adventure”, showing you how I teamed up with GPT-4 to make a workout tracker app. If you’re a developer keen on growing your skillset or just curious about the possibilities of AI-assisted development & learning, this article’s for you.
Heres a quick demo of what I built.
Diving into GPT-4’s Potential #
ChatGPT’s release blew us away with its amazing capabilities. As a developer, I’ve been using GPT-3.5 and ChatGPT for a bunch of tasks, from crafting SQL queries to writing emails, docs, presentation text, and more. When GPT-4 came out, I saw someone on Twitter who made a movie recommendation app using GPT-4. I’ve always wanted to build my own workout tracker app but never found the time. That tweet inspired me to create my workout tracker using GPT-4 and SwiftUI.
Why I Needed a Workout Tracker #
I’ve been keeping track of my workouts using the iOS Notes app, but it has its limits. For example, filtering by exercise or tracking my progress over time isn’t easy. So, I decided to make a workout tracker app using SwiftUI, a framework I’ve been wanting to learn for sometime now. With GPT-4, I managed to create a working app in just one day, even though I had no prior experience with SwiftUI. Of course, my background in development helped, but things weren’t all smooth sailing…
First Try: Workout Tracker + GPT-4 = meh #
On my first attempt, I asked ChatGPT to generate an app based on my workout tracking needs. Surprisingly, it created a working app I could run on the iOS simulator. But it had some bugs that needed fixing. As I worked with ChatGPT to sort them out, new issues popped up. So, I changed my strategy and gave ChatGPT more info about the specific problem areas which helped clear those out.
After some back-and-forth with ChatGPT, I had built a functional app with a pretty decent user interface. I even asked ChatGPT for design improvement ideas, leading to some interesting color suggestions I implemented. But all the design changes brought new bugs. And after taking a closer look at the code, I noticed that strange bugs and suggestions from ChatGPT popped up whenever GPT changed my workout data model. So, I decided to switch up my approach and start all over again. I took a step back and focused on defining user journeys in the app, breaking it down, and creating my data models and then using that as input to ChatGPT.
Round 2: Let’s Build This Workout Tracker App #
So, I kicked things off by defining the data model and giving ChatGPT some basic info and use cases (you know, the user journeys / user flows). The app that came out of it had most of the pieces I needed, and the CRUD stuff for workouts just worked. I now had a somewhat functional app that had the core stuff down so I started adding features like a stats thingy to show the days since the last workout and workout summaries on the main page.
After a bunch of back and forth with ChatGPT and tweaking the styling a bit, I decided to hit the brakes on the app, as it already went beyond what I first had in mind. Sure, there were a few missing features, but I could tackle those in a future blog post (for example saving my workout data somewhere off the device).
Building an app with GPT-4 was a mix of fun and challenge. It took patience and a step-by-step mindset, plus being super clear about what features I wanted and how they might affect the app.
What I Learned Building an App with GPT-4 #
Working with GPT-4 to build an app is a rollercoaster – sometimes it’s a blast, other times it’s a bit of a headache. Be ready for responses that might not be spot-on and may need a retry. Kick off by sketching out your user journeys/flows and defining your info/data model – this sets you up with a pretty solid base. Think one step at a time and be super clear about what you’re after since GPT-4 can’t read your mind. Get detailed about the features you want and think about how changes could mess with other parts of your app. Show GPT-4 your code when you need to, as it can help sort out specific issues or add new features. With GPT-4’s help and a step-by-step game plan, you can whip up a slick and functional app, even if you’re not an expert.
So at the end of it do I now know SwiftUI? Well, to be honest I still have a lot to learn but at least now I can grasp some of the concepts which would definitely help whenever I look at some Swift code in the future.
My thoughts on AI assisted learning #
I just want to point out that AI-assisted learning, while super helpful for personal and professional growth, doesn’t replace the need to know the basic concepts and skills in the tech world. If you really want to make the most of AI in your learning adventure, you’ve gotta start with a strong foundation in key areas like:
- A good understanding of servers & networking
- Good programming principles, a good way is to have your style of coding be influenced by someone that is much better than yourself.
- UX / User Journeys / User flows.
- Information/Data Modeling, preferably from the business perspective rather than the technical implementation view.
- An interest in understanding the business domain you work in.
If you’ve got a handle on the basics we talked about, you’re likely the kind of person who picks up new stuff pretty fast. In that case, using a tool like ChatGPT can be a game-changer. It’ll help you find answers way quicker than sifting through a bunch of blog posts and all that. Just keep in mind that ChatGPT might not be up-to-date on certain languages or frameworks that change super fast. Even with that in mind, ChatGPT can still help you whip up something that works in no time. If you’re anything like me and dig the whole “learn by doing” thing, then you’ll find it to be a super handy tool to have in your arsenal.