Skip to content

Commit 1c50f44

Browse files
committed
CFAlertViewController Constructor names updated to make it similar as previous Objc version
1 parent 54cd8ae commit 1c50f44

5 files changed

Lines changed: 45 additions & 45 deletions

File tree

CFAlertViewController.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "CFAlertViewController"
19-
s.version = "2.0.3"
19+
s.version = "2.0.4"
2020
s.summary = "CFAlertViewController is a library that helps you display and customise alerts and action sheets on iPad and iPhone."
2121

2222
# This description is used to generate tags and improve search results.
@@ -79,7 +79,7 @@ Pod::Spec.new do |s|
7979
# Supports git, hg, bzr, svn and HTTP.
8080
#
8181

82-
s.source = { :git => "https://github.com/Codigami/CFAlertViewController.git", :tag => "v2.0.3" }
82+
s.source = { :git => "https://github.com/Codigami/CFAlertViewController.git", :tag => "v2.0.4" }
8383

8484

8585
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

CFAlertViewController/CFAlertViewController.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,28 @@ public class CFAlertViewController: UIViewController {
100100

101101

102102
// MARK: - Initialisation Method
103-
public class func alert(title: String?,
104-
message: String?,
105-
textAlignment: NSTextAlignment,
106-
preferredStyle: CFAlertControllerStyle,
107-
didDismissAlertHandler dismiss: CFAlertViewControllerDismissBlock?) -> CFAlertViewController {
103+
public class func alertController(title: String?,
104+
message: String?,
105+
textAlignment: NSTextAlignment,
106+
preferredStyle: CFAlertControllerStyle,
107+
didDismissAlertHandler dismiss: CFAlertViewControllerDismissBlock?) -> CFAlertViewController {
108108

109-
return CFAlertViewController.alert(title: title,
110-
message: message,
111-
textAlignment: textAlignment,
112-
preferredStyle: preferredStyle,
113-
headerView: nil,
114-
footerView: nil,
115-
didDismissAlertHandler: dismiss)
116-
}
117-
118-
public class func alert(title: String?,
119-
message: String?,
120-
textAlignment: NSTextAlignment,
121-
preferredStyle: CFAlertControllerStyle,
122-
headerView: UIView?,
123-
footerView: UIView?,
124-
didDismissAlertHandler dismiss: CFAlertViewControllerDismissBlock?) -> CFAlertViewController {
109+
return CFAlertViewController.alertController(title: title,
110+
message: message,
111+
textAlignment: textAlignment,
112+
preferredStyle: preferredStyle,
113+
headerView: nil,
114+
footerView: nil,
115+
didDismissAlertHandler: dismiss)
116+
}
117+
118+
public class func alertController(title: String?,
119+
message: String?,
120+
textAlignment: NSTextAlignment,
121+
preferredStyle: CFAlertControllerStyle,
122+
headerView: UIView?,
123+
footerView: UIView?,
124+
didDismissAlertHandler dismiss: CFAlertViewControllerDismissBlock?) -> CFAlertViewController {
125125

126126
// Get Current Bundle
127127
let bundle = Bundle(for: CFAlertViewController.self)
@@ -415,7 +415,7 @@ public class CFAlertViewController: UIViewController {
415415
// MARK: - StatusBar Update Methods
416416
#if NS_EXTENSION_UNAVAILABLE_IOS
417417
override func prefersStatusBarHidden() -> Bool {
418-
return UIApplication.shared.statusBarHidden
418+
return UIApplication.shared.statusBarHidden
419419
}
420420
#endif
421421

Demo/CFAlertViewControllerDemo/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.0.3</string>
18+
<string>2.0.4</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Demo/CFAlertViewControllerDemo/View Controller/HomeTableViewController.m

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ - (IBAction) showAlertButtonClicked:(id)sender {
101101
}
102102

103103
// Create Alert
104-
CFAlertViewController *alert = [CFAlertViewController alertWithTitle:titleText
105-
message:descText
106-
textAlignment:[self getTextAlignment]
107-
preferredStyle:[self getAlertStyle]
108-
headerView:headerView
109-
footerView:footerView
110-
didDismissAlertHandler:^(BOOL isBackgroundTapped) {
111-
NSLog(@"Alert Dismissed");
112-
if (isBackgroundTapped) {
113-
// Handle background tap here
114-
NSLog(@"Alert background tapped");
115-
}
116-
}];
104+
CFAlertViewController *alert = [CFAlertViewController alertControllerWithTitle:titleText
105+
message:descText
106+
textAlignment:[self getTextAlignment]
107+
preferredStyle:[self getAlertStyle]
108+
headerView:headerView
109+
footerView:footerView
110+
didDismissAlertHandler:^(BOOL isBackgroundTapped) {
111+
NSLog(@"Alert Dismissed");
112+
if (isBackgroundTapped) {
113+
// Handle background tap here
114+
NSLog(@"Alert background tapped");
115+
}
116+
}];
117117

118118
// Add Alert Reference Into Footer View
119119
if (footerView && [footerView isKindOfClass:[TweetToIncreaseLimitView class]]) {
@@ -240,13 +240,13 @@ - (CFAlertControllerStyle) getAlertStyle {
240240

241241
- (void) showEmptyFieldsAlert {
242242

243-
CFAlertViewController *alert = [CFAlertViewController alertWithTitle:@"Oops!"
244-
message:@"Please set some properties of Alert view"
245-
textAlignment:NSTextAlignmentCenter
246-
preferredStyle:CFAlertControllerStyleAlert
247-
didDismissAlertHandler:^(BOOL isBackgroundTapped) {
248-
NSLog(@"Alert Dismissed");
249-
}];
243+
CFAlertViewController *alert = [CFAlertViewController alertControllerWithTitle:@"Oops!"
244+
message:@"Please set some properties of Alert view"
245+
textAlignment:NSTextAlignmentCenter
246+
preferredStyle:CFAlertControllerStyleAlert
247+
didDismissAlertHandler:^(BOOL isBackgroundTapped) {
248+
NSLog(@"Alert Dismissed");
249+
}];
250250

251251
[self presentViewController:alert animated:YES completion:nil];
252252
}

0 commit comments

Comments
 (0)