Closed zakbarlow1995 closed 4 years ago
Apart from improved generality this change also prevents false assumptions arising from the (subclass) name itself, for example:
let imageView = UIImageView(contentMode: .scaleAspectFit)
let aspectFitImageView = AspectFitImageView()
func modifyImages() {
imageView.contentMode = .scaleAspectFill
aspectFitImageView.contentMode = .scaleAspectFill
}
Once modifyImages()
is called, the AspectFitImageView
instance has a misnomer in both class and (likely) variable name, whereas someone isn't likely to assume the contentMode of a standard UIImageView
.
I'm quite hesitant on accepting UIImageView changes for this library. None of the solutions I see, including mine, are that great in my opinion.
Added UIImageView convenience initialiser to generalise AspectFitImageView & AspectFillImageView UIImageView subclasses (AspectFitImageView.swift removed).
This matches the UIKit extension convention for custom initialisers present in LBTATools (UIButton.swift, UILabel.swift, UIStackView.swift, UITextField+Tools.swift, and UITextView.swift).