Transcription
Claude Code is amazing. It can do anything, right? But can it write an app for that? Here we go. On today we build, I challenge Claude Code to write an application for watch OS and put it on my watch. And this is one I actually need. Really? Do we really believe that Claude Code can do that? I don't know. Let's find out.
All right. Today, for this build, we're going to do something a little bit different. We're going to use Claude Code. But of course, we're challenging Claude Code to build a watch OS application kind of single shot. We'll see how it goes. Uh, but we're going to be putting Claude Code, of course, in cursor. So, that's why you're seeing the files here if you're wondering. And then I'm also going to be using Xcode. When you build something with watch OS or iOS or something like that, it's just generally easiest to use Xcode as your compiler. You can use the simulator this way very easily, things like that. So, that's what we're going to do.
We'll go over to the watch OS environment and create a new app. We will select our new folder which is this nudger application folder. And there we go. So now what we have not surprisingly is a brand new structure for an iOS or really a watch OS application here. It's a very small folder structure. It's basically got two Swift files and you know some assets that it's got inside of it. It runs itself as a hello world. So what I'll do here to show this is what Xcode did for us. And by the way, why am I starting with Xcode to build the project structure? I could have challenged Claude Code to that to do that as well. To me, it's just easiest to get there's some special things inside of these Xcode projects that really need to be built out properly. It's just easiest to say, "Okay, I'm going to start an Xcode." That will create a very simple template file for me. And then what we're going to do is run this on a on a Ultra 2 series watch simulator. So, when I hit run here, what it's going to do is bring up our simulator. And I will put the simulator out here and bring everybody back on screen. There you go. So this is the application launching over into the simulator over here. So this application's over here, plain and simple. So this was really Xcode getting a lot of that first pass done.
So what we're going to do is challenge it with a nice little definition document, a PRD. Again, this is how I work generally is to create a definition document that kind of defines all of the requirements that I want from the system. I've worked with uh 03 in chat GPT to get to this. That's my typical pattern. work back and forth to make sure that it has a clean enough example of what I want from it. It doesn't really have the how to do it. It just has I want these, you know, simple timer kind of things set up. I want you to be able to add more of them, delete them, slide them to delete them. Some very, very simple kind of expectations that you might have in a in a standard iOS watch OS kind of application. So, enough of that. So, basically, we do have a watch OS application already running. We don't have to worry too much about that. But down in here, we have access now with Claude Code to be able to touch that as much as we need.
The first thing that I'm going to do here is I'm going to run an init. And that is just basically going to look through the project that we have right now and write a Claude file in here. That Claude MD file, if you don't know, is just kind of your memory file. It's things you can pile in so the application remembers some things and it doesn't you don't have to keep repeating yourself. You have to worry about this. This project today, we're going to do this hopefully so fast and so simple. we'll see uh that we won't ever really have to worry about adding things to memory or removing them, but hopefully this grows into something bigger and better. And this Claude MD file is really the jump start for the next time we run Claude in here. Okay, the Claude file finished defining. That's great. It just went through and looked at everything. I don't know how much of that's needed, but that's fine. Uh, the next thing is I've pulled the project definition file in here, and this is what we're going to run. And you can see we're going to run uh, let's see anything else that has nudge test. This was an earlier name of the project. We'll just call it nudger. Uh, is a watch application. It has nags and nudges. So here's what the nudge does. Here's what the nag does. Uh, here's the data model that needs to be set up. User interactions. There's a list view. There's a create edit screen. Some technical details about what uh parts of the system to use to do these different parts. What nags can use to subscribe. So some simple stuff. A little bit of sample code down here. Um, and a little bit more sample code down here. So, it's really really not much. It's not actually a technical definition as much as a few hints at some of the functions. And a lot of this was gotten from 03. Once again, um, I the one thing that I did go and look up actually in the documents themselves is to figure out how I might be able to use the alarm system that watch OS already has because I just wanted to know how am I going to do something. This thing has something to do with something like alarms. again. 1 second. But that told me I might need to use this extended runtime session out of the watch kit. That's it. And that's why I kind of put this stuff. Um, so no big deal. We come back to Claude Code and I'm going to kick it off and tell it, yeah, can you go build everything? Can you build a system that you see defined in this project definition? Here we go.
Okay, so let's talk very, very briefly about what the heck we're building here. So really the most exciting part is can we use Claude Code to build a watch OS app? That's what you're going to learn today. You're seeing me do all of the steps except for that planning step that I did. So, if you start kind of easy with a request that you're trying to build to see if you can get it done, I almost guarantee you, you will get this done and it will shock you. You're about to see that in a second that this is going to maybe work or pretty soon after we get it, maybe a couple edits it will work. And that alone is kind of shocking. But what's it doing? So, I've always wanted an application for my watch that wasn't an alarm, but just a little reminder, kind of like chimes that you might hear on the hour. I don't want that. That's kind of boring. What I really do want is every now and then at a certain time in the day, I do want a little bit of a poke. Like 4:00 in the afternoon, I want that reminder that says, "Oh, hey, you might want to remember it's getting close to time to wrap it all up. So, start working your way down. Whittle down the list. Don't build it up more." And another one very early in the morning just to say this is about the right time to get up and really get active. Feel free to skip me. Move on. I don't have to press buttons. I don't have to look anything. So I sleep with my watch. That's kind of a hint there. So that's actually what I'm looking for. I've been wanting something like that for a really long time. And I thought, hey, Claude Code seems to be able to build everything else. Can it build this? And by the way, I don't have an answer for you. I'm just guessing. I have a feeling this thing's just going to cook.
All right. You can see the big list of to-dos that it's kind of working through. It took our PRD and kind of turned it into uh not quite a requirements document, more of a a a definition document. Turned it into a very nice set of to-dos. Really, one of the nice things about Claude Code is you get to watch it as it works without it really killing you with all of the changes that it's making. So, let's let it go. Oh, okay. While this thing's cooking, let me show you something really cool that I bet some of you guys haven't seen yet. All right. So if you open up terminal any terminal I'm just going to use the one here in cursor and run you can do npx cc usage or bunx cc usage and what this is going to do is it's going to run a kind of a a table that it's going to give you of all of the different usage that you have using Claude Code to give you an idea of how expensive it would have been if you didn't have a subscription. So let's just run bunx cc usage and let it give us our table back. And what it's really doing is reading some of the files that are in that um home directory. Claude folder. We've looked at that in a previous video where that's where we're putting some of our global settings and things like that. If you look through this, it kind of has when you ran, what date you ran something, which models you used, how many input tokens, output tokens, and and the general cost that there was. So, you can see from this period I'm at $1,300. So, that's kind of ridiculous. Um, it's running in compact mode. So let's run that again so that we can see the wider version. Here we go. Because you get to see some of the interesting things that they have is this is total tokens but also the cache tokens are listed in here which is pretty exciting. So Claude Code is doing a great job of trying to figure out how to cache as much as it as it can. So it doesn't have to duplicate the same kind of information that it sent in the previous request with the next request. Very very cool. >> Hey. Oh hey, sounds like we're done. But let me show you one other. So if you do bunx CC usage blocks, there's a couple of them. There's blocks, there's session, but if you look at blocks, you can see it over time. So the one we're working on right now is this active one. We're using Opus 4. We've now spent $4 on this application so far. Started at 4:00 and looks like what 9 million tokens or something like that. So all right. In any case, I thought this was very cool. I thought people might be interested to see CC usage. It's just a project you can go find on GitHub. uh support them is a really cool project out there that's kind of uh catching on fire right now.
All right, so this thing supposedly finished. Let's take a look at the project files themselves. You can see what it will end up creating is all of this information inside of the nudger folder itself, which is where Xcode really does its work. Basically, where the application lives inside of an Xcode application. So, what we're going to do is we're going to stop the hello world over here. And we're going to hit run again. See if it builds. Looks like it's got an error, which is perfectly fine. You should see this path when there are errors. Then you can click on the error, come over here, copy it, come back to Claude Code. Seems Claude Code created its own infop list and it's saying, "Oh, wait a second. Let me remove that and go back and update the one that was already there." Not sure how that would have happened, but okay. As long as Claude's on the job. Hey. Okay, so we are back supposedly. Let's give this a build and run again. Unable to find something. Great. Have to import background tasks for this to work apparently. I didn't know that. >> Hey. Okay. All right. Once again, let's see how that one goes. Oh, this time's it's running. This is good. Nudger would like to send you notifications. Yeah, it's definitely a notification app. Let's let that happen. No nudges yet. Okay, here we go. So, what I don't have is a way to add a new one. Hey, I don't seem to have a button or something to allow me to create a new nudge. Uh, hey. All right, let's try that. So you can see the flow. All I'm really doing is picking up what the compiler from Xcode says, giving it back to Claude if we need to give it back, and otherwise just coming back and essentially hitting the run button. There may be some times when you need to do some clean or something like that, but mostly you can hit the run button. It'll rebuild the project after there have been changes and try to run it again. So all right, let's add a nudge.
All right, so here we are. The idea of this application is we can set what time the nudge goes off. So, let's set that for 4:05. And we want it to be audible. Sure. Let's hit save. That's at 5:05. It's 5:04. Now, we wait. Uh, I didn't see anything happen. Did you? All right, let's go figure that one out. Hey, it seems like I wasn't sent a notification when it went off or when the time elapsed. Can you take a look at that and make sure the notifications are, I don't know, being saved correctly or something? Let's leave it up. Oh, look, the notification went off. So whatever he's looking into, I'll just let him find. So great, it worked. All right, that's kind of awesome already. I guess because we were in the application, it didn't go off. I suppose I can believe that. So let's delete that nudge. Add a new one. Add it for 8:00 or 5:08, sorry. And let's set nag mode here. And nag mode has a different behavior. All right, you'll see the little bell. Uh-oh. Looks like we had a crash. Help. Crash. But by the way, our nag alert did go off. Now, what's happening behind the scenes in this nag? There's two different kinds. There's the nudge, which was the first one, and the nag, they look very similar here, but this nag one, I'm told, will sit there and remind you again and again for a certain period of time. And what we really need is to be able to say how long it should nag us for. So, this is a little bit different version of this notification compared to the previous one, which was just one time it does or does not make a sound and it makes some kind of haptic feedback on the watch. So, that's all we've really implemented is something that will send a notification to the watch that will give you a little haptic feedback. And as we notice in here, let's go in and edit it. Well, can't seem to edit it right now. Let's let this guy finish cooking. Okay, so let's see what it's got. We cooked a little bit. Couple back and forths. Pretty much the same pattern. Just grabbing the errors that Xcode was announcing and putting them back into Claude Code. Let's see where it got though. All right, we can add this. Inevitably lead to incorrect crown indicator states. All right, so there's some issues there that we'd like to fix, but for now, let's take this kick him up 1 minute. Make it a nag mode. And it's going to nag for 30 seconds is what it says. All right. So, we will save and then we will go home and hang out until the time changes. Oh, dang. It says the last time I set it for 5:18 somehow. Let's try that again. Let's let it run. It is too early. All right. Save it 5:20. It is saved for 5:20. Let's go home real quick. Hey, nag alert. And it will be going for 30 seconds and then it'll stop. So, this is kind of it. That's fantastic. Holy mackerel. This really didn't take much time at all. And now there's a real watch out. Watch out. I know. I'm sorry.
Okay, this one was a quick and easy one to get running. I did have a couple errors back and forth. Uh, and of course, Claude Code is doing its best without an actual compiler to get everything right to import the right, you know, frameworks and things of that nature. But it really did work. And so now I have something running in the simulator. Now admittedly, I have spent an hour and a half trying to actually get it on my watch and welcome to the Apple verse. That's a different challenge altogether. I don't know, maybe Claude can help me with that, too. So, oh, Apple. So, I will get that hopefully at some point in the future and show it to everybody and be able to close the loop of whether or not this actually worked. But I have every expectation that what we just saw will work on device and it should nudge me just the way that I want. This was kind of awesome. Frankly, I hope you saw something here that kind of made you think maybe you can build something that easy as well. I would say go dive into Claude Code and say, "Hey, I want a little app that can keep a little pet alive if I tap it in number of times a day or something." I think that this is a really great experiment to see if Claude Code can go much further than the web applications that we usually do and those kinds of things. So, I thought this was a fun experiment. I hope you found something here that you liked. Thanks for coming along for the ride on this one and I'll see you in the next one.