없는 나는 다음과 같은 코드를 가지고 : 내가 원래 GCD: Dispatch After
을 냈다 내가 dispatch_after()
스위프트 dispatch_after 던지는 접두사 단항 연산자 오류
'^' is not a prefix unary operator
의 라인에 다음과 같은 메시지가 사용
import SpriteKit
import Foundation
class GameScene: SKScene {
var occupiedCoordinates: NSMutableArray = NSMutableArray()
func addShape() {
//...
shape.position = CGPoint(x:actualX, y:actualY)
self.occupiedCoordinates.addObject(NSValue(CGPoint:shape.position))
let halfDuration = random(min: CGFloat(0.5), max: CGFloat(5))
//...
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2*halfDuration), dispatch_get_main_queue(), ^{
self.occupiedCoordinates.removeObjectAtIndex(0)
});
}
}
어떤 아이디어가 문제 죠?
이 yiels '호출 할 수 없습니다 '*'형식의 인수 목록 (dispatch_time_t, dispatch_queue_t!, 0)' –
w로 모자는'halfDuration'의 타입입니까? – Antonio
현재 CGFloat .. –