AI-Assisted Development for iOS

Jul 18 2025 · Swift 6.1, iOS 18, Xcode 16.3

Lesson 03: Getting Started with Cursor

Completing Implementation

Episode complete

Play next episode

Next
Transcript

Hello. Last time we installed cursor and got working on it and built out a weather API client. We’re now going to jump back to cursor and take a look at the spec and continue building out yesterday’s weather.

You’ll notice over in the chat window there’s this little dropdown here for past chats. So I could go in and open up the chat that we worked on the other day or in fact in the last video and continue to work on that. But in this instance, I’m going to start a completely new chat right at the top here.

And I’m going to do what I did last time. I need to open up the spec inside here. So it’s added to the context. So I’ve got the spec and then we’re in agent mode because I’m not paying for cursor I’m going to select the auto model. Possibly you might want the auto model. Anyway, and then I’m going to ask it to please, could you take a look at the spec and the project and give and a suggested approach to completing the implementation.

Notice that again, I’m asking for some advice so that I can run through it rather than letting it go off and and work on it completely on its own. Now, the other thing that you will notice is that this is different to the implementation we had last time. I suspect it’s fairly similar. This app is quite simple, there’s only 3 or 4 ways that you could probably implement it. And the implementation order as well.

However, this non-deterministic aspect is one of the challenges with with AI, particularly when you’re recording videos because it changes each time you do it. So what it is, it’s taking a look. It’s taking a look at the content we’ve got. It talks about the core architecture. It recommends the implementation order of doing a location manager, a time service.

The API client needs completing, this weather assets module for weather code mapping and then some UI implementation, and then finally the testing strategy. Oh and then it gives us the highest priorities location manager time service. The weather view model weather assets UI geocoding.

So I’m going to live slightly dangerously. It does say that the weather API client is already quite well implemented once again. Turns out if you flatter people, then they won’t think you’re annoying. What I’m going to ask it to do is build all of this apart from testing living dangerously, who knows what the hell it’s going to do.

Okay. please, could you go ahead and build all of these aspects? But please don’t add any automated testing. I would like to do this later. All right. Let’s see. Let’s see what it does. So the first thing it’s doing the location manager. We’ll let this work and then we’ll run through the files.

One of the challenges with doing it like this is that We’re going to have a massive code review to do. And as I’m sure you’re aware of massive code reviews, it’s quite difficult. So I could have asked it to do one little bit at a time. And then to review it. But for now, let’s let this run.

Okay. That now thinks that it is completed. Let’s take a quick look. And just take a look at the summary here. So it has made the major components location manager, time service, weather assets, weather view model, weather view and info plist. It talks about the things that it does. It has this five second fallback, it has the open meteo API. All of the things that we specified.

There’s some things that it thinks that you might need to do. There’s some linter errors, for example. They need to be added to their code project. I don’t think they need to. I think they’re probably fine. They’re in the correct group. I think you’re also fine, but we’ll check that and build the project to resolve import issues.

So what we’re gonna do is review the code and then we’ll have a go at building it. So we’re going to use our review next file button and just jump through them. I’ve got seven files to do. So corelocation. This is it’s made it an observable object. It’s known as object. So that it can I assume so that it can be a location manager delegate. There it is. CLLocationManagerDelegate. I’m going to accept that.

Like I said before, this is quite dangerous and I think you should go through and check it carefully. We’ve got a time service. It’s made a shared time service. Get yesterday at current time. So they were loading a calendar. Tell the day by adding. And then it tries to jump to yesterday. It’s going to try and format the day and it’s going to try and get the hour from a date. That is a prime candidate for testing. And in fact, I think in the next video we’ll have a go at testing that because it’s quite obvious for us how to test that.

Jumping on to the next file. This is where they’re assets, this moment. So this is the problem. Where it’s a little bit confusing is unless you know nothing about weather forecasting APIs. I don’t know very much. This doesn’t make much sense. But there are these codes that come back. And based on these codes, you can determine what the type of weather is. So the codes come as an in in as integers. And in fact here is the big list.

I mean I assume this list is correct because once again I’ve just let AI write it for me. I would again want to go and check that against the specs and my definition. But this is the what the each of these numbers mean. And this here returns the the title, a description in fact. And then up here, it returns the the weather symbol from SF symbols as well.

So it’s a fairly simple a little struct here to give you some different weather assets. I don’t like this format temperature malarkey, but we’ll leave it for now. Then the weather ViewModel, we already had a weather ViewModel. It has updated it. We’ve now got a weather view state. And it needs a location manager, an API client, a time service, and a geocoder.

And it goes through, it fetches the weather by as finding the location, finding the date, asking the client. Then it’ll try and get the location name. It will format, and then it will create this weather data object, which will contain all of those different bits of information. It’s got a lot of error handling. It’s quite nicely written code because it’s using modern concurrency. So I think that looks and looks fairly reasonable on the surface.

We’ve got a couple of files to go. This one here is the weather view is basically completely rewritten. This I am just going to accept that and we’ll see what it looks like. And then over in the in the app, we no longer need the content view. We’re going to use the weather view instead. So I’m going to accept that over here this info plist.

I can tell you for a fact this is wrong. It shouldn’t be creating an info p list. We do need this. We need the NS location. When in usage description. So I’m going to copy this because we need it, but we absolutely do not make an info p list for this. I’m going to reject that. And that gets rid of it.

So I’ve still got them a clipboard. I’m not going to jump over to Xcode and do two things. My first thing is I’m going to update that in so in yesterday’s weather info I need to add a new attribute. This is the info p list and this is Privacy. Privacy. And we’re looking for location. When in usage. When in use. Usage description I’m going to paste what AI wrote. And that lives doesn’t live in an info playlist at the top level. And in fact, if you did that, then it wouldn’t build.

I am now going to attempt to build this and I would be surprised if it works.

Oh Lord. it did build. Let’s see what happens if you run it. Okay. It has loaded a page with yesterday’s weather and tells with the title. I mean. it’s not particularly attractive. but it has come up with an unexpected error. and I can try again. And it still has the same error. I don’t think it asked me to use my location. but no. it didn’t. Okay. And then in the logs. there’s nothing here either. Okay. so I think what we’ll do is end this video here. It has built. And then our next video. Let’s try and make this work and we’ll see how far we get using cursor. And it’s slightly clunky debug thing when you’re using Xcode. See you then.

See forum comments
Cinema mode Download course materials from Github
Previous: Large Changes Next: Debugging in an AI World