Skip to content

Instantly share code, notes, and snippets.

@teodorpatras
Created June 22, 2016 08:39
Show Gist options
  • Save teodorpatras/d0c37bfbbc1425dec8f42ca41ba05796 to your computer and use it in GitHub Desktop.
Save teodorpatras/d0c37bfbbc1425dec8f42ca41ba05796 to your computer and use it in GitHub Desktop.
EasyTypView + AutoDismissal
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