Custom AlertView in iOS with Swift 5 Programming

Custom AlertView in iOS with Swift 5 Programming
July 26, 2020 1 Comment Development,iOS Development Pushpendra Kumar

Hey, Guys welcome to this tutorial. In this complete video, I will make you understand the quick trick for Custom AlertView in iOS with Swift 5. And this is a simple way to achieve our goals. Through this simple video tutorial, you can learn more interesting things about the Custom AlertView in iOS with Swift 5. So watch the complete video. And if you watched the complete video then do not forget to give your suggestion into the comment box. Because your feedback & suggestions do matter for me πŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ‘‡πŸ»

And finally, I would like to say that, If you like this video and it’s helpful for your project then click on the like button and do not forget to subscribe to this YouTube channel for future updates.

Custom AlertView in iOS

Grate, If you seen this video then get the use full code related to this video below.

        //MARK: - Open AlerView as a custom popup
        let story = UIStoryboard(name: "Main", bundle: nil)
        let controller = story.instantiateViewController(identifier: "STORY_ID") as! YourControllerClass
        self.addChild(controller)
        self.view.addSubview(controller.view)
        controller.didMove(toParent: self)

Good work, Now Get the code relate to popup.

//
//  PupUpController.swift
//  Poup
//
//  Created by Pushpendra on 25/07/20.
//  Copyright Β© 2020 Pushpendra. All rights reserved.
//

import UIKit

class PopUpUpController: UIViewController {

    @IBOutlet weak var mainView: UIView!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.black.withAlphaComponent(0.8)
        self.addAnimation()
    }
    
    @IBAction func closePopup(_ sender: Any) {
        removeAnimation()
    }

    func addAnimation()  {
        self.mainView.transform = CGAffineTransform(translationX: 0, y: self.mainView.frame.height)
        UIView.animate(withDuration: 0.5, animations: {
            self.mainView.transform = .identity
        })
    }
    
    private func removeAnimation(){
        self.mainView.transform = .identity
        UIView.animate(withDuration: 0.5, animations: {
            self.mainView.transform = CGAffineTransform(translationX: 0, y: self.mainView.frame.height)
        }) { (complete) in
            self.view.removeFromSuperview()
        }
    }
}

Grate job, I hope you have done with it. If need to understand then please check video listed above.

In Conclusion, You have done with this tutorial. And I hope now the concept of Custom AlertView in iOS with Swift 5 is clear. Firstly, If you have any doubts regarding the Custom AlertView in iOS with Swift 5. Then you can comment into the comment box. And If you like this tutorial with a complete description of the simple and attractive tutorial in iOS then please like my video on YouTube and do not forget to subscribe to my YouTube channel. Because you will get lots of videos related to swift development with very sort tricks.

In addition, If you are more curious about the development and knowing about tutorials then follow the below links πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ˜Ž

Tags
About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd (www.thecolourmoon.com). This website I have made so that I can meet with new challenges and can share here.
Leave Comment
  1. 1

    Hubert

    You need to be a part of a contest for one of the greatest websites
    online. I most certainly will recommend this site!

    Reply

Leave a reply

Your email address will not be published. Required fields are marked *