Skip to content

Instantly share code, notes, and snippets.

@harshvishu
Last active June 3, 2019 09:45
Show Gist options
  • Select an option

  • Save harshvishu/97853711b90afd9afbd630d547ffff9a to your computer and use it in GitHub Desktop.

Select an option

Save harshvishu/97853711b90afd9afbd630d547ffff9a to your computer and use it in GitHub Desktop.
import Foundation
public typealias CompletionHandler = () -> Void
protocol CountDown: NSObjectProtocol {
// 1
var timeElapsed: TimeInterval {get set}
var timeLimit: TimeInterval {get set}
// 2
var isFinished: Bool {get}
var isRunning: Bool {get}
// 3
/// Executed on completion
var completion: CompletionHandler? {get set}
/// Executed every iteration
var repeatingTask: CompletionHandler? {get set}
// 4
func start()
func stop()
func reset()
func restart()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment