NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

SOLVED: Project 1 - challenge task 3.

Forums > 100 Days of Swift

Hi guys,

I've been trying to wrap my head around one of Paul's hints saying:

"So, we can use indexPath.row to set the selectedPictureNumber property in DetailViewController – just make sure you add 1 to it so that it counts from 1 rather than 0."

Got totally lost with how I can use indexPath.row in DetailViewController without triggering the "Unresolved Identifier" error. What am I doing wrong?



You don't use indexPath.row in DetailViewController; you use it it ViewController's didSelectRowAt to set DetailViewController.selectedPictureNumber when you instantiate that controller.


Ok, thanks! For total pictures I used pictures.count - was I supposed to do it this way? Anyway, the code works, which makes my brain free for the rest of the day :D Thanks!


Well if it works the way you want it, it's okay. ;-)


Solved it also. Took some trying and figuring out, but once I had it I understood why. Also, I found that if I pulled up print(imageToLoad.count) in DetailedViewController I got an output of 12. Unsure why, possibly something to do with the Loops? So I called this .count from ViewController before passing it to DetailedViewController I hope this helps anyone, without giving away the full coded answer.


Did you get the soltuion? I also want to add the same feature in my kitchen related bsuiness wesbite. You can visit website of my kitchen Impression.


Hacking with Swift is sponsored by Fernando Olivares

SPONSORED Ever ask for help and your reviewer immediately notices issues you missed? Fernando Olivares is a 10-year veteran from Big Nerd Ranch and Lambda School who can help hone your app building skills, and he's just launched a new book that does just that – use the code "hacking" to save $5!

Buy the book

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

Not logged in

Log in

Link copied to your pasteboard.