I have few lines of code that put a north icon on the map. This icon moves around a bit, and must be angle toward north if the map is rotated.
But in order to make this work, I had to add a line of code that I don't understand.
northIcon.transform = CGAffineTransform.identity // why do I need this line?
northIcon.frame.origin.x = insets.left + 8
northIcon.frame.origin.y = insets.top + 25
northIcon.transform = CGAffineTransform(rotationAngle: site.angle)
A view's frame property is only defined if the transform is the identity transform. When it's not, the results of reading or manipulating the frame property are "undefined."
You can use the center property even when you've set the transform to a non-identity value though.