I have a dictionary in this basic setup:
->Root
--->Monday
------->Date 1
------->Date 2
--->Tuesday
------->Date 1
------->Date 2
--->Wednesday
------->Date 1
------->Date 2
--->Thursday
------->Date 1
------->Date 2
--->Friday
------->Date 1
------->Date 2
How can I find, from this dictionary, the earliest date from all of these values?
Assuming that the date is changing the current value is ( [NSDate date]) what would I need to do to find loop through each day, the current day being the first to loop through, and find the closest date to the current date.
I hope I have made this clear. Thanks
Do you have a root dictionary, with Day-of-the-week keys. Each day of the week points to an object which is a dictionary of ‘Date 1’ and ‘Date 2’ (what I’m saying does not have to be exactly what you have, this works for any structures). I’m going to use ‘fast enumeration’ but block enumeration can be used too.
Start off by creating a NSDate object and set it to ‘now’.
at the end date will be the earliest date.