Skip to content

Commit

Permalink
1.1.0: Added isEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrommcarrasco committed Jul 23, 2019
1 parent 5899189 commit 47a6a55
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- Hover (1.0.1)
- Hover (1.0.2)

DEPENDENCIES:
- Hover (from `..`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ".."

SPEC CHECKSUMS:
Hover: 6b9703a147fee651708f2fe24aeb58ada4acfa9b
Hover: 047bb7a44fdf9e49bd201ceec84241e0893012ef

PODFILE CHECKSUM: 4464a752690793fe72e3febd146ffc7ffb897004

Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/Hover.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Hover.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Hover'
spec.version = '1.0.2'
spec.version = '1.1.0'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://github.com/pedrommcarrasco/Hover'
spec.authors = { 'Pedro Carrasco' => 'https://twitter.com/pedrommcarrasco' }
Expand Down
19 changes: 19 additions & 0 deletions Hover/UI/HoverView.swift
Expand Up @@ -16,8 +16,12 @@ public class HoverView: UIView {
static let animationDamping: CGFloat = 0.8
static let animationResponse: CGFloat = 0.5
static let animationDuration = 0.4
static let enableAnimationDuration = 0.2
static let anchorAnimationDuration = 0.15
static let interItemSpacing: CGFloat = 12.0
static let disabledAlpha: CGFloat = 0.75
static let disabledTransform = CGAffineTransform(scaleX: 0.9, y: 0.9)

}

// MARK: State
Expand All @@ -43,6 +47,21 @@ public class HoverView: UIView {
private var stackViewXConstraint = NSLayoutConstraint()
private var stackViewYConstraint = NSLayoutConstraint()

// MARK: Properties
public var isEnabled = true {
didSet {
UIView.animate(withDuration: Constant.enableAnimationDuration) {
self.button.alpha = self.isEnabled ? 1.0 : Constant.disabledAlpha
self.button.transform = self.isEnabled ? .identity : Constant.disabledTransform
self.button.isEnabled = self.isEnabled
}

if !isEnabled {
animateState(to: false)
}
}
}

// MARK: Private Properties
private let anchors: [Anchor]
private let configuration: HoverConfiguration
Expand Down

0 comments on commit 47a6a55

Please sign in to comment.