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?

2      

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.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

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.