With CustomAlertView you can create a simple custom alert instead of using the default one from Apple, which doesn’t always fit in with the style of your app.


  • Add Icon
  • Personalise Title, Message and both Buttons
  • Possibility to hide Title, Message and Cancel Button
  • Change Alert Position (.center or .bottom)
  • Change Agree Button Corner Radius
  • Change Agree Button Color
  • Change View Background Color


Position and No Title Radius and No Message Icon and Color One Button
positionnotitle radiusnomessage iconandcolor onebutton


Swift Package Manager

To integrate using Apple’s Swift Package Manager, add the following as a dependency to your Package.swift:

dependencies: [
    .package(url: "", from: "1.0.0")

Alternatively navigate to your Xcode project, select Swift Packages and click the + icon to search for CustomAlert.


If you prefer not to use any of the aforementioned dependency managers, you can integrate CustomAlert into your project manually. Simply drag the Sources Folder into your Xcode project.


Create an AlertView:

import CustomAlert

let alert = AlertView()

Customise the UI and add the Fade transition:

alert.delegate = self
alert.setupContents(accentColor: .systemBlue,
                            backgroundColor: .systemBackground,
                            icon: UIImage(systemName: "hand.wave"),
                            title: "I am a title",
                            message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                            agreeTitle: "Go to Settings",
                            cancelTitle: "Cancel",
                            position: .bottom,
                            hostVC: self)
alert.fadeIn(duration: 0.3)

Manage Actions:

extension ViewController: AlertViewDelegate {
    func agreeAction() {
        // Example: Go to Settings
        guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { return }
        if UIApplication.shared.canOpenURL(settingsUrl) {
  , completionHandler: { (success) in
                print("Settings opened: \(success)")
    func cancelAction() {
        alert.removeFromSuperView(duration: 0.3)


Contributions are very welcome ?


View Github