-2
XCode已更新並帶有新的Swift更新。XCode 6.3 Swift可轉換錯誤
我有這樣的代碼:
// load new tappable from file and place it on top of the screen beyond of sight
tappable05 = CCBReader.load("Tappable") as Tappable
tappable05.position = ccp(pipeSlim05.contentSize.width * 0.5,
pipeSlim05.contentSize.height * 1.03)
tappable05.scale = 1.2
//randomize tappable color
tappable05.setRandomColor()
// setup zOrder
tappable05.zOrder = DrawingOrder.DrawingOrderTappable.rawValue
// add new tappable to scene
pipeSlim05.addChild(tappable05)
而且我得到這個錯誤:
CCNode! is not convertible to 'Tappable;' dod you mean to use 'as!'
是的。 Swift 1.2(在Xcode 6.3中)的新功能現在需要'as!'。你有沒有嘗試將它改爲'as!可打字嗎? – vacawama
夥計使用他們包括的轉換器。它會解決所有這些問題。 – Rob