From 8a6b315a8061aa1a596124b6478972c141798f24 Mon Sep 17 00:00:00 2001 From: Guillaume Sempe Date: Fri, 14 Sep 2018 15:28:00 +0100 Subject: [PATCH 1/3] Update code for Swift 4.1 --- DBAlertController.xcodeproj/project.pbxproj | 8 ++++---- Source/DBAlertController.swift | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DBAlertController.xcodeproj/project.pbxproj b/DBAlertController.xcodeproj/project.pbxproj index 22e9351..9199871 100644 --- a/DBAlertController.xcodeproj/project.pbxproj +++ b/DBAlertController.xcodeproj/project.pbxproj @@ -192,7 +192,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -233,7 +233,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -257,7 +257,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -276,7 +276,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.dylanbettermann.DBAlertController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Source/DBAlertController.swift b/Source/DBAlertController.swift index b4ba729..351da92 100644 --- a/Source/DBAlertController.swift +++ b/Source/DBAlertController.swift @@ -12,9 +12,9 @@ public class DBAlertController: UIAlertController { /// The UIWindow that will be at the top of the window hierarchy. The DBAlertController instance is presented on the rootViewController of this window. private lazy var alertWindow: UIWindow = { - let window = UIWindow(frame: UIScreen.mainScreen().bounds) + let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = DBClearViewController() - window.backgroundColor = UIColor.clearColor() + window.backgroundColor = UIColor.clear window.windowLevel = UIWindowLevelAlert return window }() @@ -29,7 +29,7 @@ public class DBAlertController: UIAlertController { if let rootViewController = alertWindow.rootViewController { alertWindow.makeKeyAndVisible() - rootViewController.presentViewController(self, animated: flag, completion: completion) + rootViewController.present(self, animated: flag, completion: completion) } } @@ -38,12 +38,12 @@ public class DBAlertController: UIAlertController { // In the case of view controller-based status bar style, make sure we use the same style for our view controller private class DBClearViewController: UIViewController { - private override func preferredStatusBarStyle() -> UIStatusBarStyle { - return UIApplication.sharedApplication().statusBarStyle + override var preferredStatusBarStyle: UIStatusBarStyle { + return UIApplication.shared.statusBarStyle } - - private override func prefersStatusBarHidden() -> Bool { - return UIApplication.sharedApplication().statusBarHidden + + override var prefersStatusBarHidden: Bool { + return UIApplication.shared.isStatusBarHidden } - + } From f0980053b2fe2df92e807085486aed76dcb1774f Mon Sep 17 00:00:00 2001 From: Guillaume Sempe Date: Fri, 14 Sep 2018 15:29:45 +0100 Subject: [PATCH 2/3] Change access control The public part of DBAlertController should be declared as open to permit subclassing --- Source/DBAlertController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DBAlertController.swift b/Source/DBAlertController.swift index 351da92..5d4f58c 100644 --- a/Source/DBAlertController.swift +++ b/Source/DBAlertController.swift @@ -8,7 +8,7 @@ import UIKit -public class DBAlertController: UIAlertController { +open class DBAlertController: UIAlertController { /// The UIWindow that will be at the top of the window hierarchy. The DBAlertController instance is presented on the rootViewController of this window. private lazy var alertWindow: UIWindow = { From d063ce3678dcda2cc682432bb527ddb290c61af4 Mon Sep 17 00:00:00 2001 From: Guillaume Sempe Date: Fri, 14 Dec 2018 17:06:52 +0000 Subject: [PATCH 3/3] Update podspec to publish on cocoapods --- DBAlertController.podspec | 15 --------------- ONCEAlertController.podspec | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 DBAlertController.podspec create mode 100644 ONCEAlertController.podspec diff --git a/DBAlertController.podspec b/DBAlertController.podspec deleted file mode 100644 index d1cb4bd..0000000 --- a/DBAlertController.podspec +++ /dev/null @@ -1,15 +0,0 @@ -Pod::Spec.new do |s| - s.name = "DBAlertController" - s.version = "0.3.0" - s.summary = "A UIAlertController subclass that's independent of the view controller it's presented from." - s.homepage = "https://github.com/dbettermann/DBAlertController" - s.license = 'MIT' - s.author = { "Dylan Bettermann" => "dylan.bettermann@gmail.com" } - s.source = { :git => "https://github.com/dbettermann/DBAlertController.git", :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/dbettermann' - - s.platform = :ios, '8.0' - s.requires_arc = true - - s.source_files = 'Source/*.swift' -end diff --git a/ONCEAlertController.podspec b/ONCEAlertController.podspec new file mode 100644 index 0000000..f5d15f0 --- /dev/null +++ b/ONCEAlertController.podspec @@ -0,0 +1,16 @@ +Pod::Spec.new do |s| + s.name = "ONCEAlertController" + s.version = "1.0.0" + s.summary = "A UIAlertController subclass that's independent of the view controller it's presented from." + s.homepage = "https://github.com/OnceApp/ONCEAlertController" + s.license = 'MIT' + s.author = { "Guillaume Sempe" => "guillaume@getonce.com" } + s.source = { :git => "https://github.com/OnceApp/ONCEAlertController.git", :tag => s.version.to_s } + s.social_media_url = 'https://twitter.com/oncetheapp' + + s.platform = :ios, '10.0' + s.swift_version = '4.1' + s.requires_arc = true + + s.source_files = 'Source/*.swift' +end