使用Xcode 6 GM种子我的代码完成已停止工作.它前几天正在工作.我试图让unwindwind segue工作.我制作了一个Objc头文件,并将其指定为Swift类的头文件.
此时,我使用Objective-c项目完成代码.但是,不是Swift项目.
我尝试重新启动Xcode,制作一个新的空项目.
为什么这不起作用?我可以在String上使用array.contains()但它不适用于Object.
var array = ["A", "B", "C"]
array.contains("A") // True
class Dog {
    var age = 1
}
var dogs = [Dog(), Dog(), Dog()]
var sparky = Dog()
dogs.contains(sparky) // Error Cannot convert value of type 'Dog' to expected argument type '@noescape (Dog) throws -> Bool
我想调用一个函数,而不是使用带有UIAlertAction的闭包。是否可以获取对拥有UIAlertAction的UIAlertController的引用?
alert = UIAlertController(title: "City", message: "Enter a city name", preferredStyle: UIAlertControllerStyle.Alert)
UIAlertActionStyle.Default, handler: okAlert)
//...
func okAlert(action: UIAlertAction) {
    // Get to alert here from action?
}