以x code 6.1.1斯威夫特数组索引造成问题 [英] Swift Array causing indexing issues in Xcode 6.1.1

查看:97
本文介绍了以x code 6.1.1斯威夫特数组索引造成问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我的应用程序,我创建了一个结构来存储工作组名称,字体值。

For my app, I've created a Struct to store team names, and font values.

该阵列'团队'包含的20个不同项目的字典。

The array 'teams' contains a dictionary of 20 different entries.

举例code

struct TeamInfoLibrary {
var teams = [
    [
        "name": "Arsenal",
        "stadiumImage": "",
        "teamColor": ["red": 239, "green": 1, "blue": 7, "alpha": 1.0],
        "fontColor": ["red": 255, "green": 255, "blue": 255, "alpha": 1.0]
    ],
    [
        "name": "Aston Villa",
        "stadiumImage": "",
        "teamColor": ["red": 148, "green": 190, "blue": 229, "alpha": 1.0],
        "fontColor": ["red": 122, "green": 0, "blue": 60, "alpha": 1.0]
    ],

/// Plus 18 more entries 

] ///close dictionary

}

一旦阵列获得超过3/4的字典项,X code似乎被无限期地索引,不会让我生成项目。没有任何错误,它只是似乎冻结和永远困索引项目。

Once the array gets over 3/4 dictionary entries, Xcode seems to be indexing indefinitely and will not let me build the project. There are no errors, it simply seems to freeze and be forever stuck indexing the project.

任何帮助将是AP preciated。展望这里有一些建议,它可以在X code进行bug,但似乎没有任何解决问题。

Any help would be appreciated. Looking here there are a few suggestions that it could be a bug in Xcode, but nothing seems to fix the issue.

推荐答案

斯威夫特有困难推断你的结构类型。给它一个类型给它一些帮助:

Swift is having difficulty inferring the type of your structure. Give it some help by giving it a type:

var teams: [[String:AnyObject]] = [
    [
        "name": "Arsenal",
        "stadiumImage": "",
        "teamColor": ["red": 239, "green": 1, "blue": 7, "alpha": 1.0],
        "fontColor": ["red": 255, "green": 255, "blue": 255, "alpha": 1.0]
    ],
    ...

这篇关于以x code 6.1.1斯威夫特数组索引造成问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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