Skip to content

Commit baff6d9

Browse files
committed
Merge pull request dogo#189 from lolgear/fluent_style_support
2 parents dcb689e + 7014bc1 commit baff6d9

3 files changed

Lines changed: 606 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ Animated Alert View written in Swift but ported to Objective-C, which can be use
1515
![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot6.png)
1616
![BackgroundImage](https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot7.png)
1717

18+
###Modern
19+
20+
```Objective-C
21+
//Fluent style
22+
23+
SCLAlertViewBuilder *builder = [SCLAlertViewBuilder new]
24+
.addButtonWithActionBlock(@"Send", ^{ /*work here*/ });
25+
SCLAlertViewShowBuilder *showBuilder = [SCLAlertViewShowBuilder new]
26+
.style(Warning)
27+
.title(@"Title")
28+
.subTitle(@"Subtitle")
29+
.duration(0);
30+
[showBuilder showAlertView:builder.alertView onViewController:self.window.rootViewController];
31+
```
32+
1833
###Easy to use
1934
```Objective-C
2035
// Get started

SCLAlertView/SCLAlertView.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,81 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground)
445445
- (void)showQuestion:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
446446

447447
@end
448+
449+
@interface SCLAlertViewShowBuilder : NSObject
450+
451+
@property(strong, nonatomic, readonly) UIViewController *parameterViewController;
452+
@property(copy, nonatomic, readonly) UIImage *parameterImage;
453+
@property(copy, nonatomic, readonly) UIColor *parameterColor;
454+
@property(copy, nonatomic, readonly) NSString *parameterTitle;
455+
@property(copy, nonatomic, readonly) NSString *parameterSubTitle;
456+
@property(copy, nonatomic, readonly) NSString *parameterCompleteText;
457+
@property(assign, nonatomic, readonly) SCLAlertViewStyle parameterStyle;
458+
@property(copy, nonatomic, readonly) NSString *parameterCloseButtonTitle;
459+
@property(assign, nonatomic, readonly) NSTimeInterval parameterDuration;
460+
461+
#pragma mark - Setters
462+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^viewController)(UIViewController *viewController);
463+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^image)(UIImage *image);
464+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^color)(UIColor *color);
465+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^title)(NSString *title);
466+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^subTitle)(NSString *subTitle);
467+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^completeText)(NSString *completeText);
468+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^style)(SCLAlertViewStyle style);
469+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^closeButtonTitle)(NSString *closeButtonTitle);
470+
@property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^duration)(NSTimeInterval duration);
471+
472+
- (void)showAlertView:(SCLAlertView *)alertView;
473+
- (void)showAlertView:(SCLAlertView *)alertView onViewController:(UIViewController *)controller;
474+
@end
475+
476+
@interface SCLAlertViewBuilder : NSObject
477+
478+
#pragma mark - Parameters
479+
@property (strong, nonatomic, readonly) SCLAlertView *alertView;
480+
481+
#pragma mark - Init
482+
- (instancetype)init;
483+
- (instancetype)initWithNewWindow;
484+
- (instancetype)initWithNewWindowWidth:(CGFloat)width;
485+
486+
#pragma mark - Properties
487+
@property(copy, nonatomic) SCLAlertViewBuilder *(^cornerRadius) (CGFloat cornerRadius);
488+
@property(copy, nonatomic) SCLAlertViewBuilder *(^tintTopCircle) (BOOL tintTopCircle);
489+
@property(copy, nonatomic) SCLAlertViewBuilder *(^useLargerIcon) (BOOL useLargerIcon);
490+
@property(copy, nonatomic) SCLAlertViewBuilder *(^labelTitle) (UILabel *labelTitle);
491+
@property(copy, nonatomic) SCLAlertViewBuilder *(^viewText) (UITextView *viewText);
492+
@property(copy, nonatomic) SCLAlertViewBuilder *(^activityIndicatorView) (UIActivityIndicatorView *activityIndicatorView);
493+
@property(copy, nonatomic) SCLAlertViewBuilder *(^shouldDismissOnTapOutside) (BOOL shouldDismissOnTapOutside);
494+
@property(copy, nonatomic) SCLAlertViewBuilder *(^soundURL) (NSURL *soundURL);
495+
@property(copy, nonatomic) SCLAlertViewBuilder *(^attributedFormatBlock) (SCLAttributedFormatBlock attributedFormatBlock);
496+
@property(copy, nonatomic) SCLAlertViewBuilder *(^completeButtonFormatBlock) (CompleteButtonFormatBlock completeButtonFormatBlock);
497+
@property(copy, nonatomic) SCLAlertViewBuilder *(^buttonFormatBlock) (ButtonFormatBlock buttonFormatBlock);
498+
@property(copy, nonatomic) SCLAlertViewBuilder *(^forceHideBlock) (SCLForceHideBlock forceHideBlock);
499+
@property(copy, nonatomic) SCLAlertViewBuilder *(^hideAnimationType) (SCLAlertViewHideAnimation hideAnimationType);
500+
@property(copy, nonatomic) SCLAlertViewBuilder *(^showAnimationType) (SCLAlertViewShowAnimation showAnimationType);
501+
@property(copy, nonatomic) SCLAlertViewBuilder *(^backgroundType) (SCLAlertViewBackground backgroundType);
502+
@property(copy, nonatomic) SCLAlertViewBuilder *(^customViewColor) (UIColor *customViewColor);
503+
@property(copy, nonatomic) SCLAlertViewBuilder *(^backgroundViewColor) (UIColor *backgroundViewColor);
504+
@property(copy, nonatomic) SCLAlertViewBuilder *(^iconTintColor) (UIColor *iconTintColor);
505+
@property(copy, nonatomic) SCLAlertViewBuilder *(^circleIconHeight) (CGFloat circleIconHeight);
506+
@property(copy, nonatomic) SCLAlertViewBuilder *(^extensionBounds) (CGRect extensionBounds);
507+
@property(copy, nonatomic) SCLAlertViewBuilder *(^statusBarHidden) (BOOL statusBarHidden);
508+
@property(copy, nonatomic) SCLAlertViewBuilder *(^statusBarStyle) (UIStatusBarStyle statusBarStyle);
509+
510+
#pragma mark - Custom Setters
511+
@property(copy, nonatomic) SCLAlertViewBuilder *(^alertIsDismissed) (SCLDismissBlock dismissBlock);
512+
@property(copy, nonatomic) SCLAlertViewBuilder *(^removeTopCircle)(void);
513+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addCustomView)(UIView *view);
514+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addTextField)(NSString *title);
515+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addCustomTextField)(UITextField *textField);
516+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addSwitchViewWithLabelTitle)(NSString *title);
517+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addTimerToButtonIndex)(NSInteger buttonIndex, BOOL reverse);
518+
@property(copy, nonatomic) SCLAlertViewBuilder *(^setTitleFontFamily)(NSString *titleFontFamily, CGFloat size);
519+
@property(copy, nonatomic) SCLAlertViewBuilder *(^setBodyTextFontFamily)(NSString *bodyTextFontFamily, CGFloat size);
520+
@property(copy, nonatomic) SCLAlertViewBuilder *(^setButtonsTextFontFamily)(NSString *buttonsFontFamily, CGFloat size);
521+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithActionBlock)(NSString *title, SCLActionBlock action);
522+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithValidationBlock)(NSString *title, SCLValidationBlock validationBlock, SCLActionBlock action);
523+
@property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithTarget)(NSString *title, id target, SEL selector);
524+
525+
@end

0 commit comments

Comments
 (0)