Skip to content

Commit 50f13c7

Browse files
Update Swift version to 5.0 and fix Objective-C compatibility
- Update all build configurations to use Swift 5.0 - Fix CFAlertAction initializer calls to include font parameter - Fix CFAlertViewController initializer calls to include titleFont, messageFont, and shadowColor parameters - Update podspec version to 3.2
1 parent 8cd400e commit 50f13c7

4 files changed

Lines changed: 26 additions & 21 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 = "3.1"
19+
s.version = "3.2"
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 => "v3.1" }
82+
s.source = { :git => "https://github.com/Codigami/CFAlertViewController.git", :tag => "v3.2" }
8383

8484

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

CFAlertViewController/CFAlertViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ open class CFAlertViewController: UIViewController {
386386
NotificationCenter.default
387387
.addObserver(self,
388388
selector: #selector(keyboardWillShow),
389-
name:.UIKeyboardWillShow,
389+
name: UIResponder.keyboardWillShowNotification,
390390
object: nil)
391391
NotificationCenter.default
392392
.addObserver(
393393
self,
394394
selector: #selector(keyboardWillHide),
395-
name: .UIKeyboardWillHide,
395+
name: UIResponder.keyboardWillHideNotification,
396396
object: nil
397397
)
398398

@@ -401,14 +401,14 @@ open class CFAlertViewController: UIViewController {
401401
.addObserver(
402402
self,
403403
selector: #selector(textViewOrTextFieldDidBeginEditing),
404-
name: .UITextFieldTextDidBeginEditing,
404+
name: UITextField.textDidBeginEditingNotification,
405405
object: nil
406406
)
407407
NotificationCenter.default
408408
.addObserver(
409409
self,
410410
selector: #selector(textViewOrTextFieldDidBeginEditing),
411-
name: .UITextViewTextDidBeginEditing,
411+
name: UITextView.textDidBeginEditingNotification,
412412
object: nil
413413
)
414414

@@ -659,7 +659,7 @@ open class CFAlertViewController: UIViewController {
659659

660660
let info: [AnyHashable: Any]? = notification.userInfo
661661
if let info = info {
662-
if let kbRect = info[UIKeyboardFrameEndUserInfoKey] as? CGRect {
662+
if let kbRect = info[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {
663663
if let viewRect = self.view.window?.convert(self.view.frame, from: self.view) {
664664
let intersectRect: CGRect = kbRect.intersection(viewRect)
665665
if intersectRect.size.height > 0.0 {
@@ -825,11 +825,11 @@ extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFA
825825
}
826826

827827
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
828-
return UITableViewAutomaticDimension
828+
return UITableView.automaticDimension
829829
}
830830

831831
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
832-
return UITableViewAutomaticDimension
832+
return UITableView.automaticDimension
833833
}
834834

835835

Demo/CFAlertViewControllerDemo.xcodeproj/project.pbxproj

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,9 @@
460460
};
461461
buildConfigurationList = 2F8E8FB61D181166004450F5 /* Build configuration list for PBXProject "CFAlertViewControllerDemo" */;
462462
compatibilityVersion = "Xcode 3.2";
463-
developmentRegion = English;
463+
developmentRegion = en;
464464
hasScannedForEncodings = 0;
465465
knownRegions = (
466-
English,
467466
en,
468467
Base,
469468
);
@@ -634,7 +633,7 @@
634633
TARGET_APP_EXTENSION,
635634
);
636635
INFOPLIST_FILE = CFAlertViewControllerShareExtensionDemo/Info.plist;
637-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
636+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
638637
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
639638
OTHER_SWIFT_FLAGS = "";
640639
PRODUCT_BUNDLE_IDENTIFIER = com.codigami.CFAlertViewControllerDemo.CFAlertViewControllerShareExtensionDemo;
@@ -643,7 +642,7 @@
643642
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
644643
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerShareExtensionDemo/CFAlertViewControllerShareExtensionDemo-Bridging-Header.h";
645644
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
646-
SWIFT_VERSION = 4.2;
645+
SWIFT_VERSION = 5.0;
647646
TARGETED_DEVICE_FAMILY = "1,2";
648647
};
649648
name = Debug;
@@ -660,14 +659,14 @@
660659
DEVELOPMENT_TEAM = "";
661660
GCC_C_LANGUAGE_STANDARD = gnu11;
662661
INFOPLIST_FILE = CFAlertViewControllerShareExtensionDemo/Info.plist;
663-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
662+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
664663
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
665664
OTHER_SWIFT_FLAGS = "";
666665
PRODUCT_BUNDLE_IDENTIFIER = com.codigami.CFAlertViewControllerDemo.CFAlertViewControllerShareExtensionDemo;
667666
PRODUCT_NAME = "$(TARGET_NAME)";
668667
SKIP_INSTALL = YES;
669668
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerShareExtensionDemo/CFAlertViewControllerShareExtensionDemo-Bridging-Header.h";
670-
SWIFT_VERSION = 4.2;
669+
SWIFT_VERSION = 5.0;
671670
TARGETED_DEVICE_FAMILY = "1,2";
672671
};
673672
name = Release;
@@ -724,7 +723,7 @@
724723
MTL_ENABLE_DEBUG_INFO = YES;
725724
ONLY_ACTIVE_ARCH = YES;
726725
SDKROOT = iphoneos;
727-
SWIFT_VERSION = 4.2;
726+
SWIFT_VERSION = 5.0;
728727
TARGETED_DEVICE_FAMILY = "1,2";
729728
};
730729
name = Debug;
@@ -775,7 +774,7 @@
775774
MTL_ENABLE_DEBUG_INFO = NO;
776775
SDKROOT = iphoneos;
777776
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
778-
SWIFT_VERSION = 4.2;
777+
SWIFT_VERSION = 5.0;
779778
TARGETED_DEVICE_FAMILY = "1,2";
780779
VALIDATE_PRODUCT = YES;
781780
};
@@ -790,7 +789,7 @@
790789
CODE_SIGN_IDENTITY = "iPhone Developer";
791790
DEVELOPMENT_TEAM = SXKNM4QXT9;
792791
INFOPLIST_FILE = CFAlertViewControllerDemo/Info.plist;
793-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
792+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
794793
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
795794
PRODUCT_BUNDLE_IDENTIFIER = com.codigami.CFAlertViewControllerDemo;
796795
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -812,7 +811,7 @@
812811
CODE_SIGN_IDENTITY = "iPhone Developer";
813812
DEVELOPMENT_TEAM = "";
814813
INFOPLIST_FILE = CFAlertViewControllerDemo/Info.plist;
815-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
814+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
816815
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
817816
PRODUCT_BUNDLE_IDENTIFIER = com.codigami.CFAlertViewControllerDemo;
818817
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -840,7 +839,7 @@
840839
PRODUCT_NAME = "$(TARGET_NAME)";
841840
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
842841
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
843-
SWIFT_VERSION = 4.2;
842+
SWIFT_VERSION = 5.0;
844843
TARGETED_DEVICE_FAMILY = "1,2";
845844
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFAlertViewControllerDemo.app/CFAlertViewControllerDemo";
846845
};
@@ -862,7 +861,7 @@
862861
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
863862
PRODUCT_BUNDLE_IDENTIFIER = Crowdfire.CFAlertViewControllerDemoTests;
864863
PRODUCT_NAME = "$(TARGET_NAME)";
865-
SWIFT_VERSION = 4.2;
864+
SWIFT_VERSION = 5.0;
866865
TARGETED_DEVICE_FAMILY = "1,2";
867866
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFAlertViewControllerDemo.app/CFAlertViewControllerDemo";
868867
};

Demo/CFAlertViewControllerDemo/View Controller/HomeTableViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@ - (IBAction) showAlertButtonClicked:(id)sender {
151151
// Create Alert
152152
CFAlertViewController *alert = [[CFAlertViewController alloc] initWithTitle:titleText
153153
titleColor:DEFAULT_TITLE_COLOR
154+
titleFont:nil
154155
message:descText
155156
messageColor:DEFAULT_MESSAGE_COLOR
157+
messageFont:nil
156158
textAlignment:[self getTextAlignment]
159+
shadowColor:nil
157160
preferredStyle:[self getAlertStyle]
158161
headerView:headerView
159162
footerView:footerView
@@ -191,6 +194,7 @@ - (IBAction) showAlertButtonClicked:(id)sender {
191194
// Add Default Button Action
192195
if (self.actionDefaultSwitch.isOn) {
193196
CFAlertAction *actionDefault = [[CFAlertAction alloc] initWithTitle:DEFAULT_BTN_TITLE
197+
font:nil
194198
style:CFAlertActionStyleDefault
195199
alignment:[self getActionsTextAlignment]
196200
backgroundColor:DEFAULT_BTN_COLOR
@@ -204,6 +208,7 @@ - (IBAction) showAlertButtonClicked:(id)sender {
204208
// Add Destructive Button Action
205209
if (self.actionDestructiveSwitch.isOn) {
206210
CFAlertAction *actionDestruct = [[CFAlertAction alloc] initWithTitle:DESTRUCTIVE_BTN_TITLE
211+
font:nil
207212
style:CFAlertActionStyleDestructive
208213
alignment:[self getActionsTextAlignment]
209214
backgroundColor:DESTRUCTIVE_BTN_COLOR
@@ -217,6 +222,7 @@ - (IBAction) showAlertButtonClicked:(id)sender {
217222
// Add Cancel Button Action
218223
if (self.actionCancelSwitch.isOn) {
219224
CFAlertAction *actionCancel = [[CFAlertAction alloc] initWithTitle:CANCEL_BTN_TITLE
225+
font:nil
220226
style:CFAlertActionStyleCancel
221227
alignment:[self getActionsTextAlignment]
222228
backgroundColor:CANCEL_BTN_COLOR

0 commit comments

Comments
 (0)