TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Day 18 - Project 1, challenge "Picture X of Y"

Forums > 100 Days of Swift

Hello, could anyone please help me for this challenge?

https://www.hackingwithswift.com/read/1/7/wrap-up "Rather than show image names in the detail title bar, show “Picture X of Y”, where Y is the total number of images and X is the selected picture’s position in the array. Make sure you count from 1 rather than 0."

I am completely stuck on the last challenge. I've been trying to wrap my head around what to do for the past few days but I still don't understand how I could get the "count" and current index of array from ViewController to DetailViewController.

I've read the hints but the only thing I got from that was you're supposed to create var selectedPictureNumber and var totalPictures in DetailViewController's class.

Thanks in advance.

3      

Not sure if you're looking for an exact solution or a thought starter, so think about it this way. ViewController knows how many pictures you hqve and which array index/element is chosen. However, DetailViewControlelr needs to have that information to set it's title. So, doesn't ViewController already give DetailVewiController some information when the user selects an image from the table view? What else can ViewControlelr tell DetailViewController at that time? If you want to see my Solution, it's here

3      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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.