here you just miss one thing changes it to 0.
0
Your code
border.layer.position = CGPoint(x: border.frame.origin.x, y: border.layer.position.y)
My Code
border.layer.position = CGPoint(x: 0, y: border.layer.position.y)
replace your code with mine.