Live animated Alert View for iOS written in Swift

Overview

Sweet Alert iOS

Beautiful Animated custom Alert View inspired from javascript library SweetAlert. Written in Swift this SweetAlertView can be used in Swift and Objective-C projects. SweetAlertView provides live intutive experience to user actions.It can be used in place of UIAlertView and UIAlertController

###ScreenShots SweetAlert

###Usage #####Basic message:

SweetAlert().showAlert("Here's a message!")

#####Title with a text under:

SweetAlert().showAlert("Here's a message!", subTitle: "It's pretty, isn't it?", style: AlertStyle.None)

#####Animated Success message:

SweetAlert().showAlert("Good job!", subTitle: "You clicked the button!", style: AlertStyle.Success)

#####Warning message and Chained Animated Success messge on completion:

SweetAlert().showAlert("Are you sure?", subTitle: "You file will permanently delete!", style: AlertStyle.Warning, buttonTitle:"Cancel", buttonColor:UIColorFromRGB(0xD0D0D0) , otherButtonTitle:  "Yes, delete it!", otherButtonColor: UIColorFromRGB(0xDD6B55)) { (isOtherButton) -> Void in
            if isOtherButton == true {
            
                println("Cancel Button  Pressed")
            }
            else {
                SweetAlert().showAlert("Deleted!", subTitle: "Your imaginary file has been deleted!", style: AlertStyle.Success)
            }
}

#####Chained Alerts on actions with custom button colors:

//Chaining alerts with messages on button click
SweetAlert().showAlert("Are you sure?", subTitle: "You file will permanently delete!", style: AlertStyle.Warning, buttonTitle:"No, cancel plx!", buttonColor:UIColorFromRGB(0xD0D0D0) , otherButtonTitle:  "Yes, delete it!", otherButtonColor: UIColorFromRGB(0xDD6B55)) { (isOtherButton) -> Void in
            if isOtherButton == true {
                
                SweetAlert().showAlert("Cancelled!", subTitle: "Your imaginary file is safe", style: AlertStyle.Error)
            }
            else {
                SweetAlert().showAlert("Deleted!", subTitle: "Your imaginary file has been deleted!", style: AlertStyle.Success)
            }
}

#####Custom icon alert:

SweetAlert().showAlert("Sweet!", subTitle: "Here's a custom image.", style: AlertStyle.CustomImag(imageFile: "thumb.jpg"))

###Diffrent Animated Styles for Diffrent Purposes

enum AlertStyle {
    case Success,Error,Warning,None
    case CustomImag(imageFile:String)
}

###Installation Add the SwiftAlert.swift in to your project.

###Reuirements

  • Xcode 7.0+
  • iOS 7.0+

License

The MIT License (MIT)

Copyright (c) 2014 codestergit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • Xcode 6.3 version doesn't compile

    Xcode 6.3 version doesn't compile

    Hi I am trying to run the Xcode version 6.3 for the code but it doesn't compile. IT raises lot of issues related to init and type methods. I could resolve the type methods error but not init one. Can you help ? -Randeep

    opened by randeepbhatia 7
  • Support to Modal Segues

    Support to Modal Segues

    In the function showAlert isn't better to set the "window" (line 253) constant to "UIApplication.sharedApplication().keyWindow?.subviews.last"?

    In my application, if I set the "keyWindow" to .first, the alert will be put in the back of a ViewController that is presented modally.

    opened by RennanAlves 5
  • Alert doesn't show in some cases.

    Alert doesn't show in some cases.

    I had to change this line: let window = UIApplication.sharedApplication().keyWindow?.subviews.first as UIView to this (notice the .last) to get it to work for me from a modally presented view controller within an app. let window = UIApplication.sharedApplication().keyWindow?.subviews.last as UIView It seems to work, but I'm not really sure what the correct change should be.

    opened by dltlr 3
  • Remove Info.plist from 'Copy Bundle Resources'

    Remove Info.plist from 'Copy Bundle Resources'

    Xcode automatically adds the Info.plist during the build process, no need to add it manually.

    This removes the warning: Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist'

    opened by tiagomnh 1
  • Better Installation Section

    Better Installation Section

    Hey, your library is really interesting.

    The only problem I found was the README.md, which needs a better Installation Section I created this iOS Open source Readme Template so you can take a look on how can improve your Installation Section If you want, I can help you to organize the lib.

    What are your thoughts? 😄

    opened by lfarah 0
  • Feature dismissButton

    Feature dismissButton

    Dismiss button for alerts that don't have a dissmissTime (feature 1.) in the other pull request When pressed, no action is taken, just the view is dismissed.

    opened by acegreen 0
  • Swift 4.0 'M_PI' is deprecated problem solved!

    Swift 4.0 'M_PI' is deprecated problem solved!

    For Swift 4.2 "'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting." And other syntax problems solved.

    opened by alperen23230 0
  • Tap outside feature added and project is now in Swift 4

    Tap outside feature added and project is now in Swift 4

    I have done two things 1: project is now in swift 4.0 2: Created TapOutside Feature so we have to provide that whether we want to dismiss alert on tapping outside or not on every call For example: SweetAlert().showAlert("Here's a message!", EnabledOutsideTap: false) or SweetAlert().showAlert("Here's a message!", EnabledOutsideTap:true)

    opened by varkrishna 0
Releases(v0.9)
Owner
Sahil
Sahil
Beautiful animated Login Alert View. Written in Objective-C

UIAlertView - Objective-C Animated Login Alert View written in Swift but ported to Objective-C, which can be used as a UIAlertView or UIAlertControlle

Letovsky 2 Dec 22, 2021
Animated Alert written in SwiftUI.

TransactionAlert Animated Alert written in SwiftUI. Easy to use Get Started Add a TAViewModel instance as an environment object to your Root View in y

null 11 Jul 21, 2022
Animated alert library like Swarm app.

TKSwarmAlert Animation Tool for Alert like Swarm app. ScreenShot Installation CocoaPods You can use CocoaPods to install TKSwarmAlert by adding it to

Takuya Okamoto 581 Dec 2, 2022
A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

donggyu 5 Jan 26, 2022
Simple Alert View written in Swift, which can be used as a UIAlertController. (AlertController/AlertView/ActionSheet)

DOAlertController Simple Alert View written in Swift, which can be used as a UIAlertController replacement. It supports from iOS7! It is simple and ea

Daiki Okumura 406 Sep 5, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
A colored alert view for your iOS.

日本語 KRAlertController KRAlertController is a beautiful and easy-to-use alert controller for your iOS written by Swift. Requirements iOS 10.0+ Xcode 10

K.R.Impedance 52 Jun 30, 2022
Custom alert View to iOS applications

A simple, easy and custom iOS UIAlertView written in Swift Malert came to facilitates custom alert views as UIAlertController. Malert allows you to pe

Vitor Mesquita 480 Oct 29, 2022
Simple DropDown Alert View For Any iOS Projects.

⚠️ DEPRECATED, NO LONGER MAINTAINED JDropDownAlert JDropDownALert Simple DropDown Alert View For Any iOS Projects. Usage Top let alert = JDropDown

WonJo 71 Jul 17, 2022
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

CDAlertView is highly customizable alert popup written in Swift. Usage is similar to UIAlertController. Screenshots Animations Usage Basic usage witho

Candost Dagdeviren 1.1k Dec 30, 2022
JAlert - This is "Alert View" project for UIKit + SwiftUI. you can use easily

JAlert Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation JAlert is a

Jackson 3 Feb 22, 2022
AlertTransition is a extensible library for making view controller transitions, especially for alert transitions.

AlertTransition AlertTransition is a extensible library for making view controller transitions, especially for alert transitions. Overview AlertTransi

Loopeer 570 Nov 29, 2022
A Swift package for iOS/tvOS for easy alert presentation

AlertPresenter Listed on the Swift Package Index and originally posted on my blog. It can be fiddly to handle the presentation of alerts on a specific

Chris Mash 14 Jul 1, 2022
Advance animated alerts for iOS written in Swift

LIHAlert LIHAlert provides animated banners for iOS. Updated to Swift 3 Demo Project The LIHAlert workspace contains a demo project, also used for dev

null 37 Dec 9, 2022
Highly configurable iOS Alert Views with custom content views

NYAlertViewController NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. Fe

Nealon Young 609 Nov 20, 2022
TextFieldAlert - A SwiftUI alert with text field(s) for iOS 13 and greater.

TextFieldAlert A SwiftUI alert with text field(s) for iOS 13 and greater. As Apple is going to introduce text field(s) as an alert actions in iOS 16,

Piotr Sochalewski 13 Dec 5, 2022
Customizable simple Alert and simple ActionSheet for Swift

SimpleAlert It is simple and easily customizable alert. Can be used as UIAlertController. Appetize's Demo Requirements Swift 5.0 iOS 9.0 or later How

Kyohei Ito 397 Dec 6, 2022
A Simple Customizable Alert With Swift

SimpleCustomizableAlert trying to make my very first library. Support Title Message (TextView) Image TextField Button Action Example let alert

null 1 Oct 26, 2021
Swift UI Kit to present clean modal/alert

CleanyModal is a good way to use UI-Customised alerts with ease Features Present some kind of clean alerts (With same API as UIAlertViewController) Ad

Lory Huz 487 Dec 2, 2022