title: Get UIView rotation angle properly in swift
body: <p>I'm able to rotate and get rotates angle but it was not satisfies my need.
  I've created view and rotation button as shown in below. 
  <a href="https://i.stack.imgur.com/gB11x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gB11x.png" alt="enter image description here"></a></p>
  
  <p>I'm able to rotate 90 degress on each tap on rotate button as below.<a href="https://i.stack.imgur.com/q7INu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q7INu.png" alt="enter image description here"></a></p>
  
  <p>Now i want to print rotation angle of a view interms of degrees 0, 90, 180, 270, 360 should print as 0, and then same as 90, 180, 270, 0 has to print in place of 360..repeat based on direction.</p>
  
  <p>Here is the code which i used to create below.</p>
  
  <pre><code>    @IBOutlet weak var myView: UIView!
  @IBAction func rotateBtn(_ sender: Any) {
      myView.transform = myView.transform.rotated(by: .pi/2)
       getRotateAngle()
  }
  func getRotateAngle(){
      //This is just to print rotation angle of a view
      let radians = atan2(myView.transform.b, myView.transform.a)
      let degrees = radians * 180 / .pi
      print("Degrees:: \(degrees)")
  }
  </code></pre>
  
  <p>And it's printing in console like below screen.
  <a href="https://i.stack.imgur.com/vQZhz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vQZhz.png" alt="enter image description here"></a></p>
  
  <p>How can i got 0, 90, 180, 270, 0, 90, 180, 270, 0 degrees of a view can somebody please suggest. Thanks in advance.</p>