Created
June 22, 2016 08:39
-
-
Save teodorpatras/d0c37bfbbc1425dec8f42ca41ba05796 to your computer and use it in GitHub Desktop.
EasyTypView + AutoDismissal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension EasyTipView{ | |
func show(animated animated: Bool = true, forView view: UIView, withinSuperview superview: UIView? = nil, autoDismissAfter: Double) { | |
self.show(animated: animated, forView: view, withinSuperview: superview) | |
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(autoDismissAfter * Double(NSEC_PER_SEC))) | |
dispatch_after(delayTime, dispatch_get_main_queue()) { [weak self] in | |
self?.dismiss() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment