Skip to content

Commit

Permalink
Merge pull request #36 from GlisboaDev/dismiss_handler
Browse files Browse the repository at this point in the history
Added handler for dismiss view action.
  • Loading branch information
Huong Do committed Jul 28, 2017
2 parents e2bc255 + 7d61744 commit 3c122d8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/DateTimePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import UIKit

public var timeZone = TimeZone.current
public var completionHandler: ((Date)->Void)?
public var dismissHandler: (() -> Void)?

// private vars
internal var hourTableView: UITableView!
Expand Down Expand Up @@ -459,9 +460,14 @@ import UIKit
y: self.frame.height,
width: self.frame.width,
height: self.contentHeight)
}) { (completed) in
}) {[weak self] (completed) in
guard let `self` = self else {
return
}
if sender == self.doneButton {
self.completionHandler?(self.selectedDate)
} else {
self.dismissHandler?()
}
self.removeFromSuperview()
}
Expand Down

0 comments on commit 3c122d8

Please sign in to comment.