在XCode 6.2中,我有一个Swift项目,其中一个主对象(“Backbone”)创建带有指向Backbone的指针的子对象:
class Backbone
{
let logManager: QCLogManager!
let cloudJobManager: CloudJobManager!
...
init() {
logManager = QCLogManager(backbone: self)
cloudJobManager = CloudJobManager(backbone: self)
...
}
它非常好用。但是,在XCode 6.3中,init()
中的每一行现在都给出错误:
在初始化所有存储的属性之前使用'self'。
这似乎是一个相当无益的编译器限制。为什么会改变?我现在应该怎么做呢?
答案 0 :(得分:1)
body{
background:url(blurbubble.jpg) no-repeat;
background-size: 100%;
}
.list-group{
width: 200px;
}
.searchcustomer{
margin-top:51px;
}
.bs-example{
margin: 20px;
}
thead, tbody { display: block; }
tbody {
width:500px;
height: 100px; /* Just for the demo */
overflow-y: auto; /* Trigger vertical scroll */
overflow-x: hidden; /* Hide the horizontal scroll */
}
.table-responsive{
max-width: 1200px;
margin-top:-220px;
margin-left:200px;
max-width: auto;
}
如果不需要let logManager: QCLogManager!
let cloudJobManager: CloudJobManager!
,请更改为let
var
答案 1 :(得分:0)
您可能需要在Backbone
和QCLogManager
中创建类型为CloudJobManager
的属性,并在初始化BackBone类的所有商店属性后设置该属性。
class Backbone
{
let logManager: QCLogManager!
let cloudJobManager: CloudJobManager!
...
init() {
logManager = QCLogManager()
cloudJobManager = CloudJobManager()
...
logManager.backBone = self
cloudJobManager.backBone = self
}