windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Swift extend UIView to return calling type

Asked By: Anonymous

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


Solution

Answered By: Anonymous

Return Self as the type:

func withCleanBg() -> Self {

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno