Skip to content

hamza-faroooq/Swift-CustomAlertManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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

Swift-CustomAlertManager

This class is used to make custom alert

Images

Simple Usage

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

Example

Single button usage with no callback

AlertManager.customAlertView(messageString: "Enter Valid Email")

Single button usage with callback

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

Double button usage with only first button callback

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

More customization available for:

  • 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. :-)

Contributions

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

Auther

Hamza Farooq, hamza_faroooq@yahoo.com

License

MIT (Click Me O_o)

Releases

No releases published

Packages

No packages published

Languages