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

1

14

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.

Simpson answered 27/8, 2015 at 7:11 Comment(1)
Array(dic.values) is correct. Did you try it?Aldwon
T
23

Like this:

var dic: [String: String] = Dictionary<String, String>(minimumCapacity: 8)
let values: [String] = [String](dic.values)
Thessalonians answered 27/8, 2015 at 7:22 Comment(1)
Or just let values = Array(dic.values).Aldwon

© 2022 - 2024 — McMap. All rights reserved.