-1
저는 프로그래밍 할 때 새로운 종류입니다. 가이드 단계를 따라 가면서 모든 것이 잘 작동했지만,이 시점에서 나는 막혔습니다. 나는 모든 것을 확인했지만, 그것은 Expected expressions in list of expressions
, Expected ',' separator
및 '()' is not convertible to 'Orientation'
스위프트 : 예상 ','실패?
import Foundation
import SpriteKit
let NumOrientations: UInt32 = 4
enum Orientation: Int, Printable {
case Zero = 0, Ninety, OneEighty, TwoSeventy
var description: String {
switch self {
case .Zero:
return "0"
case .Ninety:
return "90"
case .OneEighty:
return "180"
case .TwoSeventy:
return "270"
}
}
static func random() -> Orientation {
return Orientation.fromRaw(<#Int#>(arc4random_uniform(NumOrientations)))
}
// #1
static func rotate(orientation:Orientation, clockwise: Bool) -> Orientation {
var rotated = orientation.toRaw() + (clockwise ? 1 : -1)
if rotated > Orientation.TwoSeventy.toRaw() {
rotated = Orientation.Zero.toRaw()
} else if rotated < 0 {
rotated = Orientation.TwoSeventy.toRaw()
}
return Orientation.fromRaw(rotated)!
}
}
어떤 도움으로, 실패를 같은 내가 그것을 해결하고 실패와 함께 올 것이다 구축을 시도 할 때마다이라고 말했다?
내가 스위프트 모르는
당신의rotate
기능 마찬가지로주 그러나이 선은 분명히 문제입니다 :'Orientation.fromRaw (<#Int#> (arc4random_uniform (NumOrientations)))'를 반환하십시오. – rmaddy
오류가 발생한 줄을 말하면 도움이 될 것입니다. –
<#Int#>은 IDE에서 자동 완성을 돕는 텍스트 Xcode 삽입물입니다. 일반적으로 탭을 클릭하면 해당 텍스트 블록을 선택하고 (Int라고 말하면) 사용자가 입력합니다. 확실히 제거해야합니다. – rickerbh