AI-Assisted Development for iOS

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

Lesson 02: Using GitHub Copilot for Xcode

Installation & Code Completion

Episode complete

Play next episode

Next
Transcript

Hello. In a previous lesson, we took a look at using text based AI, so ChatGPT and Google AI studio directly in a web browser, and we saw that it was really helpful for building a spec. And you could also actually get it to generate code. But you’d have to copy and paste that code over to Xcode every time you’re doing something, which might work for the occasional, small little piece of a project.

But you can get a lot further, a lot quicker with a more integrated, more integrated solution. And one of those is GitHub co-pilot for Xcode.

Co-Pilot is all of the AI things branded for GitHub or in fact, for Microsoft. But Co-Pilot for GitHub involves, first of all, this little guy who follows you around. So worth looking at for that alone. It can do code completion. It can do code reviews. It can take issues and create PRs from it. You can do all kinds of different things. It’s very much positioned as your pair programmer now.

It lives natively inside Visual Studio Code and also on the GitHub web app itself. But for us, we want to use Xcode. We need to use Xcode. And for that, they’ve created a separate app that integrates Co-Pilot with Xcode. It’s an app that you run alongside it originally. There’s not a huge amount of information about it, marketing information. Originally it was made and it did code completions and not a huge amount else. But it does a lot more than that.

Now to install it, they give you a link inside the Getting Started guide. You need a recent version of Xcode, but within there, you just need to download the latest version and then follow these things. So you go, once you do that, it’s going to ask for permissions to use an extension inside Xcode. So go ahead and do that. And that will allow you to for it to integrate properly with inside Xcode. It doesn’t allow full integration, which is why it has this companion app.

So I’ve downloaded that, I’ve installed it, it’s a DMG. So I dragged it across, I then went through and enabled my extension permissions. You then have to sign into co-pilot. Co-Pilot is just using your GitHub account. You will get some way with the free version of Co-Pilot, but it’s free, a more advanced version that has higher limits of AI requests. You can it starts at $10 a month, and you get reasonably far with that.

So I’m going to go ahead and open co-pilot for Xcode opens here. And that opens this companion app. It’s a small thing down one side, and it’s already that it’s talk. Not only code suggestions, Ask mode, agent mode and MCP support. We’ll look at most of those as we go through today. You’ll also notice that it doesn’t actually do anything unless you have Xcode open.

So I’m going to go ahead and open Xcode as well. And when I done that I’m going to open an app called Emitron which is the now defunct Kodeco iOS app. But it’s a pretty reasonable code base, which is why I opening it. And once I do that, I’m just going to try and resize these so that they fit together.

So now that we’ve opened Xcode and open a project within there, you can see that Emitron has been selected within the GitHub co-pilot app as well. So it recognises that we’re working on a particular project. And then down at the bottom, it’s got a chat window because all LLM-based things involve you talking to them.

It has a way of selecting different models. So we’re using GPT-4o from OpenAI. You can also have at the moment 4.1, o1, o3 and 04. I don’t honestly know the difference between all of these. There’s also some Claude ones from anthropic, and then Gemini from Google. So these are all of the kind of major players in the non-open source, non-open weights, models at the moment. I’m going to stick with for oh for now.

Also there’s this option between to go between Ask and agent we’re going to use ask for today. But you can switch around. And then there’s this button for Add context. So first of all we’re going to open this file here called progress Bar view. And you’ll notice when you open a file then this automatically changes to representing that current file. So if I open checkmark for you it jumps over to checkmark for you.

So I’m going to back to Progress Bar View. And I want to find out what this file does. Now what context means is this code is given to the AI as well, before it then asks a question. So you can put in theory any amount of context in. It costs more to put more context in all of these things have limits of the amount of context you can send. But you can get reasonably far with, you know, relatively small projects by sending quite a lot of context.

It automatically suggests that the file that’s open should be in context. But there’s this little eye icon at the end which allows you to say, do you want to send it in the context or not? So I’m going to tick that. So it becomes an eye and a crossed out one. That means it’s going to send that I mean ask mode. And I’m just going to ask co-pilot, “Please can you tell me what this code does.”

And then what it will do. It uses one reference. So it tells you within here which file this is referenced. It grabs the context for it, sends it and then generates a response. And within here it tells you that it’s a progress bar view. I’m going to ask it please could you summarise that it’s a bit long. That this is a little better.

So it’s a SwiftUI view called progress bar view, which makes sense. It’s called progress bar view. Initialisation accepts progress between 0 and 1, is rounded to determine whether the corner should be rounded and a background colour. It stores properties for corner style, background radius, bar height. It uses a geometry reader to adjust the width dynamically based on the container. It’s rigidly represented with an overlay rounded corners. Reply different. It is true, and it has some previews down at the bottom.

So that’s what. That’s an example of what I can do. I could also ask it, in fact it’s suggesting “can you explain how to use this progress bar in my Swift UI app.” So I’m going to click that and see what it says. And what that’s now doing is spitting out some code where we’ve got a content view. And it’s got the body view and it’s made a vstack with and put some text in and it’s used a progress bar view with a particular progress value. And selected is rounded and it’s changed the colour as well.

So it’s giving you some examples of exactly how you can, how you can build in that is a full Swift UI app that would demonstrate using the progress bar view.

So what if I want to ask a question about a different file? So I can click this Add Context button. And within here it gives me all of the files that are available within the project. So I say I also want to know about CheckmarkView. I also want to know about MainButtonView. So I’ve now added two more files to it. I’m going to ask it please could you to summarise what these files do. Send off.

And it does exactly the same. But at this time because I can provide the context, I’ve manually added some extra context. We’ve got the progress bar view, which we’ve already done. We’ve got a checkmark view which is a Swift UI view, and it tells you what variables it uses. And then similarly, so main button view. What what are the things that you can send type that gives you a button status primary, secondary and destructive. The action that you use on callback. So this is quite a useful way to get an idea around the code base.

See forum comments
Cinema mode Download course materials from Github
Previous: GitHub Copilot for Xcode Next: Writing Code