daalertcontroller

DAAlertController

DAAlertController is a custom UIAlertController subclass that allows you to easily display customizable alert messages in your iOS app.

Table of Contents

Installation

To install DAAlertController, you can use CocoaPods. Simply add the following line to your Podfile:

pod 'DAAlertController'

Then run the command pod install in Terminal.

Usage

To use DAAlertController, you first need to import it into your Swift file:

import DAAlertController

Next, create an instance of DAAlertController with a title, message, and preferred style:

let alertController = DAAlertController(title: "Title", message: "Your message", preferredStyle: .alert)

Add actions to your alert controller using the addAction method:

alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))

Present the alert controller using the present method:

alertController.present(from: self)

You can add more actions, change the style, or customize the appearance of the alert controller as needed.

Customization

DAAlertController allows you to customize various aspects of the alert controller:

  • Alert title color
  • Alert message color
  • Alert background color
  • Button title color
  • Button background color
  • Button border color
  • Button corner radius

You can customize these properties by calling the corresponding setter methods on your DAAlertController instance before presenting it.

Callbacks

DAAlertController provides callbacks for handling button tap events. Simply pass a closure as the handler when adding an action to the alert controller:

alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
    // Handle OK button tap event
}))

Contributing

Contributions are welcome! If you find a bug or have any suggestions, feel free to open an issue or submit a pull request on the GitHub repository.

License

DAAlertController is available under the MIT license. See the LICENSE file for more information.