Check out a free preview of the full iOS App Development with Swift course

The "Creating the Project" Lesson is part of the full, iOS App Development with Swift course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano walks through creating a new project in Xcode using the iOS App template and selecting SwiftUI as the interface type. A demonstration of some features of the Xcode user interface is also covered in this segment.

Preview
Close

Transcript from the "Creating the Project" Lesson

[00:00:00]
>> Now it's time to open Xcode and create our first iOS application project. And for now if you to companion website, remember it's firtmam.github.io/intro.swift. Now we are going to be following this table of contents. I'm not going to follow the steps one by one, but in case you get lost at any time, you can actually follow this also, you have a link to GitHub here in the introduction.

[00:00:34]
Later you will have mine. So in case you have any problems, you can follow Mac. So, now back in Xcode now, we're going to get out of the playground. And we're going to create a new project. For that, find new project, okay? That's it. But here, it's important to pick the right template.

[00:00:59]
There are so many templates here. We need to pick iOS, so make sure you have iOS and then the one that says App, just that, that's simple. But there is also multiplatform app in macOS app, in watchOS app, so that's why it's important to pick iOS, and from iOS, app, then next.

[00:01:23]
And here, I'm going to zoom in a little bit. So we can focus on these options that we have in this form. While the product name is the name of the app, so we're going to call these CoffeeMasters. Then it's asking me for a team. So what's the team?

[00:01:41]
For now we can just keep it as none, okay? The idea here is that if you have an Apple Developer account, you can actually select that account from here. You don't need to do that while developing the app. You just need to select a theme. If you wanna compile the app for the store, or if you wanna try the app in your own iPhones or iPads, if not we can just leave it as it is.

[00:02:09]
Then, it's asking me for an organization identifier. What's the deal with this? Every app in the App Store and every app in the device has a unique ID, it's a primary key, it's a string. So we cannot have two apps with the same ID, it's an ID. So how can we, let's say kind of guarantee that we're not using an ID from other app?

[00:02:37]
Typically, we use our URL or our company's URL in reverse order I mean, it's not mandatory and nobody's actually going to check if that entering the DNS exists or not. But for example, we can say conference and masters, I can say, don't worship, even if it doesn't exist, it doesn't matter.

[00:02:58]
And then it's going to merge that organization identifier with the product name, we can change that later. While we're not polishing the app, we're actually running the app in our own computer or our own device, the bundle identifier can be changed without any problem and is not actually registered with Apple.

[00:03:21]
From the moment that you actually compile the app for the store, or you run the app on your own iPhone, actually you are registering that ID In Apple's databases. So be careful if you're using your company's name. The first time you try the app on your real iPhone, what will happen is that, that ID will register under your account, and that ID cannot be used on any other app in the future.

[00:03:54]
Interface, we have to select swift UI and when we select swift UI, we don't have any other language option. When we use storyboard that is actually part of UI kit. You can pick objective C, okay, but we're not going to do that, I'm going to use Swift UI.

[00:04:14]
What about core data and testings? Right now for today we don't need to add tests but you can add that later if you want, that's UI testing and unit testing both. Core data, it's a framework from Apple for data persistence. So it's kind of similar to hibernate, so it's a mapping system that will map objects to databases or other data providers.

[00:04:41]
We are not going to use it so we will just keep this as it is. Next, now where are we going to store that? So I will just pick a folder in my Mac. And something that you may wanna look into that is to create a git repository on my Mac.

[00:04:58]
So you can actually select that or not. So in this case, you're going to have version control locally in your computer, if you click that thing. Create, and now our app is ready. Let's try to analyze first Xcode as an ID. So first we have a couple of panels, so we have a panel at the left, a panel at the right.

[00:05:27]
And there is also an optional panel at the bottom, these panels can be collapsed with these little icons that you have here, here and here. There is no way to detach those panels. You can just open them, close them, and that's all. Don't try to move them, isn't gonna work, okay?

[00:05:53]
So if you have two monitors or something like that, you can create a new window with File > New > Window. And from there, you can actually have another window that is connected to the same operation. Okay, but no more than that. Then I will focus now on the panel that we have at the left really quickly, because the first time you see this is kind of weird, the user interface is weird.

[00:06:20]
So I'm going to zoom in here. And these are called the navigators. You don't feel like these are tabs, but believe me, these are tabs. So if you click on these icons, you are changing the tab. You are changing the navigator. The first one, it's the project navigator, it's the one that you will use the most.

[00:06:45]
The second one is the version control navigator. Then we have some kind of a class navigator or a structure navigator where you will see all the contents that you have or the classes or the structure or the enums. Then we have a search navigator where you can search within the project and issues navigator, you will see here your warnings, all your errors, and also runtime errors.

[00:07:10]
Then test, this is a test navigator because we didn't include a test project or a test target. We don't have anything there. This one is going to use for debugging. Then we have breakpoints, the breakpoint navigator. And finally the output navigator, where you will see all the outputs every time you run, you have a console output.

[00:07:34]
So here you can see all those logs. Okay, so just to understand what's going on on that side. At the right you have what is known as inspectors, to be honest when you're working with Swift UI, we don't use the inspector panel a lot because we have other better options.

[00:07:58]
So typically, I'm talking about these panel that you close or open with this icon. Typically we're not going to use it, so we can just hide it, okay. And the one at the bottom that can be managed by that icon, that little icon there are the bottom. We don't need that at this point, so we can just hide, okay.

[00:08:25]
Then, in the middle of the ID, we have the editor. Right now, the editor is opened in one file, with the name contact me. We don't see here file extensions but because of the icon we have the little bird there that's actually a swift file. So we have content view is actually a swift file, if you do one click over filings you're just changing the current tab.

[00:08:56]
If you double click on the file, you're actually fixing that file in the tab, so, it's actually difficult to see, but now content view it's in italic, I'm not sure if you realize that, if you double click now it's fixed. So that means that if I click on another file it's a new tab, okay.

[00:09:16]
So you need to get used to this because it's different from either IDs, so double click will create a new tab and a single click will actually open a tab or share the tab between different files. Fortunately for us, these days, when we create a new project with Swift UI, we don't have a lot of files.

[00:09:35]
Okay, so we have just a file, let's say you file for now with the name assets, okay, we will see how to work with this. Then we have some kind of a folder known as preview content, we'll talk about that later. And then two thrift files, CoffeeMastersApp, and content B.

[00:09:56]
That's all. That's all we have.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now