Q:

How do I assign multiple UI's to a parameter, such as both UILabels and UIButtons?

I am trying to create a function that flips a UILabel, UIButton, etc. 180 degrees so that it is upside down. My problem is that I cannot find a way to give the function a parameter that is assigned to UILabels, UIButtons, etc.
I have tried using "Any" to assign to my parameter, but Any does not have the method transform.
Here is my code so far without the parameter having anything assigned:
func rotate180(object: ) {

object.transform = CGAffineTransformMakeRotation(rotationAngle: 3.14)

{

A:

You could also implement this as an extension:
extension UIView {
    func rotate180() {
        self.transform = CGAffineTransform(rotationAngle: 3.14)
    }
}

Usage:
myButton.rotate180()
myLabel.rotate180()
myView.rotate180()

