From the course: Complete Guide to SwiftUI

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: Ratings view

Solution: Ratings view

(upbeat music) - [Instructor] Like most of these challenges, you might have a different solution than me, but here's how I would do it. First of all, we're going to make a SwiftUI file, so I'm go to File, New, File, and I'm going to use a SwiftUI view to make it simple. And I'm go ahead and hit Next. Check to make sure that all this is correct, and it looks like it is. So that's good. And now I'm going to change my name here to RatingsView, and create it. Okay, so now we've got our ratings view. Now, inside ratings view, the first thing I'm going to do is set up the parameter. So I'm going to make a new variable called rating, and that'll be an integer, okay? And you can see already it's going to give us a problem here. So I'm going to take care of the ratings view preview first here, and let's make this two to start. And we'll test it later, okay? Now, inside the body here, we're going to start working on the code. And this is going to be in a row that's going horizontally. So of…

Contents