在方法中藥調(diào)用 self = self.init,報(bào)錯(cuò)信息是:Cannot assign to value:'self'is immutable代碼如下:class Node:NSObject{var parentID:Int?//父節(jié)點(diǎn)的id,如果為-1表示該節(jié)點(diǎn)為根節(jié)點(diǎn)var nodeID:Int?//本節(jié)點(diǎn)的idvar name:NSString?//本節(jié)點(diǎn)的名稱var depth:Int?//本節(jié)點(diǎn)的深度var expand:Bool?//該節(jié)點(diǎn)是否處于展開狀態(tài)//快速實(shí)例化該對(duì)象模型func initWithParentID(parentID:Int,nodeID:Int,name:NSString,depth:Int,expand:Bool) -> Self{ self = self.init return self }
swift新手請(qǐng)教,我在swift中調(diào)用self.init,報(bào)錯(cuò)了,怎么回事?
慕碼人2483693
2018-08-14 10:16:55