I am trying to work with a specific data layout. We use a plist file which is setup in the following way:
Root (Dictionary):
- 1.1 (Array)
-- Item 0 (Dictionary)
--- Title
--- Icon
-- Item 1 (Dictionary)
--- Title
--- Icon
- 1.2 (Array)
-- Item 0 (Dictionary)
--- Title
--- Icon
This information from the plist is parsed into a Dictionary which logs out as follows:
{
"1.0" = (
{
detail = "Detail 0";
icon = "Pull to Refresh";
title = "Item 0";
},
{
detail = "More easily refresh a subscription or playlist.";
icon = "Pull to Refresh";
title = "Pull to Refresh";
}
);
"1.1" = (
{
detail = "Create custom stations of your favorite podcasts.";
icon = Stations;
title = "Custom Stations";
}
);
}
What I am trying to find out is the count of items within the sub Arrays. For example there are two sub arrays one for 1.1 and one for 1.2. I am looking to get the count of dictionaires from with those arrays?
Is there a quick way to access that. I have tried to complete a for loop and count them but I am getting NSCFString errors as if I have the data incorrect?
Since you already mentioned trying a for loop yourself I don't know if this is actually the kind of answer you are looking for, but for this very specific purpose (i.e. you're certain that the input dictionaries always have the kind of structure you described) something along these lines should do the trick: