// // GeneralInfoPopUp.swift // GMERemittance // // Created by Sujal on 2/12/18. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. // import UIKit class PopUpGeneralInfo: UIViewController { var indexValue: Int = -1 var titleInfo: String? var message: String? @IBOutlet weak var iconTopConstraint: NSLayoutConstraint! @IBOutlet weak var labelPopUpTitle: UILabel! @IBOutlet weak var labelPopUpMessage: UILabel! @IBOutlet weak var buttonOk: UIButton! @IBOutlet weak var imageViewIcon: UIImageView! @IBOutlet weak var imageViewBackground: UIImageView! @IBOutlet weak var bgImageConstraint: NSLayoutConstraint! var inviteeName: String! override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.black.withAlphaComponent(0.7) self.showAnimate() switch indexValue { case 0: //KYC labelPopUpTitle.text = "Thank you for registering with GME!" labelPopUpTitle.textColor = UIColor.white//(hex:0xEC1C24) labelPopUpMessage.text = "Few more steps to experience the amazing world with GME. Please fill the kyc form." buttonOk.setTitle("Get Started", for: .normal) case 1: //Amendment labelPopUpTitle.text = "Thank you for contacting us." labelPopUpMessage.text = "We will assess your requirements and be in touch with you shortly." buttonOk.setTitle("Ok", for: .normal) case 2: //Feedback labelPopUpTitle.text = "Thank you for suggestions/ feedback." //labelPopUpTitle.textColor = UIColor(hex:0xEC1C24) labelPopUpMessage.text = "We are always seeking to make things better for our customers." buttonOk.setTitle("Ok", for: .normal) case 3: //Withdraw iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_wallet") labelPopUpTitle.text = "Withdraw Request" labelPopUpMessage.text = "We will assess your request and be in touch with you shortly." buttonOk.setTitle("Ok", for: .normal) case 4: //Track phase 1 iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "trackPopup0") labelPopUpTitle.text = "Send Money" labelPopUpMessage.text = "Your money transfer has been sent successfully and is under review." buttonOk.setTitle("Got it", for: .normal) buttonOk.setTitleColor(UIColor(hex:0xEC1C24), for: .normal) case 5: //Track phase 2 iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "trackPopup1") labelPopUpTitle.text = "In Progress" labelPopUpMessage.text = "Your money transfer is pending for verification." buttonOk.setTitle("Got it", for: .normal) buttonOk.setTitleColor(UIColor(hex:0xEC1C24), for: .normal) case 6: //Track phase 3 iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "trackPopup2") labelPopUpTitle.text = "Available" labelPopUpMessage.text = "Your money transfer is ready to be picked up at any GME agent location." buttonOk.setTitle("Got it", for: .normal) buttonOk.setTitleColor(UIColor(hex:0xEC1C24), for: .normal) case 7: //Track phase 4 iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "trackPopup3") labelPopUpTitle.text = "Received" labelPopUpMessage.text = "Your money transfer has been successfully received." buttonOk.setTitle("Got it", for: .normal) buttonOk.setTitleColor(UIColor(hex:0xEC1C24), for: .normal) case 8: // first transaction fee is free for home page iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_gift") labelPopUpTitle.text = "Your First Transfer Fees is Free" labelPopUpMessage.text = "Send Money to your loved ones without any hidden charge." buttonOk.setTitle("Got it", for: .normal) case 9: // first transaction fee is free for recipient form iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_gift") labelPopUpTitle.text = "Your First Transfer Fees is Free" labelPopUpMessage.text = "Send Money to your loved ones without any hidden charge." buttonOk.setTitle("Got it", for: .normal) case 10 : // Error message iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Error" labelPopUpMessage.text = message imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 11 : // Alert message iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_alert") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Validation error" labelPopUpMessage.text = message imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 12 : // Invitation iconTopConstraint.constant = iconTopConstraint.constant - 19.4 bgImageConstraint.constant = 300 imageViewIcon.image = UIImage(named: "ic_inviteGMELogo") labelPopUpTitle.text = "Invitation Successfully Send" labelPopUpMessage.text = "Your invitation has been successfully send to \(inviteeName!). You will receive GME bonus of 7000KRW in your GME wallet once the invitee perform the money transfer." buttonOk.setTitle("Ok", for: .normal) case 13 : // Verified Account iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_alert") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert!" labelPopUpMessage.text = "Your verification is still in progress." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 14 : // Verified Account iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_alert") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert!" labelPopUpMessage.text = "Your verification is still in progress." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 15 : // No internet iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_no-internet") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Whoops!" labelPopUpMessage.text = "No Internet connection found. 
Check your connection." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 16 : // Alert message for information iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_alert") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = titleInfo labelPopUpMessage.text = message imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 17: //Redeem reward iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "reward_congrats") labelPopUpTitle.text = "Congratulations" labelPopUpMessage.text = "We will contact you soon and visit you to deliver your reward." buttonOk.setTitle("Ok", for: .normal) buttonOk.setTitleColor(UIColor(hex: 0xec1c24), for: .normal) case 18:// general inquiry labelPopUpTitle.text = "Thank you for contacting us." labelPopUpMessage.text = "We will assess your requirements and be in touch with you shortly." buttonOk.setTitle("Ok", for: .normal) case 19 : // Error message iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Error" labelPopUpMessage.text = message imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 20 : //ConnectionTimeOut iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 21: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_no-internet") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Whoops!" labelPopUpMessage.text = "No Internet connection found. 
Check your connection." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 22: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 23: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Error" labelPopUpMessage.text = message imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 24: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 25: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 26: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 27: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 28: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 29: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 30: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 31: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 32: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 33: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 34: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 35: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 36: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 37: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 38: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 39: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 40: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 41: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 42: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 43: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 44: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 45: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) case 46: iconTopConstraint.constant = iconTopConstraint.constant - 19.4 imageViewIcon.image = UIImage(named: "ic_error") labelPopUpTitle.textColor = UIColor(red:0.93, green:0.11, blue:0.14, alpha:1.0) labelPopUpTitle.text = "Alert" labelPopUpMessage.text = "Connection timeout. Please try again." imageViewBackground.image = nil buttonOk.setTitle("Ok", for: .normal) default: return } } @IBAction func dismissPopUp(_ sender: Any) { let appDelegate = UIApplication.shared.delegate as! AppDelegate switch indexValue { case 0: self.navigationController?.navigationBar.isHidden = false self.removeAnimate() case 8: appDelegate.firstTranscationStatusForHome = false self.removeAnimate() self.removeFromParentViewController() case 9: appDelegate.firstTranscationStatusForProfileForm = false self.removeAnimate() self.removeFromParentViewController() case 1, 2, 3, 14, 17, 18, 19: //Support id = 1,2 & Withdraw id = 3 self.removeAnimate() showHomeScreen() case 12: self.removeAnimate() self.removeFromParentViewController() // TODO: Pop to invite view create navigation issue in earned view // - task GMEA-1061 // self.navigationController?.popToRootViewController(animated: true) /* self.dismiss(animated: true, completion: nil) let viewControllers: [UIViewController] = self.navigationController!.viewControllers as [UIViewController] self.navigationController!.popToViewController(viewControllers[viewControllers.count - 3], animated: true)*/ case 4, 5, 6, 7, 10, 11, 13, 15, 16: self.removeAnimate() self.removeFromParentViewController() case 20: self.removeAnimate() self.removeFromParentViewController() PaymentMethodViewController.paymentMethodConnectionCheck = 0 case 21: self.removeAnimate() self.removeFromParentViewController() KYCDocumentsUploadViewController.internetListener = 0 case 22: self.removeAnimate() self.removeFromParentViewController() KYCDocumentsUploadViewController.timeOutListener = 0 case 23: self.removeAnimate() self.removeFromParentViewController() KYCDocumentsUploadViewController.apiRequestListener = 0 case 24: self.removeAnimate() self.removeFromParentViewController() PaymentMethodViewController.paymentMethodConnectionCheck = 0 case 25: self.removeAnimate() self.removeFromParentViewController() RecipientTranscationViewController.recipientListViewControllerConnectionCheck = 0 case 26: self.removeAnimate() self.removeFromParentViewController() ExchangeRateMultipleCountryViewController.exchangeRateAgentConnectionCheck = 0 case 27: self.removeAnimate() self.removeFromParentViewController() // RecipientFormViewController.recipientConnectionTimeOutConnectionCheck = 0 case 28: self.removeAnimate() self.removeFromParentViewController() MyStoryViewController.socialFeedConnectionTimeOutCheck = 0 case 29: self.removeAnimate() self.removeFromParentViewController() NotificationViewController.notificationConnectionTimeOutCheck = 0 case 30: self.removeAnimate() self.removeFromParentViewController() TranscationStatementViewController.transactionConnectionTimeOutCheck = 0 case 31: self.removeAnimate() self.removeFromParentViewController() WalletViewController.walletConnectionTimeOutCheck = 0 case 32: self.removeAnimate() self.removeFromParentViewController() WalletTransactionListViewController.walletListConnectionTimeOutCheck = 0 case 33: self.removeAnimate() self.removeFromParentViewController() // self.removeAnimate() case 34: self.removeAnimate() self.removeFromParentViewController() // self.removeAnimate() case 35: self.removeAnimate() self.removeFromParentViewController() MoneyRequestViewController.moneyTransactionListConnectionTimeOut = 0 case 36: self.removeAnimate() self.removeFromParentViewController() InviteViewController.inviteConnectionTimeOutCheck = 0 case 37: self.removeAnimate() self.removeFromParentViewController() RewardViewController.rewardConnectionTimeOutCheck = 0 case 38: self.removeAnimate() self.removeFromParentViewController() MobileRechargeViewController.mobileRechargeConnectionTimeOutCheck = 0 case 39: self.removeAnimate() self.removeFromParentViewController() // self.removeAnimate() case 40: self.removeAnimate() self.removeFromParentViewController() AgentBankViewController.agentConnectionTimeOutCheck = 0 case 41: self.removeAnimate() self.removeFromParentViewController() ProfileViewController.profileConnectionTimeOutCheck = 0 case 42: self.removeAnimate() self.removeFromParentViewController() PayoutViewController.payoutConnectionTimeOutCheck = 0 case 43: self.removeAnimate() self.removeFromParentViewController() RedeemViewController.redeemConnectionTimeOutCheck = 0 case 44: self.removeAnimate() self.removeFromParentViewController() ReferralCodeViewController.referralCodeConnectionTimeOut = 0 case 45: self.removeAnimate() self.removeFromParentViewController() PopUpAddUserProfileViewController.uploadImageConnectionTimeOutCheckDialog = 0 case 46: self.removeAnimate() self.removeFromParentViewController() TrackTransactionViewController.checkTransactionListConnectionTimeOut = 0 default: return } } func showAnimate() { self.view.transform = CGAffineTransform(scaleX: 1.3, y: 1.3) self.view.alpha = 0.0 self.view.alpha = 1.0 self.view.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) UIView.animate(withDuration: 0.1, animations: { self.view.alpha = 1.0 self.view.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) }); } func removeAnimate() { UIView.animate(withDuration: 0.0, animations: { self.view.transform = CGAffineTransform(scaleX: 1.3, y: 1.3) self.view.alpha = 0.0; }, completion:{(finished : Bool) in if (finished) { self.view.removeFromSuperview() } }); } }