|
So I've been exploring how we could average ratings if we were using this app in a library or classroom. I want to look at book titles, add a count button but give an average rating. Any ideas? I've failed all day. Is this something I will learn as I continue in this course? |
|
Karen doesn't give herself credit:
Please! If you've tried all day, then I'd say you've been learning, not failing. I have written elsewhere about eating elephants. @twoStraws is building up your skills; you may be jumping ahead of yourself, but let's consider your question. My approach is to look at the entire elephant, and decide which part to eat first. Somewhere in your application you have a collection (array) of Book objects. LOTS of books. This is the elephant. Now you might have a smaller subselection such as Mysteries, or Horror. This is a smaller piece, but is still a collection. Now let's cut this section up into bite-sized pieces!
If you systematically break your big problems into smaller problems, you'll take huge steps forward in solving your upcoming challenges. Keep coding!Please return and share your code. Let us know if this helped or not. |
|
You are too kind. Thank you. I am not wanting to average genres, which I think I could do... (maybe)... I want to average books with the same title. For instance, wouldn't it be nice if my review for The Giver and your review for The Giver could be averaged in the ContentView list, but when I go to the Detail View for The Giver, my stars are averaged (I think I'd have to round) and we could have mutliple reviews there for a book of the same title? |
|
I followed the recipe above. But instead of defining a subcollection as a genre, I defined it as a book title. Try this in playgrounds.
|
|
Oh my goodness... as I went ahead and dived into Project12, I really felt like I was starting to get a few more options to try... your code is so simple to follow and makes sense... I have to work through the last few lines, but I really appreciate this. Thank you - Thank you! |
|
Pardon the change in topic, but am a bit star struck.... THE Dallas Diamonds, four time national champions, Pro Bowl Quarterback? That Karen??!? PS: Just added The Giver to my Libby 'must read next' list! |
|
In the words of Dani Rojas, "Football is life!" ... thanks for taking so much time for me. I'm your fan! You won't be disappointed in that book! |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
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.
Link copied to your pasteboard.