add new initializer for transform rotation to CGAffineTransform extension - #395
Conversation
| init(rotationAngle: CGFloat) { | ||
| self.init(rotationByRadians: rotationAngle) | ||
| } |
There was a problem hiding this comment.
I was a bit confused by this and just looked into it. Apparently AffineTransform is a Foundation (only?) type that has this rotationByRadians initializer. CGAffineTransform, which AFAIK is what is actually used by UIView in UIKit, appears to have different initializers.
Our CGAffineTransform type is copied from Foundation's AffineTransform type, so it's a bit of a weird mix of both. I'm not sure what implications this has for code re-use. It's probably "close-enough" API-wise that we can use it as is, especially given this new extension. But we should be aware of the differences
There was a problem hiding this comment.
Got it, thanks for the info. I was confused as well tbh. Do you think our CGAffineTransform needs to be refactored because of this?
There was a problem hiding this comment.
I think we actually intend to create a real CGAffineTransform type here. So I would suggest to actually rename the rotationByRadians initializer to be called rotationAngle, instead of the change in this PR.
It would be a bit weird to see both in code completion, and then not be actually source compatible if you choose the wrong one.
Type of change: feature
Motivation (current vs expected behavior)
Add
public init(rotationAngle: CGFloat)Please check if the PR fulfills these requirements