I showing a subview which contains the a subview, an image and a message. I need to remove this subview after a particular duration/time (5 seconds) in swift. The code for the subviews is as follows:
     var HideView = UIView (frame: CGRectMake(0 , 0, 320, 480));
    HideView.backgroundColor = UIColor(red:0.0, green:0.0, blue:0.0, alpha:0.6);
    var ErrorView = UIView (frame: CGRectMake(0, 40, 320, 70));
    ErrorView.backgroundColor = UIColor(red:0.8, green:0.376, blue:0.094, alpha:1.0);
    ErrorView.clipsToBounds = true;
    ErrorView.layer.shouldRasterize = true
    HideView.addSubview(ErrorView)
    var ErrorImageView = UIImageView(frame: CGRectMake(5, 5, 30, 30));
    var ErrorImage = UIImage(named: "error_icon_white.pdf");
    ErrorImageView.image = ErrorImage;
    ErrorView.addSubview(ErrorImageView)
    var ErrorLabel = UILabel (frame: CGRectMake(50, 0, 270, 70));
    ErrorLabel.backgroundColor = UIColor.clearColor();
    ErrorLabel.textColor = UIColor.whiteColor()
    ErrorLabel.font =  UIFont(name: "Gotham", size: 1)
    ErrorLabel.numberOfLines = 3
    var errmsg = "Hello world"
    ErrorLabel.text = errmsg;
    ErrorView.addSubview(ErrorLabel)
    self.view.addSubview(HideView);
Can I achieve this requirement? If Yes then how? Thanks in advance.
 
    