this question could be a possibile duplicate. I've deleted and re asking the same question only to provide an answer that could help others to fix this issue
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))