LKAlertController alternatives and similar libraries
Based on the "Alerts" category.
Alternatively, view LKAlertController alternatives based on common mentions on social networks and blogs.
-
JDStatusBarNotification
Highly customizable & feature rich notifications. Interactive dismiss. Custom Views. SwiftUI. Tap-to-hold. Progress. Written in Swift, compatible for ObjC! -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
PMAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController -
Jelly
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API. -
RMDateSelectionViewController
This is an iOS control for selecting a date using UIDatePicker in an UIAlertController like manner -
CDAlertView
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift -
CFAlertViewController
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets. -
Swift-Prompts
A Swift library to design custom prompts with a great scope of options to choose from. -
TTGSnackbar
TTGSnackbar shows simple message and action button on the bottom or top of the screen with multi kinds of animation, which is written in Swift3 and inspired by Snackbar in Android. It also support showing custom view, icon image or multi action button. -
RMActionController
This is an iOS control for presenting any UIView in an UIAlertController like manner -
DOAlertController
Simple Alert View written in Swift, which can be used as a UIAlertController. (AlertController/AlertView/ActionSheet) -
RMPickerViewController
This is an iOS control for selecting something using UIPickerView in an UIAlertController like manner -
BPStatusBarAlert
BPStatusBarAlert is a library that allows you to easily make text-based alert that appear on the status bar and below navigation bar. -
RAlertView
AlertView, Ios popup window, A pop-up framework, Can be simple and convenient to join your project. IOS 提示框,IOS弹框,IOS弹窗 -
SnowGlobeFramework
Snow globe framework is delightful / slightly cheese easter egg for christmas season. Turns your awesome app into a snow globe, when user shake the device. -
AlertViewLoveNotification
A simple and attractive AlertView to ask permission to your users for Push Notification.
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of LKAlertController or a related project?
README
LKAlertController
An easy to use UIAlertController builder for swift
Features
- Short and simple syntax for creating both Alerts and ActionSheets from UIAlertController
- String together methods to build more complex alerts and action sheets
Basic Usage
Alert
Alert(title: "Title", message: "Message")
.addAction("Cancel")
.addAction("Delete", style: .Destructive, handler: { _ in
//Delete the object
}).show()
Action Sheet
ActionSheet(title: "Title", message: "Message")
.addAction("Cancel")
.addAction("Delete", style: .Destructive, handler: { _ in
//Delete the object
}).show()
Detailed Usage
There are two seperate classes for creating UIAlertControllers
, Alert
, and ActionSheet
. These are used to simplify the creation of the controller. Both can be initialized with or without both a title and message.
Alert()
ActionSheet()
Alert(title: "My title")
ActionSheet(title: "My title")
Alert(message: "My message")
ActionSheet(message: "My message")
Alert(title: "My title", message: "My message")
ActionSheet(title: "My title", message: "My message")
Add various actions to the controller using addAction
. By default the button will be styled Cancel
, but this can be configured on a per button basis, along with the handler that is called if the button is clicked. The possible styles are Cancel
, Default
, and Destructive
. These methods can be strung together to add more buttons to the controller.
ActionSheet()
.addAction("Cancel")
.addAction("Save", style: .Default) {
saveTheObject()
}
.addAction("Delete", style: Destructive) {
deleteTheObject()
}
The controller can be presented by calling show()
. It will be animated by default.
Alert()
.addAction("Okay")
.show()
ActionSheet()
.addAction("Delete", style: .Destructive) {
delete()
}
.addAction("Cancel")
.show(animated: true) {
controllerWasPresented()
}
Alert Specific Configuration
There is a shortcut on alerts to show with an okay button: showOkay
Alert(title: "Stuff has happened").showOkay()
You can also add your own shortcut show method. The following adds a showNevermind
button that adds a Nevermind
button and shows the alert.
extension Alert {
///Shortcut method for adding a nevermind button and showing the alert
public func showNevermind() {
addAction("Nevermind", style: .Cancel, preferredAction: false, handler: nil)
show()
}
}
Text fields can also be added to alerts. To add a text field, initialize a text field first, and configure it, then pass it in with the alert. Note that text fields must be initialized as var
rather than let
var textField = UITextField()
textField.placeholder = "Password"
textField.secureTextEntry = true
Alert().addTextfield(&textField).showOkay()
You can also configure the preferredAction
property on an alert. This will highlight the text of the action, and pressing the return key on a physical keyboard will trigger this action.
Alert()
.addAction("Okay", style: .Default, preferredAction: true)
.show()
ActionSheet Specific Configuration
If presenting on iPad, ActionSheets need to be configured with where it is presenting from. This is done by using the setBarButtonItem
or setPresentingSource
function. Note that this has no effect on iPhone, so it is safe, and recommended, to call this method if your app supports both iPad and iPhone.
ActionSheet()
.addAction("Delete", style: .Destructive) {
delete()
}
.addAction("Cancel")
.setBarButtonItem(navigationController.rightBarButtonItem)
.show(animated: true) {
controllerWasPresented()
}
ActionSheet()
.addAction("Delete", style: .Destructive) {
delete()
}
.addAction("Cancel")
.setPresentingSource(buttonThatWasPressed)
.show(animated: true) {
controllerWasPresented()
}
Testing
You can add an override for the show
method to make it easy to add unit tests for your alerts.
func testDeleteOpensConfirmationAlert() {
let expectation = expectationWithDescription("Show override")
LKAlertController.overrideShowForTesting { (style, title, message, actions, fields) -> Void in
XCTAssertEquals(title, "Are you sure you want to delete?", "Alert title was incorrect")
expectation.fulfill()
}
model.delete()
//If the override is never called, and the expectation is not fulfilled, the test will fail
waitForExpectations(0.5, handler: nil)
}
This will allow you to test the controller was presented as well as the title, message, actions and fields of the alert or action sheet.
Installation
LKAlertController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "LKAlertController"
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate LKAlertController into your Xcode project using Carthage, specify it in your Cartfile
:
github "lightningkite/LKAlertController"
Run carthage update
to build the framework and drag the built LKAlertController.framework
into your Xcode project.
Issues Questions and Contributing
Have an issue, or want to request a feature? Create an issue in github.
Want to contribute? Add yourself to the authors list, and create a pull request.
Author
Erik Sargent, [email protected]
License
LKAlertController is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the LKAlertController README section above
are relevant to that project's source code only.