Latest 1.0.2
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit

Red Alert

Carthage compatible [CocoaPods]() [CocoaPods]() [CocoaPods]()

Red Alert is a small Swift library for iOS apps which provides a way to present UIAlertController-based alerts in an "app-global" fashion, similarly to the now-deprecated UIAlertView.


Presenting alerts globally is generally not recommended. Ideally, each alert should be presented in the context of the view controller it’s originated from. However, some apps that have been structured with UIAlertView in mind would need significant refactoring to fully transition to view controller-based alerts. If such refactoring is not immediately feasible, Red Alert can provide a temporary solution that allows moving away from UIAlertView API wihout addressing the structural problem at the same time.

How it works

Red Alert manages a temporary overlay window with an empty view controller. Alert controllers are presented from that view controller. If multiple alerts are requested, they’re queued up. Once the last alert is dismissed, the window is automatically destroyed. This approach is similar to the implementation of backwards-compatible presentation of UIAlertView instances in newer iOS releases.


  • Xcode 9.0+ (written in Swift 4.0). For compatibility with Xcode 8.x, use version 1.0.0 of this library.
  • iOS 8.0+
  • Compatible with Objective-C



  1. Add the following line to your Cartfile:

    github "vlas-voloshin/RedAlert"
  2. Follow the instructions outlined in Carthage documentation to build and integrate the library into your app.


  1. Add the following line to your Podfile:

    pod 'RedAlert'
  2. Execute pod install.


  1. Download and copy the repository source files into your project, or add it as a submodule to your git repository.
  2. Drag&drop RedAlert.xcodeproj into your project or workspace in Xcode.
  3. In "General" tab of Project Settings → Your Target, you might find that Xcode has added a missing framework item in "Embedded Binaries". Delete it for now.
  4. Still in "General" tab, add RedAlert.framework to "Embedded Binaries". This should also add it to "Linked Frameworks and Libraries".


First off, import RedAlert module in the source file where you’re planning to use it. Then choose one of the presentation methods:


Create and configure your UIAlertController instance and call presentGlobally() extension method (-ral_presentGlobally in Objective-C) on it.

More advanced

Instead of calling presentGlobally() (-ral_presentGlobally) on the alert, call presentGlobally(animated:, stateHandler:) (ral_presentGloballyAnimated:withStateHandler:) to specify whether the presentation should be animated, and pass an optional closure for notifications about the alert states.

Most flexible

While extension methods use a singleton instance of an AlertPresenter (RALAlertPresenter) class that manages the temporary window and presents the alerts, you can also create your own instances of it. Initialise it with the preferred window level, retain it for the lifetime of your alerts, and use its present(_:, animated:, stateHandler:) method to present alert controllers.


This library is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "RedAlert",
    "version": "1.0.2",
    "summary": "Small iOS library for presenting UIAlertController in a UIAlertView fashion.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": "Vlas Voloshin",
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "1.0.2"
    "source_files": [
    "frameworks": "UIKit",
    "requires_arc": true

Pin It on Pinterest

Share This