0

Here is my code which was working on Swift 1.2, but doesn't work on Swift 2 :

var dictThemesNamesObjekts = [String:[Int:Int]]()
self.objekts = dictThemesNamesObjekts
let keysArray: Array = self.objekts.keys.array

On the third line, Xcode displays an this error: "array is unvailable, please construct an array from your lazy sequence".

Do you have an idea how to correct this error?

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
Zipette
  • 79
  • 7
  • Possible duplicate of [Array from dictionary keys in swift](http://stackoverflow.com/questions/26386093/array-from-dictionary-keys-in-swift) – Eric Aya Jan 06 '16 at 09:58

1 Answers1

0
var aDictionary = [String : [Int : Int]]()
let array = Array(aDictionary.keys)

or, in my opinion, nicer:

let array = [String](aDictionary.keys)
Michael Dorner
  • 17,587
  • 13
  • 87
  • 117