// Playground - noun: a place where people can play
import UIKit
let colors = [
"Air Force Blue":(red: 93.0, green: 138.0, blue: 168.0),
"Bittersweet":(red: 254.0, green: 111.0, blue: 94.0),
"Canary Yellow":(red: 255.0, green: 239.0, blue: 0.0)
]
for (colorName,rgbColor) in colors {
var color = UIColor(red: rgbColor.red, green: rgbColor.green, blue: rgbColor.blue, alpha:1.0)
}
-----------------------
xcode 6.1
Playground execution failed: <EXPR>:19:24: error: extra argument 'green' in call
UIColor 初始化参数直接写值没问题,传入参数就报错
我测了下也是编不过, 要加强制类型转换CGFloat,并且UIcolor的范围是0-1.0,所以要除255
在没有上下文的环境下,目测这句话没有错。
请尝试:
1)最好升级至xcode6.1
2)重新启动xcode
3)确认这句代码的上下文没有问题(如colorStripe,vred,vgreen,vblue这些量的定义没有问题)