Skip to content

Commit 05718ea

Browse files
committed
XCode 10 and swift 4.2 support added
1 parent 6e87272 commit 05718ea

11 files changed

Lines changed: 44 additions & 40 deletions

File tree

CFAlertViewController/CFAlertViewController.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ open class CFAlertViewController: UIViewController {
2929
case plain = 0
3030
case blur
3131
}
32-
@objc open static func CF_ALERT_DEFAULT_BACKGROUND_COLOR() -> UIColor {
32+
@objc public static func CF_ALERT_DEFAULT_BACKGROUND_COLOR() -> UIColor {
3333
return UIColor(white: 0.0, alpha: 0.7)
3434
}
35-
@objc open static func CF_ALERT_DEFAULT_CONTAINER_VIEW_BACKGROUND_COLOR() -> UIColor {
35+
@objc public static func CF_ALERT_DEFAULT_CONTAINER_VIEW_BACKGROUND_COLOR() -> UIColor {
3636
return UIColor.white
3737
}
38-
@objc open static func CF_ALERT_DEFAULT_TITLE_COLOR() -> UIColor {
38+
@objc public static func CF_ALERT_DEFAULT_TITLE_COLOR() -> UIColor {
3939
return UIColor.black
4040
}
41-
@objc open static func CF_ALERT_DEFAULT_MESSAGE_COLOR() -> UIColor {
41+
@objc public static func CF_ALERT_DEFAULT_MESSAGE_COLOR() -> UIColor {
4242
return UIColor.darkGray
4343
}
4444

@@ -73,7 +73,7 @@ open class CFAlertViewController: UIViewController {
7373
// For iOS version 8, 9 & 10 add table view top inset to leave space for status bar
7474
if let tableView = self.tableView {
7575
let statusbarHeight : CGFloat = self.topLayoutGuide.length
76-
tableView.contentInset = UIEdgeInsetsMake(statusbarHeight, tableView.contentInset.left, tableView.contentInset.bottom, tableView.contentInset.right)
76+
tableView.contentInset = UIEdgeInsets.init(top: statusbarHeight, left: tableView.contentInset.left, bottom: tableView.contentInset.bottom, right: tableView.contentInset.right)
7777
tableView.scrollIndicatorInsets = tableView.contentInset
7878
}
7979
}
@@ -356,12 +356,12 @@ open class CFAlertViewController: UIViewController {
356356
internal func loadVariables() {
357357

358358
// Register For Keyboard Notification Observer
359-
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
360-
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
359+
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
360+
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
361361

362362
// Text Field & Text View Notifications
363-
NotificationCenter.default.addObserver(self, selector: #selector(textViewOrTextFieldDidBeginEditing), name: NSNotification.Name.UITextFieldTextDidBeginEditing, object: nil)
364-
NotificationCenter.default.addObserver(self, selector: #selector(textViewOrTextFieldDidBeginEditing), name: NSNotification.Name.UITextViewTextDidBeginEditing, object: nil)
363+
NotificationCenter.default.addObserver(self, selector: #selector(textViewOrTextFieldDidBeginEditing), name: UITextField.textDidBeginEditingNotification, object: nil)
364+
NotificationCenter.default.addObserver(self, selector: #selector(textViewOrTextFieldDidBeginEditing), name: UITextView.textDidBeginEditingNotification, object: nil)
365365

366366
// Register Cells For Table
367367
let actionCellNib = UINib(nibName: CFAlertActionTableViewCell.identifier(), bundle: Bundle(for: CFAlertActionTableViewCell.self))
@@ -604,7 +604,7 @@ open class CFAlertViewController: UIViewController {
604604

605605
let info: [AnyHashable: Any]? = notification.userInfo
606606
if let info = info {
607-
if let kbRect = info[UIKeyboardFrameEndUserInfoKey] as? CGRect {
607+
if let kbRect = info[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {
608608
if let viewRect = self.view.window?.convert(self.view.frame, from: self.view) {
609609
let intersectRect: CGRect = kbRect.intersection(viewRect)
610610
if intersectRect.size.height > 0.0 {
@@ -781,11 +781,11 @@ extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFA
781781
}
782782

783783
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
784-
return UITableViewAutomaticDimension
784+
return UITableView.automaticDimension
785785
}
786786

787787
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
788-
return UITableViewAutomaticDimension
788+
return UITableView.automaticDimension
789789
}
790790

791791

CFAlertViewController/Cells/CFAlertActionTableViewCell.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,31 +115,31 @@ public class CFAlertActionTableViewCell: UITableViewCell {
115115
actionButtonCenterXConstraint?.isActive = false
116116
actionButtonTrailingConstraint?.priority = UILayoutPriority(rawValue: 751.0)
117117
// Set Content Edge Inset
118-
actionButton?.contentEdgeInsets = UIEdgeInsetsMake(12.0, 20.0, 12.0, 20.0)
118+
actionButton?.contentEdgeInsets = UIEdgeInsets.init(top: 12.0, left: 20.0, bottom: 12.0, right: 20.0)
119119

120120
case .left:
121121
// Left Align
122122
actionButtonLeadingConstraint?.priority = UILayoutPriority(rawValue: 751.0)
123123
actionButtonCenterXConstraint?.isActive = false
124124
actionButtonTrailingConstraint?.priority = UILayoutPriority(rawValue: 749.0)
125125
// Set Content Edge Inset
126-
actionButton?.contentEdgeInsets = UIEdgeInsetsMake(12.0, 20.0, 12.0, 20.0)
126+
actionButton?.contentEdgeInsets = UIEdgeInsets.init(top: 12.0, left: 20.0, bottom: 12.0, right: 20.0)
127127

128128
case .center:
129129
// Center Align
130130
actionButtonLeadingConstraint?.priority = UILayoutPriority(rawValue: 750.0)
131131
actionButtonCenterXConstraint?.isActive = true
132132
actionButtonTrailingConstraint?.priority = UILayoutPriority(rawValue: 750.0)
133133
// Set Content Edge Inset
134-
actionButton?.contentEdgeInsets = UIEdgeInsetsMake(12.0, 20.0, 12.0, 20.0)
134+
actionButton?.contentEdgeInsets = UIEdgeInsets.init(top: 12.0, left: 20.0, bottom: 12.0, right: 20.0)
135135

136136
default:
137137
// Justified Align
138138
actionButtonLeadingConstraint?.priority = UILayoutPriority(rawValue: 751.0)
139139
actionButtonCenterXConstraint?.isActive = false
140140
actionButtonTrailingConstraint?.priority = UILayoutPriority(rawValue: 751.0)
141141
// Set Content Edge Inset
142-
actionButton?.contentEdgeInsets = UIEdgeInsetsMake(15.0, 20.0, 15.0, 20.0)
142+
actionButton?.contentEdgeInsets = UIEdgeInsets.init(top: 15.0, left: 20.0, bottom: 15.0, right: 20.0)
143143
}
144144

145145
// Set Title
@@ -167,7 +167,7 @@ public class CFAlertActionTableViewCell: UITableViewCell {
167167
basicInitialisation()
168168
}
169169

170-
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
170+
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
171171
super.init(style: style, reuseIdentifier: reuseIdentifier)
172172
// Initialization code
173173
basicInitialisation()

CFAlertViewController/Cells/CFAlertTitleSubtitleTableViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
6464
basicInitialisation()
6565
}
6666

67-
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
67+
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
6868
super.init(style: style, reuseIdentifier: reuseIdentifier)
6969

7070
// Initialization code

CFAlertViewController/Transitions/Action Sheet/CFAlertActionSheetTransitionGestureRecognizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CFAlertActionSheetTransitionGestureRecognizer: CFAlertBaseTransitionGestur
3535
let nowPoint = touches.first?.location(in: view) ?? CGPoint.zero
3636
let prevPoint = touches.first?.previousLocation(in: view) ?? CGPoint.zero
3737

38-
if ((fabs(velocity.x) < fabs(velocity.y)) &&
38+
if ((abs(velocity.x) < abs(velocity.y)) &&
3939
(nowPoint.y > prevPoint.y) &&
4040
(scrollView.contentOffset.y <= 0))
4141
{

CFAlertViewController/Transitions/Notification/CFAlertNotificationTransitionGestureRecognizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CFAlertNotificationTransitionGestureRecognizer: CFAlertBaseTransitionGestu
3535
let nowPoint = touches.first?.location(in: view) ?? CGPoint.zero
3636
let prevPoint = touches.first?.previousLocation(in: view) ?? CGPoint.zero
3737

38-
if ((fabs(velocity.x) < fabs(velocity.y)) &&
38+
if ((abs(velocity.x) < abs(velocity.y)) &&
3939
(nowPoint.y < prevPoint.y) &&
4040
(scrollView.contentOffset.y >= (scrollView.contentSize.height-scrollView.frame.size.height)))
4141
{

Demo/CFAlertViewControllerDemo.xcodeproj/project.pbxproj

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,23 +435,25 @@
435435
isa = PBXProject;
436436
attributes = {
437437
LastSwiftUpdateCheck = 0900;
438-
LastUpgradeCheck = 0900;
438+
LastUpgradeCheck = 1000;
439439
ORGANIZATIONNAME = "Codigami Inc";
440440
TargetAttributes = {
441441
2F62989D1F5FF8B70010273C = {
442442
CreatedOnToolsVersion = 9.0;
443443
DevelopmentTeam = SXKNM4QXT9;
444+
LastSwiftMigration = 1000;
444445
ProvisioningStyle = Automatic;
445446
};
446447
2F8E8FBA1D181166004450F5 = {
447448
CreatedOnToolsVersion = 7.3.1;
448449
DevelopmentTeam = SXKNM4QXT9;
449-
LastSwiftMigration = 0900;
450+
LastSwiftMigration = 1000;
450451
ProvisioningStyle = Manual;
451452
};
452453
2FFE3C281F053DA800CB815A = {
453454
CreatedOnToolsVersion = 9.0;
454455
DevelopmentTeam = SXKNM4QXT9;
456+
LastSwiftMigration = 1000;
455457
TestTargetID = 2F8E8FBA1D181166004450F5;
456458
};
457459
};
@@ -640,7 +642,7 @@
640642
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
641643
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerShareExtensionDemo/CFAlertViewControllerShareExtensionDemo-Bridging-Header.h";
642644
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
643-
SWIFT_VERSION = 4.0;
645+
SWIFT_VERSION = 4.2;
644646
TARGETED_DEVICE_FAMILY = "1,2";
645647
};
646648
name = Debug;
@@ -664,7 +666,7 @@
664666
PRODUCT_NAME = "$(TARGET_NAME)";
665667
SKIP_INSTALL = YES;
666668
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerShareExtensionDemo/CFAlertViewControllerShareExtensionDemo-Bridging-Header.h";
667-
SWIFT_VERSION = 4.0;
669+
SWIFT_VERSION = 4.2;
668670
TARGETED_DEVICE_FAMILY = "1,2";
669671
};
670672
name = Release;
@@ -682,12 +684,14 @@
682684
CLANG_WARN_BOOL_CONVERSION = YES;
683685
CLANG_WARN_COMMA = YES;
684686
CLANG_WARN_CONSTANT_CONVERSION = YES;
687+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
685688
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
686689
CLANG_WARN_EMPTY_BODY = YES;
687690
CLANG_WARN_ENUM_CONVERSION = YES;
688691
CLANG_WARN_INFINITE_RECURSION = YES;
689692
CLANG_WARN_INT_CONVERSION = YES;
690693
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
694+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
691695
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
692696
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
693697
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -735,12 +739,14 @@
735739
CLANG_WARN_BOOL_CONVERSION = YES;
736740
CLANG_WARN_COMMA = YES;
737741
CLANG_WARN_CONSTANT_CONVERSION = YES;
742+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
738743
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
739744
CLANG_WARN_EMPTY_BODY = YES;
740745
CLANG_WARN_ENUM_CONVERSION = YES;
741746
CLANG_WARN_INFINITE_RECURSION = YES;
742747
CLANG_WARN_INT_CONVERSION = YES;
743748
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
749+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
744750
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
745751
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
746752
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -786,8 +792,7 @@
786792
PROVISIONING_PROFILE_SPECIFIER = "Wildcard Provisioning Profile";
787793
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerDemo/CFAlertViewControllerDemo-Bridging-Header.h";
788794
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
789-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
790-
SWIFT_VERSION = 4.0;
795+
SWIFT_VERSION = 4.2;
791796
};
792797
name = Debug;
793798
};
@@ -804,8 +809,7 @@
804809
PRODUCT_BUNDLE_IDENTIFIER = com.codigami.CFAlertViewControllerDemo;
805810
PRODUCT_NAME = "$(TARGET_NAME)";
806811
SWIFT_OBJC_BRIDGING_HEADER = "CFAlertViewControllerDemo/CFAlertViewControllerDemo-Bridging-Header.h";
807-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
808-
SWIFT_VERSION = 4.0;
812+
SWIFT_VERSION = 4.2;
809813
};
810814
name = Release;
811815
};
@@ -827,7 +831,7 @@
827831
PRODUCT_NAME = "$(TARGET_NAME)";
828832
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
829833
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
830-
SWIFT_VERSION = 4.0;
834+
SWIFT_VERSION = 4.2;
831835
TARGETED_DEVICE_FAMILY = "1,2";
832836
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFAlertViewControllerDemo.app/CFAlertViewControllerDemo";
833837
};
@@ -849,7 +853,7 @@
849853
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
850854
PRODUCT_BUNDLE_IDENTIFIER = Crowdfire.CFAlertViewControllerDemoTests;
851855
PRODUCT_NAME = "$(TARGET_NAME)";
852-
SWIFT_VERSION = 4.0;
856+
SWIFT_VERSION = 4.2;
853857
TARGETED_DEVICE_FAMILY = "1,2";
854858
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFAlertViewControllerDemo.app/CFAlertViewControllerDemo";
855859
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Demo/CFAlertViewControllerDemo.xcodeproj/xcshareddata/xcschemes/CFAlertViewController_App_Demo.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "1000"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -66,7 +65,6 @@
6665
buildConfiguration = "Debug"
6766
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6867
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69-
language = ""
7068
launchStyle = "0"
7169
useCustomWorkingDirectory = "NO"
7270
ignoresPersistentStateOnLaunch = "NO"

Demo/CFAlertViewControllerDemo.xcodeproj/xcshareddata/xcschemes/CFAlertViewController_ShareExtension_Demo.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "1000"
44
wasCreatedForAppExtension = "YES"
55
version = "2.0">
66
<BuildAction
@@ -41,7 +41,6 @@
4141
buildConfiguration = "Debug"
4242
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4343
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
44-
language = ""
4544
shouldUseLaunchSchemeArgsEnv = "YES">
4645
<Testables>
4746
</Testables>
@@ -61,7 +60,6 @@
6160
buildConfiguration = "Debug"
6261
selectedDebuggerIdentifier = ""
6362
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
64-
language = ""
6563
launchStyle = "0"
6664
useCustomWorkingDirectory = "NO"
6765
ignoresPersistentStateOnLaunch = "NO"

0 commit comments

Comments
 (0)