From the course: SwiftUI Essential Training

Unlock the full course today

Join today to access over 23,200 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'll go to file, new, file. And I'm going to use a SwiftUI view to make it simple and I'm going to 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 RatingsView. Now, inside RatingsView, 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 RatingsView 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…

Contents