更新到xcode 8 beta 6后,我收到错误
无法将类型'() - > Void'的值指定为'(() - > Void'!'
在以下func块,第三行:
// Button sub-class
public class SCLButton: UIButton {
var actionType = SCLActionType.none
var target:AnyObject!
var selector:Selector!
var action:(()->Void)!
public init() {
super.init(frame: CGRect.zero)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder:aDecoder)
}
override public init(frame:CGRect) {
super.init(frame:frame)
}
// required public init?(coder aDecoder: NSCoder) {
// fatalError("init(coder:) has not been implemented")
// }
}
public func addButton(_ title:String, action:()->Void)->SCLButton {
let btn = addButton(title)
btn.actionType = SCLActionType.closure
btn.action …Run Code Online (Sandbox Code Playgroud)