diff --git a/CHANGELOG.md b/CHANGELOG.md index 25301d42..4f3d5696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +* **0.8.0** Separated tap and pan gesture dismissal * **0.7.1** Fixes Objective-C compatability
Improved Carthage handling * **0.7.0** Removed FXBlurView while switching to DynamicBlurView * **0.6.2** Added preferredWidth option for iPads diff --git a/Example/.swiftlint.yml b/Example/.swiftlint.yml index 535d12d6..bf3d9133 100644 --- a/Example/.swiftlint.yml +++ b/Example/.swiftlint.yml @@ -48,3 +48,9 @@ line_length: type_body_length: - 400 #warning - 500 #error + +identifier_name: + excluded: + - id + - vc + - to diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 59b64b05..ac3cb39d 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -6,9 +6,9 @@ PODS: - FBSnapshotTestCase/SwiftSupport (2.1.4): - FBSnapshotTestCase/Core - Nimble (7.0.3) - - PopupDialog (0.7.1): + - PopupDialog (0.8.0): - DynamicBlurView (~> 2.0) - - SwiftLint (0.25.0) + - SwiftLint (0.26.0) DEPENDENCIES: - FBSnapshotTestCase (from `https://github.com/facebook/ios-snapshot-test-case.git`, commit `ed4e6a6`) @@ -32,8 +32,8 @@ SPEC CHECKSUMS: DynamicBlurView: aa6db4defc6e537eb86fc5e58dd3991666178399 FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac - PopupDialog: 7b2ad0681c470eb159c33a17c4c3109debd65d5a - SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea + PopupDialog: 764c106b6ab9175958cf189175fad612a334d87d + SwiftLint: f6b83e8d95ee1e91e11932d843af4fdcbf3fc764 PODFILE CHECKSUM: 7a27ac877c3a93aa83583a4625417841e72145e5 diff --git a/Example/Pods/Local Podspecs/PopupDialog.podspec.json b/Example/Pods/Local Podspecs/PopupDialog.podspec.json index 36be5221..ebf92dbe 100644 --- a/Example/Pods/Local Podspecs/PopupDialog.podspec.json +++ b/Example/Pods/Local Podspecs/PopupDialog.podspec.json @@ -1,6 +1,6 @@ { "name": "PopupDialog", - "version": "0.7.1", + "version": "0.8.0", "summary": "A simple custom popup dialog view controller", "homepage": "https://github.com/orderella/PopupDialog", "license": { @@ -12,7 +12,7 @@ }, "source": { "git": "https://github.com/orderella/PopupDialog.git", - "tag": "0.7.1" + "tag": "0.8.0" }, "social_media_url": "https://twitter.com/theMWFire", "platforms": { diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index 59b64b05..ac3cb39d 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -6,9 +6,9 @@ PODS: - FBSnapshotTestCase/SwiftSupport (2.1.4): - FBSnapshotTestCase/Core - Nimble (7.0.3) - - PopupDialog (0.7.1): + - PopupDialog (0.8.0): - DynamicBlurView (~> 2.0) - - SwiftLint (0.25.0) + - SwiftLint (0.26.0) DEPENDENCIES: - FBSnapshotTestCase (from `https://github.com/facebook/ios-snapshot-test-case.git`, commit `ed4e6a6`) @@ -32,8 +32,8 @@ SPEC CHECKSUMS: DynamicBlurView: aa6db4defc6e537eb86fc5e58dd3991666178399 FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac - PopupDialog: 7b2ad0681c470eb159c33a17c4c3109debd65d5a - SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea + PopupDialog: 764c106b6ab9175958cf189175fad612a334d87d + SwiftLint: f6b83e8d95ee1e91e11932d843af4fdcbf3fc764 PODFILE CHECKSUM: 7a27ac877c3a93aa83583a4625417841e72145e5 diff --git a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/PopupDialog.xcscheme b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/PopupDialog.xcscheme index 420ec50a..034b2ef3 100644 --- a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/PopupDialog.xcscheme +++ b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/PopupDialog.xcscheme @@ -1,6 +1,6 @@ @@ -26,7 +26,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" shouldUseLaunchSchemeArgsEnv = "YES"> @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" @@ -47,7 +45,7 @@ @@ -65,7 +63,7 @@ diff --git a/Example/Pods/SwiftLint/swiftlint b/Example/Pods/SwiftLint/swiftlint index e0d594b3..ec57d674 100755 Binary files a/Example/Pods/SwiftLint/swiftlint and b/Example/Pods/SwiftLint/swiftlint differ diff --git a/Example/Pods/Target Support Files/PopupDialog/Info.plist b/Example/Pods/Target Support Files/PopupDialog/Info.plist index cc1a0c65..2cf03a7f 100644 --- a/Example/Pods/Target Support Files/PopupDialog/Info.plist +++ b/Example/Pods/Target Support Files/PopupDialog/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.7.1 + 0.8.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/PopupDialog.xcodeproj/project.pbxproj b/Example/PopupDialog.xcodeproj/project.pbxproj index 25ee86af..9438437a 100644 --- a/Example/PopupDialog.xcodeproj/project.pbxproj +++ b/Example/PopupDialog.xcodeproj/project.pbxproj @@ -76,7 +76,7 @@ C7A6674A1D3D030200DE5036 /* Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Tests.swift; path = ../Tests/Tests.swift; sourceTree = SOURCE_ROOT; }; C7EA1E081E2A181A009D3044 /* PopupDialog_UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PopupDialog_UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C7EA1E381E2D57FE009D3044 /* SnapshotTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotTests.swift; path = ../Tests/SnapshotTests.swift; sourceTree = SOURCE_ROOT; }; - DF1B9919BA34CE12A9B2990A /* PopupDialog.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = PopupDialog.podspec; path = ../PopupDialog.podspec; sourceTree = ""; }; + DF1B9919BA34CE12A9B2990A /* PopupDialog.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = PopupDialog.podspec; path = ../PopupDialog.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; F2AE7E70D898C743E01C0374 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; /* End PBXFileReference section */ @@ -288,7 +288,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { @@ -561,14 +561,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 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; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -612,14 +620,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 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; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/Example/PopupDialog.xcodeproj/xcshareddata/xcschemes/PopupDialog-Example.xcscheme b/Example/PopupDialog.xcodeproj/xcshareddata/xcschemes/PopupDialog-Example.xcscheme index eadbff36..fe0daf5a 100644 --- a/Example/PopupDialog.xcodeproj/xcshareddata/xcschemes/PopupDialog-Example.xcscheme +++ b/Example/PopupDialog.xcodeproj/xcshareddata/xcschemes/PopupDialog-Example.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "NO"> @@ -94,7 +93,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example/PopupDialog/ViewController.swift b/Example/PopupDialog/ViewController.swift index b29939b4..a97a2b34 100644 --- a/Example/PopupDialog/ViewController.swift +++ b/Example/PopupDialog/ViewController.swift @@ -97,7 +97,8 @@ class ViewController: UIViewController { message: message, buttonAlignment: .horizontal, transitionStyle: .zoomIn, - gestureDismissal: true, + tapGestureDismissal: true, + panGestureDismissal: true, hideStatusBar: true) { print("Completed") } @@ -129,8 +130,12 @@ class ViewController: UIViewController { let ratingVC = RatingViewController(nibName: "RatingViewController", bundle: nil) // Create the dialog - let popup = PopupDialog(viewController: ratingVC, buttonAlignment: .horizontal, transitionStyle: .bounceDown, gestureDismissal: true) - + let popup = PopupDialog(viewController: ratingVC, + buttonAlignment: .horizontal, + transitionStyle: .bounceDown, + tapGestureDismissal: true, + panGestureDismissal: false) + // Create first button let buttonOne = CancelButton(title: "CANCEL", height: 60) { self.label.text = "You canceled the rating dialog" diff --git a/PopupDialog.podspec b/PopupDialog.podspec index c2eca1ae..11f8cd2c 100644 --- a/PopupDialog.podspec +++ b/PopupDialog.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'PopupDialog' - s.version = '0.7.1' + s.version = '0.8.0' s.summary = 'A simple custom popup dialog view controller' s.homepage = 'https://github.com/orderella/PopupDialog' s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/PopupDialog/Classes/PopupDialog.swift b/PopupDialog/Classes/PopupDialog.swift index 95efdfb3..1c43b511 100644 --- a/PopupDialog/Classes/PopupDialog.swift +++ b/PopupDialog/Classes/PopupDialog.swift @@ -83,7 +83,8 @@ final public class PopupDialog: UIViewController { - parameter buttonAlignment: The dialog button alignment - parameter transitionStyle: The dialog transition style - parameter preferredWidth: The preferred width for iPad screens - - parameter gestureDismissal: Indicates if dialog can be dismissed via pan gesture + - parameter tapGestureDismissal: Indicates if dialog can be dismissed via tap gesture + - parameter panGestureDismissal: Indicates if dialog can be dismissed via pan gesture - parameter hideStatusBar: Whether to hide the status bar on PopupDialog presentation - parameter completion: Completion block invoked when dialog was dismissed @@ -96,7 +97,8 @@ final public class PopupDialog: UIViewController { buttonAlignment: UILayoutConstraintAxis = .vertical, transitionStyle: PopupDialogTransitionStyle = .bounceUp, preferredWidth: CGFloat = 340, - gestureDismissal: Bool = true, + tapGestureDismissal: Bool = true, + panGestureDismissal: Bool = true, hideStatusBar: Bool = false, completion: (() -> Void)? = nil) { @@ -111,7 +113,8 @@ final public class PopupDialog: UIViewController { buttonAlignment: buttonAlignment, transitionStyle: transitionStyle, preferredWidth: preferredWidth, - gestureDismissal: gestureDismissal, + tapGestureDismissal: tapGestureDismissal, + panGestureDismissal: panGestureDismissal, hideStatusBar: hideStatusBar, completion: completion) } @@ -123,7 +126,8 @@ final public class PopupDialog: UIViewController { - parameter buttonAlignment: The dialog button alignment - parameter transitionStyle: The dialog transition style - parameter preferredWidth: The preferred width for iPad screens - - parameter gestureDismissal: Indicates if dialog can be dismissed via pan gesture + - parameter tapGestureDismissal: Indicates if dialog can be dismissed via tap gesture + - parameter panGestureDismissal: Indicates if dialog can be dismissed via pan gesture - parameter hideStatusBar: Whether to hide the status bar on PopupDialog presentation - parameter completion: Completion block invoked when dialog was dismissed @@ -134,7 +138,8 @@ final public class PopupDialog: UIViewController { buttonAlignment: UILayoutConstraintAxis = .vertical, transitionStyle: PopupDialogTransitionStyle = .bounceUp, preferredWidth: CGFloat = 340, - gestureDismissal: Bool = true, + tapGestureDismissal: Bool = true, + panGestureDismissal: Bool = true, hideStatusBar: Bool = false, completion: (() -> Void)? = nil) { @@ -163,15 +168,18 @@ final public class PopupDialog: UIViewController { popupContainerView.buttonStackView.axis = buttonAlignment viewController.didMove(toParentViewController: self) - // Allow for dialog dismissal on background tap and dialog pan gesture - if gestureDismissal { - let panRecognizer = UIPanGestureRecognizer(target: interactor, action: #selector(InteractiveTransition.handlePan)) - popupContainerView.stackView.addGestureRecognizer(panRecognizer) + // Allow for dialog dismissal on background tap + if tapGestureDismissal { let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap)) tapRecognizer.cancelsTouchesInView = false - panRecognizer.cancelsTouchesInView = false popupContainerView.addGestureRecognizer(tapRecognizer) } + // Allow for dialog dismissal on dialog pan gesture + if panGestureDismissal { + let panRecognizer = UIPanGestureRecognizer(target: interactor, action: #selector(InteractiveTransition.handlePan)) + panRecognizer.cancelsTouchesInView = false + popupContainerView.stackView.addGestureRecognizer(panRecognizer) + } } // Init with coder not implemented diff --git a/PopupDialog/Classes/TransitionAnimator.swift b/PopupDialog/Classes/TransitionAnimator.swift index d709759b..fd996fae 100644 --- a/PopupDialog/Classes/TransitionAnimator.swift +++ b/PopupDialog/Classes/TransitionAnimator.swift @@ -29,7 +29,7 @@ import UIKit /// Base class for custom transition animations internal class TransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning { - var to: UIViewController! // swiftlint:disable:this identifier_name + var to: UIViewController! var from: UIViewController! let inDuration: TimeInterval let outDuration: TimeInterval diff --git a/README.md b/README.md index 69f5306f..d14e9db7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@

 

+![Swift Version](https://img.shields.io/badge/Swift-4.0-orange.svg) [![Version](https://img.shields.io/cocoapods/v/PopupDialog.svg?style=flat)](http://cocoapods.org/pods/PopupDialog) [![License](https://img.shields.io/cocoapods/l/PopupDialog.svg?style=flat)](http://cocoapods.org/pods/PopupDialog) [![Platform](https://img.shields.io/cocoapods/p/PopupDialog.svg?style=flat)](http://cocoapods.org/pods/PopupDialog) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![codebeat badge](https://codebeat.co/badges/006f8d13-072a-42bb-a584-6b97e60201e1)](https://codebeat.co/projects/github-com-orderella-popupdialog) [![Build Status Master](https://travis-ci.org/Orderella/PopupDialog.svg?branch=master)](https://travis-ci.org/Orderella/PopupDialog) [![Build Status Development](https://travis-ci.org/Orderella/PopupDialog.svg?branch=development)](https://travis-ci.org/Orderella/PopupDialog) @@ -46,7 +46,7 @@ PopupDialog is available through [CocoaPods](http://cocoapods.org). Simply add t use_frameworks! target '' -pod 'PopupDialog', '~> 0.7' +pod 'PopupDialog', '~> 0.8' ``` ## Carthage @@ -56,7 +56,7 @@ pod 'PopupDialog', '~> 0.7' To install, simply add the following lines to your Cartfile: ```ruby -github "Orderella/PopupDialog" ~> 0.7 +github "Orderella/PopupDialog" ~> 0.8 ``` ## Manually @@ -121,7 +121,8 @@ public convenience init( buttonAlignment: UILayoutConstraintAxis = .vertical, transitionStyle: PopupDialogTransitionStyle = .bounceUp, preferredWidth: CGFloat = 340, - gestureDismissal: Bool = true, + tapGestureDismissal: Bool = true, + panGestureDismissal: Bool = true, hideStatusBar: Bool = false, completion: (() -> Void)? = nil) ``` @@ -140,7 +141,8 @@ public init( buttonAlignment: UILayoutConstraintAxis = .vertical, transitionStyle: PopupDialogTransitionStyle = .bounceUp, preferredWidth: CGFloat = 340, - gestureDismissal: Bool = true, + tapGestureDismissal: Bool = true, + panGestureDismissal: Bool = true, hideStatusBar: Bool = false, completion: (() -> Void)? = nil) ``` @@ -180,7 +182,7 @@ PopupDialog will always try to have a max width of 340 . On iPhones with smaller ## Gesture Dismissal -Gesture dismissal allows your dialog being dismissed either by a background tap or by swiping the dialog down. By default, this is set to `true`. You can prevent this behavior by setting `gestureDismissal` to `false` in the initializer. +Gesture dismissal allows your dialog being dismissed either by a background tap or by swiping the dialog down. By default, this is set to `true`. You can prevent this behavior by setting either `tapGestureDismissal` or `panGestureDismissal` to `false` in the initializer. ## Hide Status Bar @@ -395,7 +397,8 @@ PopupDialog *popup = [[PopupDialog alloc] initWithTitle: @"Title" buttonAlignment: UILayoutConstraintAxisVertical transitionStyle: PopupDialogTransitionStyleBounceUp preferredWidth: 380 - gestureDismissal: NO + tapGestureDismissal: NO + panGestureDismissal: NO hideStatusBar: NO completion: nil]; @@ -438,6 +441,7 @@ Minimum requirement is iOS 9.0. This dialog was written with Swift 4, for suppor

 

# Changelog +* **0.8.0** Separated tap and pan gesture dismissal * **0.7.1** Fixes Objective-C compatability
Improved Carthage handling * **0.7.0** Removed FXBlurView while switching to DynamicBlurView * **0.6.2** Added preferredWidth option for iPads