WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

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.

   

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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

Reply to this topic…

You need to create an account or log in to reply.

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.