# CDAlertView: a customisable alert popup for iOS

> CDAlertView is a Swift popup for iOS that is used like the system alert controller but is not limited by it, with typed alert styles, action buttons, an optional text field, custom views, and hide animations you can write yourself. It suits an application that needs an alert to match its own design, and it is a small dependency with a last tagged release from 2020.

**candostdagdeviren/CDAlertView** — Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

- Repository: https://github.com/candostdagdeviren/CDAlertView
- Website: https://candostdagdeviren.github.io/CDAlertView/
- Stars: 1,134 · Forks: 85
- Language: Swift
- License: MIT
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/candostdagdeviren-cdalertview

## What the library is

CDAlertView is a highly customizable alert popup written in Swift, and the README positions it immediately against the system component it resembles. The usage is similar to UIAlertController.

That comparison is the whole design brief and the whole warning. The system alert controller gives you a title, a message and buttons, and it looks like every other alert on the device. A library like this exists for the cases where that is wrong, where the alert is part of the design rather than a system interruption, and where the developer needs the type in the alert, the font in the title, the layout of the buttons and the animation on dismissal.

The implementation is a single view controller with a stack view for the content, and the readme documents the whole surface as a flat list of properties, which is the clearest possible statement of what the library does and does not do.

The distribution is through the two usual channels for iOS libraries, with a podspec and a Carthage badge, and there is an Example application with its own Xcode workspace and a Podfile, which is the arrangement that lets you try a change without wiring the library into a project of your own. There is a test target, a code of conduct, and a Travis configuration, which dates the project.

The licence is MIT, the last push to the repository was on 2026-08-20, and the last tagged release is 0.11.0 from December 2020, with the two before it being a Swift 5 version in 2019 and a Swift 4.2 support release in 2018.

## The alert types, and what they carry

The set of alert types is small and it is the visible vocabulary of the library.

```swift
public enum CDAlertViewType {
    case error, warning, success, notification, alarm, noImage, custom(image:UIImage)
}
```

Five semantic types, one that shows no icon at all, and one that takes an image you supply. The semantic ones matter because each carries a different visual identity, and because the documentation mentions an option that switches between filled and outline icon rendering, which is a detail that says the icons are drawn as two variants rather than one.

The type is passed at initialisation, and the simplest possible use of the library is a single call.

```swift
CDAlertView(title: "Awesome Title", message: "Well explained message!", type: .notification).show()
```

The custom type is the escape hatch, and the documentation explains the pattern for using it. To use it with your own icon, you initialise without a type, or with the empty one, and then set the icon and the background colour yourself.

```swift
let alert = CDAlertView(title: "Awesome Title", message: "Well explained message!", type: .custom(image: UIImage(named:"YourAwesomeImage")))
alert.circleFillColor = UIColor.yourAmazingColor
```

So the colour of the circle behind the header icon is a property in its own right, which is the level of control the library is aiming at. The header, the circle, the fill and the shadow are all separate properties, and you can compose a look that no system alert would give you.

## Buttons, the three button limit and the dismissal rules

Actions are added to the alert after it is created, and the pattern is close to the system's.

```swift
let alert = CDAlertView(title: "Awesome Title", message: "Are you in?!", type: .notification)
let doneAction = CDAlertViewAction(title: "Sure! 💪")
alert.add(action: doneAction)
let nevermindAction = CDAlertViewAction(title: "Nevermind 😑")
alert.add(action: nevermindAction)
alert.show()
```

An action carries a title, and the advanced initialiser adds a font, a text colour, a background colour and a handler, all of which are optional and have defaults.

```swift
let action = CDAlertViewAction(title: "Action Title", font: UIFont.yourCustomFont, textColor: UIColor.yourTextColor, backgroundColor: UIColor.yourBackgroundColor, handler: { action in })
alertView.addAction(action)
```

Two constraints are worth knowing before you design the layout. The documentation notes that aligning the buttons vertically and horizontally is possible, but that using more than three buttons in a horizontal placement is not, and the option list says the same thing with the number. And the buttons have defaults that are visible in the documentation, with a default button text colour of a specific blue and a default font of the system font at size 17.

The dismissal rules are documented as a note on the simplest usage. You can use the popup without any buttons, in which case touching outside of the popup or moving it will make it disappear, and if there is an action button then only pressing a button will dismiss it. That is a deliberate difference from the system alert, and it is what makes the buttonless form usable as a notification rather than as a question.

## The text field, and who owns the delegate

A text field inside the popup is switched on with a single property, and once it is enabled a second set of options becomes available.

```swift
alert.isTextFieldHidden = false
```

The text field options are extensive, and they are the standard text field properties exposed under the library's own names. There is the font, the secure text entry flag, the return key type, the text alignment with a default of left, the placeholder text, the autocapitalization type with a default of none, the background colour, the tint colour, the text itself, and the height.

The one to read twice is the delegate. The default delegate is CDAlertView itself, and the documentation says that if you overwrite it you are responsible for resigning the text field. That is a genuine ownership transfer, and it is the kind of detail that produces a keyboard that stays up after the alert is dismissed if you get it wrong.

The remaining options in that group are the hide animation duration, the hide animations block itself, and the auto hide time, which is the interval after which the alert dismisses itself and which defaults to nil.

So the text field is a real feature rather than a token one. It is there for the case where the popup is collecting an input, and the library gives you the full set of configuration knobs for it, with the delegate contract as the one sharp edge.

## Custom views, custom animations and the auto hide timer

Three features go beyond the alert shape, and they are the ones that make the library useful in an application with its own visual language.

A custom view can be used, and the documentation is explicit about the responsibility that comes with it. If you want to use a custom view, you are responsible for the height of it, because the custom view is used inside a stack view.

```swift
let myCustomView = UIVIew(frame: myFrame)
// Don't forget to handle height of `myCustomView`
alert.customView = myCustomView
```

The hide animation is a closure that receives the centre, the transform and the alpha, and you mutate them to produce the animation you want. The example scales the popup up and fades it out.

```swift
let alert = CDAlertView(title: "Awesome Title", message: "Well explained message!", type: .success)
alert.hideAnimations = { (center, transform, alpha) in
    transform = CGAffineTransform(scaleX: 3, y: 3)
    alpha = 0
}
alert.hideAnimationDuration = 0.88
alert.show()
```

And there is a timer based dismissal, where setting the auto hide time makes the popup disappear on its own after that many seconds.

```swift
let alert = CDAlertView(title: "Awesome Title", message: "Well explained message!", type: .success)
alert.autoHideTime = 4.5 // This will hide alert box after 4.5 seconds
```

Together these three cover the cases the system alert cannot: a popup that contains your own content, a popup that leaves the way you want it to, and a popup that does not wait for a tap at all.

## The options list, and the shape of the project

The options list in the readme is long, and it is worth reading as the real API of the library rather than as boilerplate.

There is a group for the text, with the title colour, the message colour, the title font and the message font. A group for the container, with the background colour, the popup width, the rounded corners which default to true and the shadow which also defaults to true. A group for the header, with the filled icon option defaulting to false and the circle fill colour. And a group for behaviour, with the vertical button alignment defaulting to false, the tap to dismiss option defaulting to false, the hide animation duration and the hide animations block.

The defaults are stated for each one, and that matters more than it usually does, because a library that sets rounded corners and a shadow by default produces a different looking popup from the system alert out of the box, and a designer will want to know that before they ship it.

The repository layout is the usual shape for a small iOS library. There is the CDAlertView directory with the source, a test target, the example application with its own workspace and Podfile, the podspec, the Xcode project, a screenshots directory, a code of conduct and a configuration file for the documentation site.

The version story is the part to weigh. The last tagged release is 0.11.0 from December 2020, with a Swift 5 version in 2019 and a Swift 4.2 release in 2018, and the repository has seen pushes as recently as August 2026. So the project is still being touched, but the packaged versions have not moved in years, and if you adopt it you are adopting a version from 2020 that you will need to build against a current Xcode.

For a component this small, that is a reasonable trade, and it is also a reason to read the source rather than to trust the documentation for the current compiler.

## Conclusion

Adopt CDAlertView if your iOS application needs an alert that matches your design and the system controller will not do, because the fonts, colours, button layout, text field and dismissal animation are all yours to set. Do not adopt it for a plain confirmation dialog, where the system alert is better because it carries the platform conventions and the accessibility behaviour for free. Before you upgrade, check the Swift version you are on, since the release history shows separate releases for Swift 4.2 and Swift 5, and read the option list, because most of the behaviour is configured by properties rather than by initialiser arguments.

## FAQ

### What is CDAlertView?

It is a highly customizable alert popup written in Swift for iOS, used in a way similar to UIAlertController. It provides typed alert styles, action buttons, an optional text field, custom views, and custom hide animations, and it is distributed through CocoaPods and Carthage under the MIT licence.

### Which alert types does CDAlertView have?

The public enum lists error, warning, success, notification, alarm, noImage and a custom case that takes an image. You can also initialise without a type and set the icon and the circle background colour yourself.

### How many buttons can a CDAlertView have?

Buttons can be laid out vertically or horizontally, but the documentation states that more than three buttons in a horizontal placement is not possible. The maximum is therefore three in a row.

### How do I add a text field to a CDAlertView?

Set the isTextFieldHidden property to false. A second set of options then becomes available for the font, the secure entry flag, the return key type, the alignment, the placeholder, the autocapitalization type, the colours, the text and the height, and the delegate defaults to CDAlertView, so if you replace it you are responsible for resigning the text field.

## Sources

- [candostdagdeviren/CDAlertView on GitHub](https://github.com/candostdagdeviren/CDAlertView)
- [License: MIT](https://github.com/candostdagdeviren/CDAlertView/blob/master/LICENSE)
- [Project website](https://candostdagdeviren.github.io/CDAlertView/)
- [README](https://github.com/candostdagdeviren/CDAlertView/blob/master/README.md)
- [Releases](https://github.com/candostdagdeviren/CDAlertView/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/candostdagdeviren-cdalertview
