This code creating UISlider and turn 90 degrees anticlockwise with -M_PI_2 in another context for another UIView we could use the same code with M_PI_2 for turning 90 degrees clockwise. I found this easy and useful, worth note.
var slider = UISlider()
let w = view.bounds.width
slider.bounds.size.width = w
slider.center = CGPoint(x: w/2, y: w/2)
slider.transform = CGAffineTransformMakeRotation(CGFloat(-M_PI_2))