UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Project 11 Bookworm: How does Swift Know?

Forums > 100 Days of SwiftUI

Hi. In Project 11, "Bookworm", I get a bit confused over the "label" property in RatingView and the "review" property in AddBookView. Aren't they essentially the same thing? If so, in RatingView, how does HStack knows for sure that the label variable is the "review" variable in AddBookView? They must be the same because there is no TextField/TextEditor for "label", only for "review".

How does Swift know?


I think you are confusing Rating with Review.

A review is a short critique. A rating is a grade based on a scale from 1 to 5.

So in this example below, you see the review gives an abbreviated synopsis of the story. The rating gives an idea of my enjoyment factor.

These are NOT the same thing in the program. When entering the rating, you have the option to provide a descriptive label. For example, if you use popcorn 🍿 as your book rating icon, your label might ask "How many pops for this book?"

If you used the thumbs up 👍🏼 icon, your label might ask "How many thumbs up?"

The label is different from the review.


Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.