我刚刚将xcode更新为6.3.1。问题是自Swift 1.2起我收到了这个奇怪的错误消息。我收到这种错误消息
/Users/MNurdin/Documents/iOS/xxxxx/Library/SideBar.swift:32:15: Property 'self.originView' not initialized at super.init call /Users/MNurdin/Documents/iOS/xxxxx/Library/SideBar.swift:38:20: Immutable value 'self.originView' may only be initialized once
在此代码上
let originView:UIView? override init() { super.init() //error here } init(sourceView:UIView, menuItems:Array<String>){ super.init() //error here originView = sourceView //error here
在调用super.init任何init方法之前,必须初始化所有属性
super.init
因此,在调用super.init()之前先进行更改
originView = sourceView //error here
例外: