Welcome to the documentation for the PCLBlurEffectAlert plugin! Here, you will find all the information you need to get started with incorporating blur effect alerts into your app.
Installation
To install the PCLBlurEffectAlert plugin, follow these steps:
- Download the plugin from here
- Unzip the downloaded file
- Add the
PCLBlurEffectAlert
folder to your project - Make sure the
.xib
file has the proper target membership - Build and run your project
Usage
Follow the steps below to use the PCLBlurEffectAlert plugin in your app:
Step 1: Import the Plugin
In the file where you want to use the PCLBlurEffectAlert, add the following import statement:
import PCLBlurEffectAlert
Step 2: Creating an Alert
To create a blur effect alert, use the following code:
// Create alert
let alert = PCLBlurEffectAlertController(title: "Alert Title", message: "Alert message", effect: UIBlurEffect(style: .dark), style: .alert)
// Customize alert appearance (optional)
alert.configure(cornerRadius: 20, backgroundColor: UIColor(white: 0.3, alpha: 0.7), titleColor: .white, messageColor: .white, buttonTitleColor: .red)
// Add actions
let cancelAction = PCLBlurEffectAlertAction(title: "Cancel", style: .cancel) { _ in
// Handle cancel action
}
alert.addAction(cancelAction)
let confirmAction = PCLBlurEffectAlertAction(title: "OK", style: .default) { _ in
// Handle confirm action
}
alert.addAction(confirmAction)
// Present the alert
self.present(alert, animated: true, completion: nil)
Customization
You can customize the appearance of the alert by using the configure
method of the PCLBlurEffectAlertController
. Here’s an example:
alert.configure(cornerRadius: 20, backgroundColor: UIColor(white: 0.3, alpha: 0.7), titleColor: .white, messageColor: .white, buttonTitleColor: .red)
The cornerRadius
parameter sets the corner radius of the alert view. The backgroundColor
parameter sets the background color of the alert view. The titleColor
parameter sets the color of the alert title. The messageColor
parameter sets the color of the alert message. The buttonTitleColor
parameter sets the color of the alert buttons.
Adding Actions
To add actions (buttons) to the alert, use the addAction
method of the PCLBlurEffectAlertController
. Here’s an example:
let cancelAction = PCLBlurEffectAlertAction(title: "Cancel", style: .cancel) { _ in
// Handle cancel action
}
alert.addAction(cancelAction)
let confirmAction = PCLBlurEffectAlertAction(title: "OK", style: .default) { _ in
// Handle confirm action
}
alert.addAction(confirmAction)
Compatibility
The PCLBlurEffectAlert plugin is compatible with the following:
- iOS 10 or later
- Xcode 10 or later
- Swift 4 or later
License
The PCLBlurEffectAlert plugin is released under the MIT License. You can find the license file in the plugin repository.