This works:
var aArray = [ Int ]()
let aRange = ( 0 ... 5 )
aArray.appendContentsOf( aRange )
and produces [0, 1, 2, 3, 4, 5] for aArray.
This however:
enum Dog {
case Snoopy
case Lassie
case Scooby
}
let dogRange = [ Dog.Snoopy : ( 0 ... 5 ), Dog.Lassie : ( 6 ... 11 ), Dog.Scooby : ( 12 ... 17 ) ]
var dArray = [ Int ]()
dArray.appendContentsOf( dogRange[ Dog.Snoopy ] )
throws the error expected an argument list of type '(C)' in Playground and Cannot call value of non-function type '[Dog : ClosedInterval]' in a project in Xcode.
dogRange[ Dog.Snoopy ]
produces 0..<6 in Playground as expected. I can't figure out how to append a Range from a Dictionary as illustrated into an Array. Is this possible, and if so, how?
Many thanks in advance!