From c48bf2fa062b65965c87ea76712e1c21166bf625 Mon Sep 17 00:00:00 2001 From: Brady Svedin Date: Thu, 26 Sep 2019 15:36:23 -0600 Subject: [PATCH 1/2] Swift-5 Updated to work with swift 5 --- Pod/Classes/LKAlertController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pod/Classes/LKAlertController.swift b/Pod/Classes/LKAlertController.swift index 77e6f3f..01b56f2 100644 --- a/Pod/Classes/LKAlertController.swift +++ b/Pod/Classes/LKAlertController.swift @@ -187,8 +187,8 @@ public class LKAlertController { let popoverController = alertController.popoverPresentationController { var topController = presentedController - while (topController.children.last != nil) { - topController = topController.children.last! + while (topController.childViewControllers.last != nil) { + topController = topController.childViewControllers.last! } popoverController.sourceView = topController.view @@ -316,7 +316,7 @@ public class Alert: LKAlertController { } if(required) { - NotificationCenter.default.addObserver(forName: UITextField.textDidChangeNotification, object: field, queue: OperationQueue.main) { (notification) in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextFieldTextDidChange, object: field, queue: OperationQueue.main) { (notification) in if let actionButton = self.alertPrimaryAction { actionButton.isEnabled = field?.text?.isEmpty == false } From 108a4402bd62f485d5080c93c11317dfb026004a Mon Sep 17 00:00:00 2001 From: Radu Ursache Date: Thu, 10 Jun 2021 20:28:06 +0300 Subject: [PATCH 2/2] - fixed for swift 5.4 - added SPM support --- .../contents.xcworkspacedata | 7 +++++++ Package.swift | 21 +++++++++++++++++++ Pod/Classes/LKAlertController.swift | 8 +++---- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Package.swift diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..84593c6 --- /dev/null +++ b/Package.swift @@ -0,0 +1,21 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "LKAlertController", + platforms: [.iOS(.v9), .tvOS(.v9)], + products: [ + .library( + name: "LKAlertController", + targets: ["LKAlertController"] + ), + ], + targets: [ + .target( + name: "LKAlertController", + path: "Pod/Classes" + ) + ], + swiftLanguageVersions: [.v5] +) diff --git a/Pod/Classes/LKAlertController.swift b/Pod/Classes/LKAlertController.swift index 01b56f2..647e981 100644 --- a/Pod/Classes/LKAlertController.swift +++ b/Pod/Classes/LKAlertController.swift @@ -187,8 +187,8 @@ public class LKAlertController { let popoverController = alertController.popoverPresentationController { var topController = presentedController - while (topController.childViewControllers.last != nil) { - topController = topController.childViewControllers.last! + while (topController.children.last != nil) { + topController = topController.children.last! } popoverController.sourceView = topController.view @@ -315,8 +315,8 @@ public class Alert: LKAlertController { field = tf } - if(required) { - NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextFieldTextDidChange, object: field, queue: OperationQueue.main) { (notification) in + if (required) { + NotificationCenter.default.addObserver(forName: UITextField.textDidChangeNotification, object: field, queue: OperationQueue.main) { (notification) in if let actionButton = self.alertPrimaryAction { actionButton.isEnabled = field?.text?.isEmpty == false }