diff --git a/.travis.yml b/.travis.yml index dba511b..82504a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c #1 -osx_image: xcode9.3 #2 +osx_image: xcode10.3 #2 xcode_workspace: Example/EPSignature.xcworkspace #3 xcode_scheme: EPSignature #4 xcode_sdk: iphonesimulator10.3 #5 diff --git a/Example/EPSignature.xcodeproj/project.pbxproj b/Example/EPSignature.xcodeproj/project.pbxproj index 56fba5a..845b492 100644 --- a/Example/EPSignature.xcodeproj/project.pbxproj +++ b/Example/EPSignature.xcodeproj/project.pbxproj @@ -204,18 +204,18 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = DG779MAMM2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = DG779MAMM2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -424,12 +424,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -477,12 +479,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -523,7 +527,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -540,7 +544,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -560,7 +564,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EPSignature_Example.app/EPSignature_Example"; }; name = Debug; @@ -576,7 +580,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EPSignature_Example.app/EPSignature_Example"; }; name = Release; diff --git a/Example/EPSignature.xcodeproj/xcshareddata/xcschemes/EPSignature-Example.xcscheme b/Example/EPSignature.xcodeproj/xcshareddata/xcschemes/EPSignature-Example.xcscheme index 06b4881..493afb6 100644 --- a/Example/EPSignature.xcodeproj/xcshareddata/xcschemes/EPSignature-Example.xcscheme +++ b/Example/EPSignature.xcodeproj/xcshareddata/xcschemes/EPSignature-Example.xcscheme @@ -1,6 +1,6 @@ Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { // Application launch state return true } diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index dd9e263..91a0e9d 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -321,10 +321,10 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1010; TargetAttributes = { 19D6D9705482D1B9CB1C3F1D8CC28599 = { - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; }; }; }; @@ -428,7 +428,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -551,6 +551,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -558,6 +559,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -606,6 +608,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -613,6 +616,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -710,7 +714,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Pod/Classes/EPExtensions.swift b/Pod/Classes/EPExtensions.swift index 17a3610..7bcd773 100644 --- a/Pod/Classes/EPExtensions.swift +++ b/Pod/Classes/EPExtensions.swift @@ -17,10 +17,10 @@ extension UIViewController { } func showAlert(_ message: String, andTitle title: String) { - let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) + let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) // add an action (button) - alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) // show the alert self.present(alert, animated: true, completion: nil) diff --git a/Pod/Classes/EPSignatureViewController.swift b/Pod/Classes/EPSignatureViewController.swift index 249d3b8..005af53 100644 --- a/Pod/Classes/EPSignatureViewController.swift +++ b/Pod/Classes/EPSignatureViewController.swift @@ -30,22 +30,25 @@ open class EPSignatureViewController: UIViewController { open var showsDate: Bool = true open var showsSaveSignatureOption: Bool = true + open var alertTitle: String = "Please draw your signature" + open var alertMessage: String = "You did not sign" open weak var signatureDelegate: EPSignatureDelegate? open var subtitleText = "Sign Here" open var tintColor = UIColor.defaultTintColor() + open var statusBarStyle: UIStatusBarStyle? // MARK: - Life cycle methods override open func viewDidLoad() { super.viewDidLoad() - let cancelButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.cancel, target: self, action: #selector(EPSignatureViewController.onTouchCancelButton)) + let cancelButton = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(EPSignatureViewController.onTouchCancelButton)) cancelButton.tintColor = tintColor self.navigationItem.leftBarButtonItem = cancelButton - let doneButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.done, target: self, action: #selector(EPSignatureViewController.onTouchDoneButton)) + let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(EPSignatureViewController.onTouchDoneButton)) doneButton.tintColor = tintColor - let clearButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.trash, target: self, action: #selector(EPSignatureViewController.onTouchClearButton)) + let clearButton = UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(EPSignatureViewController.onTouchClearButton)) clearButton.tintColor = tintColor if showsDate { @@ -58,12 +61,13 @@ open class EPSignatureViewController: UIViewController { } if showsSaveSignatureOption { - let actionButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action, target: self, action: #selector(EPSignatureViewController.onTouchActionButton(_:))) + let actionButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(EPSignatureViewController.onTouchActionButton(_:))) actionButton.tintColor = tintColor self.navigationItem.rightBarButtonItems = [doneButton, clearButton, actionButton] switchSaveSignature.onTintColor = tintColor } else { - self.navigationItem.rightBarButtonItems = [doneButton, clearButton] + self.navigationItem.rightBarButtonItems = [doneButton] + self.navigationItem.leftBarButtonItems = [cancelButton, clearButton] lblDefaultSignature.isHidden = true switchSaveSignature.isHidden = true } @@ -71,6 +75,10 @@ open class EPSignatureViewController: UIViewController { lblSignatureSubtitle.text = subtitleText switchSaveSignature.setOn(false, animated: true) } + + open override var preferredStatusBarStyle: UIStatusBarStyle { + return statusBarStyle ?? .default + } override open func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() @@ -116,25 +124,25 @@ open class EPSignatureViewController: UIViewController { signatureDelegate?.epSignature!(self, didSign: signature, boundingRect: signatureView.getSignatureBoundsInCanvas()) dismiss(animated: true, completion: nil) } else { - showAlert("You did not sign", andTitle: "Please draw your signature") + showAlert(alertMessage, andTitle: alertTitle) } } @objc func onTouchActionButton(_ barButton: UIBarButtonItem) { - let action = UIAlertController(title: "Action", message: "", preferredStyle: UIAlertControllerStyle.actionSheet) + let action = UIAlertController(title: "Action", message: "", preferredStyle: .actionSheet) action.view.tintColor = tintColor - action.addAction(UIAlertAction(title: "Load default signature", style: UIAlertActionStyle.default, handler: { action in + action.addAction(UIAlertAction(title: "Load default signature", style: .default, handler: { action in let docPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first let filePath = (docPath! as NSString).appendingPathComponent("sig.data") self.signatureView.loadSignature(filePath) })) - action.addAction(UIAlertAction(title: "Delete default signature", style: UIAlertActionStyle.destructive, handler: { action in + action.addAction(UIAlertAction(title: "Delete default signature", style: .destructive, handler: { action in self.signatureView.removeSignature() })) - action.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)) + action.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) if let popOver = action.popoverPresentationController { popOver.barButtonItem = barButton