this question可能是一个可能的副本。我已删除并重新提出相同的问题,仅提供可帮助其他人解决此问题的答案
collision.addBoundary(withIdentifier: "barriera" as NSCopying, from: CGPoint(0, self.view.frame.height/2), to: CGPoint(self.view.frame.width, self.view.frame.height/2))

答案 0 :(得分:-1)
collision.addBoundary(withIdentifier: "barriera" as NSCopying, from: CGPoint(x: 0, y: self.view.frame.height/2), to: CGPoint(x: self.view.frame.width, y: self.view.frame.height/2))

事实上我在上面的问题中所遗漏的只有x和y