Hi, Humans!
My name is Hamza Farooq and I love 'Swift' programming. I always try to implement new ideas. Do check Swift-TopViewController for this CustomAlertManager to work
This class is used to make custom alert
Do the following simple steps to add the Manager class in your project and present this CustomAlert
First of all follow this link to add the Swift-TopViewController in your project. Because this file is used to present this ActionSheet
Then, simply download or copy this code and place it in your project. (Click on the link, this will take you to the directory where CustomAlertManager is placed)
If you do not want to add Swift-TopViewController in your project. then you can modify CustomAlertManager on your on
AlertManager.customAlertView(messageString: "Enter Valid Email")
AlertManager.customAlertView(messageString: "A reset password link has been sent to the given email address", isDismissingDialogForFirstButton: false, leftButtonCallBack: {
AlertManager.topVCGeneric.view.viewWithTag(100)?.removeFromSuperview()
AlertManager.topVCGeneric.view.viewWithTag(200)?.removeFromSuperview()
// do your stuff here
})
- One thing is to keep in mind is when isDismissingDialogForFirstButton is set to false and you used the callback method, then you have to remove custom alert manually from your callback function like above
AlertManager.customAlertView(messageString: "Are you sure to logout?", isSingleButton: false, leftButtonTitle: "Yes", rightButtonTitle: "No", isDismissingDialogForFirstButton: false, leftButtonCallBack: {
AlertManager.topVCGeneric.view.viewWithTag(100)?.removeFromSuperview()
AlertManager.topVCGeneric.view.viewWithTag(200)?.removeFromSuperview()
// do your stuff here
})
- Play with the variables available to achieve more results
- Alert title and buttons Color
- Alert Image
I uses this class for my own personal use, if you want to use some other methods or want to modify this class on your own, you can. :-)
Your contributions are most welcomed. Do let me know if you find any kind of issue while using this file. Please open an issue to discuss that problem. Thanks
Hamza Farooq, hamza_faroooq@yahoo.com
MIT (Click Me O_o)