From the course: SwiftUI Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Solution: Ratings view
From the course: SwiftUI Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
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
-
(Locked)
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
-
-
-
-
-
-
-
-