codestergit / sweetalert-ios Goto Github PK
View Code? Open in Web Editor NEWLive animated Alert View for iOS written in Swift
License: MIT License
Live animated Alert View for iOS written in Swift
License: MIT License
i am using xcode 6.4
i was not able to compile the project because there was a problem with autoresizing and the button type. i changed the code and it works..
self.view.autoresizingMask = UIViewAutoresizing.FlexibleHeight
let button = UIButton.buttonWithType(UIButtonType.Custom) as! UIButton
thanks for this awesome tiny library
I noticed that if you set the button titles too long, it causes the button width to extend and look ugly.
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.
How do I use this in my Objective-C project. It lets me do the :
SweetAlert *newAlert=[[SweetAlert alloc]init];
[newAlert showAlert:@"Error"];
but none of the customizing like adding a subtitle or changing the type of alert.
Any help is appreciated. Thanks!
isOtherButton param value is true for first button and false for other button
Function cloaseAlert has line:
let isOtherButton = buttonIndex == 0 ? true: false
But otherButton index is 1 - condition is incorrect
Hello my friend, I have been struggling with this issue and I just can't make it work, I hope you can help me if this is posible or not, I noticed it does work in web and Android, but for some reason I cant find where to make it work in your code, and the function that allows me to do that or a similar one in Android, doesn't exist in this library. Best regards.
I am using this and i want to hide OK button from success alert. It should be dismiss by default after 3 seconds or user can set the time.
I didn't get the frame of Button. Please guide me.
Always crashes at line 243
let window: UIWindow = UIApplication.sharedApplication().keyWindow!
with error
fatal error: unexpectedly found nil while unwrapping an Optional value
i am calling following code in my viewController in viewDidLoad() method
SweetAlert().showAlert("Good job!", subTitle: "You clicked the button!", style: AlertStyle.Success)
Wouldn't it better to make the class a singleton so that there is only one instance.
You would then just call functions:
SweetAlert.sharedInstance.showAlert("Here's a message!")
Just need the:
static let sharedInstance = SweetAlert()
and make the init()
private.
Very nice work, thanks!!
If you were to change SweetAlert() to your alert variable across the ViewController, you would notice that the custom image doesn't get cleaned properly.
Example. click the custom image button then check the other alerts.
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? ๐
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? ๐
......
#if defined(__has_feature) && __has_feature(modules)
@import UIKit;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
@class NSCoder;
@class UIButton;
@class NSBundle;
SWIFT_CLASS("_TtC4demo10SweetAlert")
@interface SweetAlert : UIViewController
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
- (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
- (void)pressed:(UIButton * _Null_unspecified)sender;
- (void)viewWillLayoutSubviews;
- (SweetAlert * _Nonnull)showAlert:(NSString * _Nonnull)title SWIFT_WARN_UNUSED_RESULT;
- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
@end
@interface UIColor (SWIFT_EXTENSION(demo))
@end
#pragma clang diagnostic pop
showAlert:
API Can't meet the project requirementsObjective-C
language versionself.dismissViewControllerAnimated(true, completion: nil) working but self.presentViewController(sampleviewcontroller(), animated:true, completion:nil) not working
I used your SweetAlert here https://github.com/MHaroonBaig/Swift-Beautify
I added the new blurred view to this alert, to make it look more cool and engaging. What if I send a pull request? I'm afraid that it'd be a bit heavy on other devices like iPad2 and iPhone 4s.
You can see the new blurred alert at the GIF that I provided with my project. Thanks ๐
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.
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
Great work, Love the animation. But i feel its missing one of the main fundamental attributes of and Alert View Controller. Most alert controllers have a text field and if your's has it, that would make it the best by far i think.
Gives that warnings !
ViewController.swift:32:22: Result of call to 'showAlert' is unused
ViewController.swift:38:22: Result of call to 'showAlert(_:subTitle:style:)' is unused
like this about 12 warnings
If you use SweetAlert on iOS 9 on iPad, the keyboard can appear at any time even if your app didn't initiate it. The keyboard will often cover up the SweetAlert. To resolve this, it should listen for the keyboard will show and will hide notifications and relocate appropriately.
Please add custom fonts
Hi,
Thanks for sharing the code.
The issue I face is that when we change the size of the animate view the bezirepath that draws the tick of success animate view draws bad.
It seems that the code for drawing this tick is harcoded based on size 70 and when I change the size to 50 it draws bad.
May you please help me how to fix this?
Title says it all
Hi,
This is a very nice Alert I'm using in my project, I would like to recommend to structure the project as CocoaPods compatible that should pass all the validations of the command:
pod lib lint SweetAlert.podspec
I've created a branch develop in my fork, if you are interested in a PR (#44).
Thanks,
J.
/SweetAlert.swift:492:57: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.
Please, upload this to cocoapods
As cool as this is I really don't want to use it in the project I'm working on until there is an 'autoDismiss' option
I introduced this with cocoapods.
I want to generate this instance with "SweetAlert()".
However, this initializer is internal.
Isn't it impossible?
UIScreen.mainScreen().bounds must be replaced by UIScreen.mainScreen().applicationFrame
will this library be updated in the future?
best regards
Alex
Hi,
First off great work with this. super light weight and works great!! I had two inquiries to ask for
How to dismiss the alert when user tapped the out side of the alert view ?
Your SweetAlert is amazing but you'll add to the possibility textfield and 3 or 4 buttons? It would be great.
Any chance on an update for Swift3?
Why doesn't show alert on iPhone4s.(Xcode6.3, iOS8.0+)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.