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
From the course: Complete Guide to SwiftUI
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
-
-
-
-
(Locked)
Embed a stack view6m 29s
-
(Locked)
Text views3m 41s
-
(Locked)
Image views with SF Symbols5m 22s
-
(Locked)
Iteration with ForEach5m 13s
-
(Locked)
Images and assets4m 56s
-
(Locked)
Labels2m 22s
-
Add view2m 49s
-
(Locked)
Challenge: Add views26s
-
(Locked)
Solution: Add views2m 33s
-
(Locked)
Extract subviews8m 4s
-
(Locked)
Subviews with parameters6m 37s
-
(Locked)
Challenge: Ratings view44s
-
(Locked)
Solution: Ratings view3m 55s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-
-