Skip to content

Commit

Permalink
Refactor and add new callback closures
Browse files Browse the repository at this point in the history
  • Loading branch information
amerhukic committed Dec 25, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 80aa3c4 commit 61ff18f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions AHDownloadButton/Classes/AHDownloadButton.swift
Original file line number Diff line number Diff line change
@@ -195,6 +195,7 @@ public final class AHDownloadButton: UIView {
public var state: State = .startDownload {
didSet {
delegate?.downloadButton(self, stateChanged: state)
downloadButtonStateChangedAction?(self, state)
animationQueue.async { [currentState = state] in
self.animationDispatchGroup.enter()

@@ -217,7 +218,9 @@ public final class AHDownloadButton: UIView {

public weak var delegate: AHDownloadButtonDelegate?

public var didTapDownloadButtonAction: ((_ currentState: State) -> Void)?
public var didTapDownloadButtonAction: ((AHDownloadButton, State) -> Void)?

public var downloadButtonStateChangedAction: ((AHDownloadButton, State) -> Void)?

// MARK: Private properties

@@ -283,6 +286,7 @@ public final class AHDownloadButton: UIView {
}

// MARK: Initializers

public init(alignment: HorizontalAlignment) {
contentHorizontalAlignment = alignment
super.init(frame: .zero)
@@ -425,7 +429,7 @@ public final class AHDownloadButton: UIView {

@objc private func currentButtonTapped() {
delegate?.downloadButton(self, tappedWithState: state)
didTapDownloadButtonAction?(state)
didTapDownloadButtonAction?(self, state)
}

}

0 comments on commit 61ff18f

Please sign in to comment.