I want to extend base class (UIView) where I work on that object and return the calling object with correct type
extension UIView {
func withCleanBg() -> UIView {
self.backgroundColor = .clear
return self;
}
}
For example if I call let btn:UIButton = UIButton().withCleanBg() I want the btn to stay UIButton after calling the extension and not to get UpCasted.
I want this to chain function calls like
UIButton().withCleanBg().withFillInParent() and so on