【发布时间】:2015-09-11 20:54:45
【问题描述】:
我回顾了我在Xcode 7.0 beta 3 (7A152u) 中所做的一个项目,我使用以下extension 将CGPoint 初始化程序添加到float2。 (下面的代码与 WWDC2015 演示项目 DemoBots 中使用的代码相同) 早在 7 月下旬这工作正常,但现在使用 Xcode 7.0 GM (7A218) 我收到错误:
TEST.swift:32:11: 'self' used before all stored properties are initialized
我查看了各种发行说明,但找不到任何相关内容,谁能帮助我或指出正确的方向,说明为什么现在失败以及如何解决?
// Extend `float2` to add an initializer from a `CGPoint`.
extension float2 {
// MARK: Initialization
/// Initialize with a `CGPoint` type.
init(_ point: CGPoint) {
x = Float(point.x) // << Above Error Here
y = Float(point.y) // << Above Error Here
}
}
【问题讨论】:
标签: swift