“数组”不可用:请从你懒散序列构建一个数组:数组(...) [英] 'array' is unavailable: please construct an Array from your lazy sequence: Array(...)

查看:140
本文介绍了“数组”不可用:请从你懒散序列构建一个数组:数组(...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新了X code至9测试版,我有固定我的code至2迅速

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

现在,我有一个错误'阵'是不可用:请从你懒散序列构建一个数组:数组(......)。以下code

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

我应该如何写这个code来代替?

How should I write instead of this code?

Array(dic.values)

这code是正确的?

我找不到苹果的约LazyMapCollection文件。谢谢你。

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

推荐答案

这样的:

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

这篇关于“数组”不可用:请从你懒散序列构建一个数组:数组(...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆