Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'array' is unavailable: please construct an Array from your lazy sequence: Array(...)

I updated Xcode to 9 beta, I have fixed my code to swift 2.

Now, I have an error "'array' is unavailable: please construct an Array from your lazy sequence: Array(...)" on the following code.

var dic: [String: String] = Dictionary<String, String>(minimumCapacity: 8)
dic.values.array// error

How should I write instead of this code?

Array(dic.values)

This code is correct?

I could not find the Apple's document about LazyMapCollection. Thank you.

like image 514
Mitsuaki Ishimoto Avatar asked Aug 27 '15 07:08

Mitsuaki Ishimoto


1 Answers

Like this:

var dic: [String: String] = Dictionary<String, String>(minimumCapacity: 8)
let values: [String] = [String](dic.values)
like image 153
Aderstedt Avatar answered Oct 04 '22 15:10

Aderstedt