I have a dictionary containing UIColor objects hashed with enum, ColorScheme :
var colorsForColorScheme: [ColorScheme : UIColor] = ...
I would like to be able to extract an array from all the colors (values) contained in this dictionary. I thought I could use the values property, which is used when iterating over dictionary values ( for value in dictionary.values {...} ), but this returns an error:
let colors: [UIColor] = colorsForColorSchemes.values ~~~~~~~~~~~~~~~~~~~~~^~~~~~~ 'LazyBidrectionalCollection<MapCollectionView<Dictionary<ColorScheme, UIColor>, UIColor>>' is not convertible to 'UIColor'
Instead of returning an Array value, the values method seems to return a more abstract type of collection. Is there a way to get an Array containing dictionary values without highlighting them in a for-in loop?
dictionary arrays swift
Stuart Nov 18 '14 at 6:41 2014-11-18 06:41
source share