Xcode projects can be created from existing templates. In this video, see how to create your first Xcode project and how Xcode projects work within the file system.
- [Instructor] When you launch Xcode, after you've installed the additional required components, you're going to see the welcome screen. The welcome screen enables you to quickly create a new project or get into an existing project. You can create a new project from the welcome screen directly by clicking the button here, or you can use the file menu under file, new, project, or the keyboard shortcut shift-command-N. So let's create a new project by clicking the button right here, to create a new Xcode project. And when you do that, you're given the template menu. And under the template menu, you have a list of platforms, so we have iOS, WatchOS, et cetera.
And you can choose the different tabs to see the templates for each platform. For now, we're going to stick with MacOS and create a simple Cocoa App, which is a basic Mac application. So I'll choose that, and then I'm going to hit next, and I'm going to give this product a name, I'm going to call it First, with a capital F. I'm not going to set a team yet. A team is used for later on, if you want to use certain features that are locked behind being a paid app developer, or if you want to upload your application to Xcode servers.
So in some cases, you do need a team. We'll talk about that more, later on in the course. For organization name, you can put whatever you want. I just have my name there. And for the organization identifier, I'm using a reverse domain structure. So since I own toddperkins.com, I simply flip that to com.toddperkins, and Xcode combines that identifier, which should be unique to you as a developer, with your project name, to create a bundle identifier, which would be a unique identifier for your application on the App Store.
Now if you're saying to yourself, well, I'm not going to release an application just yet, well, if this project you're creating isn't going to turn into an application that you're going to release to the public, it really doesn't matter what your organization identifier is, at this point. So for language, choose Swift, but note that you can use the drop-down to pick Objective-C if you would like. I'm going to check the box to use storyboards and leave everything else unchecked, and then hit the next button. Now, we want to save this. I'll just press command-D to go to the desktop, and we're going to save this in exercise files chapter one, first, and I'm going to save it in final.
If you're following along with the exercise files, save it outside of that folder, just right in here should be fine. Make sure you have create Git repository on my Mac unchecked, we don't need source control just yet, and then we'll hit create. So that creates our project, which is a collection of files and folders. So it creates those files and folders in the file system, and in Xcode, you see what appear to be a mirror of your file system, files and folders.
However, what Xcode creates and what you see in here are not exactly the same. The reason for that is, Xcode allows you to organize files in this area, which is called the navigator, independent of the file system. So these yellow folder icons are actually called groups within Xcode, and again, they allow you to organize your files however you'd like. So, it doesn't matter how they're set up in the file system. And the reason why I want to point that out is because, in many other IDEs, the project that you see in the IDE is an exact mirror of the file system, and in Xcode, that's not the case.
So just to demonstrate that, I'm going to tab over to finder with command-tab, and create a new finder window with command-N, and we'll navigate to our project folder. So, what I'm looking for is a folder with the same name as my project, which is First with a capital F. So if you click inside of there, you're going to see the Xcode project file, which matches this icon right here. And Just right off the bat, we see that this first group, right here, is in the same level in the file system, but it's nested under the project in Xcode.
So if you navigate into that first folder, you're going to see, for the most part, it matches what's in that group in Xcode, except for, we don't see that base file here. You also don't see the products folder in the file system. So again, it doesn't necessarily match what's in Xcode, because Xcode allows you to group files and folders however you want. So remember, if you want to create an Xcode project, you can do that from the welcome screen or go to file, new, project, or the keyboard shortcut, and when Xcode creates your project, it creates files and folders that don't necessarily match what you see in the project navigator in Xcode.
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