Git support for Xcode projects allows you to take your Xcode and Swift projects into local and remote Git repositories. This video shows how to create local and remote repositories from Xcode.
- [Instructor] Now let's look at creating a project with both local and remote repository support. So here I am at the welcome screen and I'm going to click to create a new Xcode project. And you can create this of any type. I'm going to choose macOS, cocoa app, and hit next. Then I'll give this project a name, we'll call this GitExampleXC9, short for Xcode nine. And I'm going to leave everything else as it is, and hit next. And for the location, we'll go into exercise files, chapter 03, git_support, final.
Of course, if you're following along, just save outside of that final folder. And then here, you want to make sure that you check the box for create git repository on my Mac, which places this project under source control. Now, this doesn't create a remote repository, this actually only creates a local repository. We're going to look at making our project connect to a remote repository, in just a minute. So hit create, and here's my project, and it has source control support. And if you hit source control in the menu bar, you're going to see some options like commit, push, and pull, etcetera.
So, that's really all there is to it in creating a local repository. But now, let's say we want to connect this to a remote repository. Actually, there is no repository on GitHub that I have, called GitExampleXC9, so we're going to actually create that from Xcode. To do that, we're going to head over to the source control navigator, so that's immediately to the right of the project navigator in the navigator bar. So, when you choose that, just expand your project.
And what we're looking for is remotes. If you expand that, you're going to see there's nothing in there. Now, what we want to do is connect this project to a remote repository, which we can do by simply right-clicking remotes, and then choosing create "GitExampleXC9" remote on GitHub. So choose that, then you get this pop-up. It asks you which account you want to use, so you can use the drop-down if you have other accounts on GitHub, that are linked to Xcode.
Now for owner I have myself, and it's actually grayed out. But if you are connected to an organization, and you're authorized to create projects on behalf of that organization, you should have a drop-down there, to set that organization as the owner, if you'd like. Now we have the repository name, which defaults to my project name. I'm not going to change that, and you can see the URL that's going to create here. So, my GitHub account and then slash, GitExampleXC9. And for the description, I'll type a simple description right in there.
And for visibility, I'm going to choose public, but note that you can choose private. Of course, this will have to be a feature that you are subscribed to on GitHub. So with this set, I'm going to hit create. And, Xcode is going to push this to the remote repository automatically. And once this is done, I can actually tab over to GitHub. And I don't see it right here, but if I refresh, sure enough, there is GitExampleXC9.
So I created this remote repository. And so remember, if you want to create a local repository, you can create a new project and just simply check the box to have Xcode create the local repository for you. And then, to create a remote repository from Xcode, go to the source control navigator, right-click on remotes, and then choose to create the remote project on GitHub.
First, learn how to install Xcode and create a new project. Then find out how to edit code; leverage helpful features like the Assistant Editor, playgrounds, and snippets; and integrate version control with GitHub. Discover how to use Interface Builder, Xcode's intuitive UI design tool, to design a responsive interface that adapts to screen size, aspect ratio, and orientation changes. Todd also shows how to map application flow with storyboards, and reviews the basics of schemes and behaviors. Plus, learn how to compile and debug your code, test apps in the iOS Simulator, and submit apps for publication in the App Store directly from Xcode 9.
- What is Xcode?
- Installing Xcode 9
- Creating your first Xcode project
- Editing code
- Creating snippets
- Making interface connections to code
- Using Interface Builder
- Creating storyboards
- Pinning objects
- Compiling code with the LLVM compiler
- Working with schemes and behaviors
- Debugging code
- Sharing resources in a workspace
- Using the iOS Simulator
- Preparing an app to be published