升级到 xcode 7 后代码出现问题
Issue with code after upgrade to xcode 7
我的这段代码在 xcode6 上运行良好,升级到 xcode7 后出现以下错误
var levels:[(
level: Int,
activeButtons: [UIButton],
numberOfButtons: Int,
timer: [Int],
blinks: [Int],
score: [Int],
subIndex: Int,
image: String,
bunce : Int,
speed: Double
)] = []
levels.append(level:1, activeButtons:[], numberOfButtons:2, timer:[0,10,8,5],blinks:[0,2,3,4], score:[0,100,150,200], subIndex: 0, image: "blue", bunce: 150, speed:0.6)
我得到的错误是
Cannot invoke 'append' with an argument list of type '(level: Int, activeButtons: [UIButton], numberOfButtons: Int, timer: [Int], blinks: [Int], score: [Int], subIndex: Int, image: String, bunce: Int, speed: Double)'
1. Expected an argument list of type '(Element)'
您要添加的元素周围需要另一个大括号...
var levels:[(
level: Int,
activeButtons: [UIButton],
numberOfButtons: Int,
timer: [Int],
blinks: [Int],
score: [Int],
subIndex: Int,
image: String,
bunce : Int,
speed: Double
)] = []
levels.append((level:1, activeButtons:[], numberOfButtons:2, timer:[0,10,8,5],blinks:[0,2,3,4], score:[0,100,150,200], subIndex: 0, image: "blue", bunce: 150, speed:0.6))
我的这段代码在 xcode6 上运行良好,升级到 xcode7 后出现以下错误
var levels:[(
level: Int,
activeButtons: [UIButton],
numberOfButtons: Int,
timer: [Int],
blinks: [Int],
score: [Int],
subIndex: Int,
image: String,
bunce : Int,
speed: Double
)] = []
levels.append(level:1, activeButtons:[], numberOfButtons:2, timer:[0,10,8,5],blinks:[0,2,3,4], score:[0,100,150,200], subIndex: 0, image: "blue", bunce: 150, speed:0.6)
我得到的错误是
Cannot invoke 'append' with an argument list of type '(level: Int, activeButtons: [UIButton], numberOfButtons: Int, timer: [Int], blinks: [Int], score: [Int], subIndex: Int, image: String, bunce: Int, speed: Double)'
1. Expected an argument list of type '(Element)'
您要添加的元素周围需要另一个大括号...
var levels:[(
level: Int,
activeButtons: [UIButton],
numberOfButtons: Int,
timer: [Int],
blinks: [Int],
score: [Int],
subIndex: Int,
image: String,
bunce : Int,
speed: Double
)] = []
levels.append((level:1, activeButtons:[], numberOfButtons:2, timer:[0,10,8,5],blinks:[0,2,3,4], score:[0,100,150,200], subIndex: 0, image: "blue", bunce: 150, speed:0.6))