В настоящее время я учусь в режиме игровых площадок (одиночный просмотр), и я хочу переместить CAShapeLayer пальцем, но в настоящее время он работает только с задержкой. Как я могу решить проблему?
небольшой пример переменной в моем перечислении
var layer: CAShapeLayer{
switch self {
case .rectangle:
let rectangle = UIBezierPath(rect: CGRect(x: 60, y: 250, width: 250, height: 350))
let rect = CAShapeLayer()
rect.frame = CGRect(x: 0, y: 0, width: 250, height: 350)
rect.path = rectangle.cgPath
rect.fillColor = UIColor.yellow.cgColor
return rect
и код метода касания
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let location = touches.first?.location(in: self.view) else {return}
currentlayer?.position = location
}