SwiftUI Crash Course
The course is part of this learning path
This course delves into SwiftUI, which you can use to create user interfaces for your apps. We're going to cover how to use it, how to create views, and how to leverage it to create responsive apps that work in all screen sizes.
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
To get the most out of this course, you should have some basic knowledge of iOS.
Hi, within the section, we're going to learn how to work with SwiftUI in order to create stunning user interfaces. So, Apple has just recently released the SwiftUI and it's better than ever before. So now, we can create very structural, good user interfaces with this framework. So, go ahead and create your first project and choose 'Single View App'. And this time make sure that you check this 'Use SwiftUI' box as well. And, I'm going to name this my FirstSwiftUIProject. So, 'FirstSwiftUIApp' or SwiftUIProject. And, of course, we're going to discuss what is SwiftUI and what is the difference between SwiftUI and regular method of building user interfaces, okay? So, let me put this on my 'iOS' folder. And, let's say, 'Update' to this, And let me make this into a full screen mode, okay? So, like that. And you will immediately realize there are some differences between the SwiftUI projects and regular Swift projects. For example, here, we have some ContentView and we don't even have a ViewController over here, right? Rather, we have some structs. And, in the left-hand side, you will see that we have the AppDelegate. We have the SceneDelegate as usual, but we have this ContentView rather than ViewController. And this is the ContentView that we are already seeing right now. So again, on the right-hand side, you will see something like this. And if you don't see it, you can come over here, this menu and say, 'Canvas'. So, within the Canvas, we will see our Preview. So, if you say, 'Resume', you will see the preview of your app like this. Even though I'm not running any simulator right now in my project, as you can see, I'm seeing the project in the Preview. I'm seeing it as in a simulator. And beware that I'm not running any simulator right now. But, XR is chosen and it showing my project inside of an XR framework, XR layout, okay? So, that's cool, right? I can make changes in my coding section and I can immediately see how it looks like in a real life environment by using this previews. So, this is very good. So, over here, we have this text. For example, rather than saying, 'Hello World', I'm going to say, 'SwiftUI'. And as you can see it, immediately change the text over here. So, I can do what I have to do and I can just see the results on the right-hand side in SwiftUI. And that's very cool. So, that's one of the biggest advantages of SwiftUI. So, let's see some differences. Maybe you realize that we don't even have a storyboard right now because we're not going to work with storyboards. We're not even going to work with ViewControllers. From now on, we will have Views rather than ViewControllers. We won't have ViewControllers. We won't have Labels. We won't have TableViews. And if you open your 'Library', you will see some other options, like we have something called Stack over here. And you will see what it is. And we have some other options over here, like a List, like a Text. And we see some old schoolers, like Button and Toggle, and other things. But, we have so different options over here. And we're going to see how to use them later on. But, know that, right now, we don't have ViewControllers. We don't have old Views. We have everything in a new way. But the good thing is, the coding doesn't change. We can use the Swift knowledge. We can use the Swift structure as it is in here. So, we have this struct, right? And inside of our struct, we have a body. And inside of our body, we have some Views. So, that's what we're going to do. We're going to create Views inside of our body. And we're going to work with those Views inside of SwiftUI. And once you master SwiftUI, you will be free more than ever to create stunning user interfaces. And again, it's a little bit different, it's a little bit more difficult compared to the conventional ways to create user interfaces. But once you get to know it, then you will love it, okay? So, within this section, we're going to have a crash course on SwiftUI and we're going to see the basics, the introduction part of SwiftUI, so that we can create good user interfaces. Let's continue within the next lecture.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.