-5
在Objective-C有可能那樣做:Swift如何獲取字典中鍵值的數量?
NSString *sectionTitle = [animalSectionTitles objectAtIndex:section];
NSArray *sectionAnimals = [animals objectForKey:sectionTitle];
return [sectionAnimals count];
如果動物是[字符串:字符串]字典 但是在斯威夫特3沒有對字典的方法objectForKey(String:)
或任何類似的或者我可以「找不到它
使用'動物[sectionTitle]' – Venkat
你試過'動物[sectionTitle]'? – TawaNicolas
請閱讀:[Swift Language Guide:Swift Tour](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097- CH2-ID1)。即使在Objective-C中,您也可以(也應該)使用密鑰和索引訂閱。 – vadian