MSAlertController is a light alert controller which is inspired by Apple own message and notfication alert view.
- Create simple alert/reminder to inform user with side-view configured
- Use side view as second view for extra information
- Add your own view inside side view (see API)
- Create actionable alert and attach closure based action buttons
- Attach upto three buttons in action sheet for action
- Title
- Description message
- Customizations: Create your own theme - title font, title font color, body font & color - to change appearance
- UIKit interactive animation
- Carthage
And of course MSAlertController itself is open source.
- iOS 9.0+
- Xcode 9+
- Swift 4.0+
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 MSAlertController into your Xcode project using Carthage, specify it in your Cartfile
:
github "manismku/MSAlertController" ~> 1.0
Run carthage update
to build the framework and drag the built MSAlertController.framework
into your Xcode project.
- Download and drop
/Library
folder in your project. - Congratulations!
The usage is very similar to UIAlertController
.
MSAlertController
has currently two styles: Default & NoAction.
Default: with this style, alert view gives upto 3 action to submit when user side(left) scrolls
NoAction: with Noaction, in this mode it will act as simple informative alert and side view can hold extra information
let alertVC = MSAlertController(title: "NEARME", message: "You are near Fisherman's Wharf.")
let viewAction = MSAlertAction(title: "Open Map") {
[weak self] in
self?.dismiss(animated: true, completion: nil)
}
let cameraAction = MSAlertAction(title: "Take Photo") {
[weak self] in
self?.actionLaunchCamera()
}
alertVC.addAction(action: viewAction)
alertVC.addAction(action: cameraAction)
self.present(alertVC, animated: false, completion: nil)
let alertVC = MSAlertController(title: "NEARME", message: "You are near Fisherman's Wharf.",
theme: { () -> Appearance in
let theme = Appearance.createTheme(theme: .grey)
return theme
})
let viewAction = MSAlertAction(title: "Open Map") {
[weak self] in
self?.dismiss(animated: true, completion: nil)
}
let cameraAction = MSAlertAction(title: "Take Photo") {
[weak self] in
self?.actionLaunchCamera()
}
alertVC.addAction(action: viewAction)
alertVC.addAction(action: cameraAction)
self.present(alertVC, animated: false, completion: nil)
let alertVC = MSAlertController(title: "MESSAGE", message: "Hey!! Let's meet at Market-Square.",
sideView: UIImageView.init(image: UIImage(named: "avatar")),
style: .NoAction)
self.present(alertVC, animated: false, completion: nil)
- More styles
- More themes
- If you need help or you'd like to ask a general question, open an issue.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Made with ❤️ by Manish Kumar The design is inspired by Apple own message and notfication.
MSAlertController is available under the MIT license. See the LICENSE file for more info.