What is Swift UI?
Start course
1h 1m

In this course focused on layouts, we're going to see how to create user interfaces for our apps so that you can see how views work and you'll learn how to create views just using code rather than your main storyboard.

Intended Audience

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 this lecture, we're going to discuss what swiftUI is. So, I'm going to create a new XCode project for that and you don't have to do that by the way, you can just watch this lecture without applying. What I'm about to do because this will be a small lecture just to give you an idea of what swiftUI is. So, for example, I'm going to go for a swiftUITest or swiftUIIntro as a product name and this time I'm going to check this Use SwiftUI box. If I click next, it will ask me where to place it as usual and I'm going to create my application. And immediately you will realize that there is something different in our project. So, let me make this into a full screen so you can see it better. As you can see we have two sections right now. On the right-hand side, we have something called canvas. And if you don't have this, you can always open it from here, editor and you can go for canvas in here as well. If you say resume, it will create a preview of your current app. And on the left hand side, we have something called content view in which we have one text saying Hello World. And in a minute, you will see how does this look like in a real app.

And this is one of the beauties of the swiftUI, it will just show you a live preview of your app. So, if you make changes on your app, it will appear on the right hand side and even you can play this like a simulator and you can click on buttons, you can go to other views and stuff without having to run simulator at all. So, as you might realize this is completely different structure than what we have seen in the course so far. We have something called struct, we're going to see what it is later on. This is something like class but we haven't even seen what the class is yet, so I'm not going to go into details all that I should tell you right now is that this is completely different setups. So, we don't have view controllers in SwiftUI, we have views. We don't have main storyboards in SwiftUI. We just write what we want in here and it will happen for us. As you can see if I say, Hello SwiftUI, it will appear on the right hand side. So, I can add some much more views over here as well. So, I can say text Hello, but in order to do that I will have to create something called stack. So, VStack. So, if I do vertical, it will stack up the views in a vertical alignment.

I'm not telling, I'm not teaching you how to use SwiftUI right now. I'm just doing some stuff so you can see how SwiftUI is acting, how to work with SwiftUI, how does it feel to work with SwiftUI? For example, I put the spacer between text and it just add a space. It's really cool by the way, I really like the SwiftUI but we have to be prepared for the main storyboard and we have to be prepared for the SwiftUI and we have to know it all at this stage in the IOS development. Maybe two years later, we don't have to learn about main storyboards at all. But for right now, you have to learn it. If you want to be a professional IOS developer or if you want to create your own apps, it doesn't matter, you have to learn about main storyboard, you have to learn about SwiftUI anyway at this point. So again, we're not going to do much over here. I'm not even going to share this project with you because we didn't do anything, and we will have some dedicated section to SwiftUI later on when we master the Swift and when we master IOS development after the advanced sections, we can go for SwiftUI. Right now, we will stop here. And following the next section, we're going to go ahead and learn about advanced IOS techniques so that we can use them in our apps.


About the Author
Learning Paths

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.

Covered Topics