Skip to content

Instantly share code, notes, and snippets.

@billglover
Last active August 29, 2015 14:21
Show Gist options
  • Save billglover/5b592e52a1595539468b to your computer and use it in GitHub Desktop.
Save billglover/5b592e52a1595539468b to your computer and use it in GitHub Desktop.
The scaffold to my YAPT_Swift application.
import UIKit
class YAPTMainViewController: UIViewController {
// MARK: - Types
private enum IntervalType { case Work, Break }
private typealias Interval = (type:IntervalType, duration:Double)
// MARK: - UI Properties
@IBOutlet weak var timerLabel: UILabel!
@IBOutlet weak var timerButton: UIButton!
@IBOutlet var timerView: UIView!
@IBInspectable var breakColor = UIColor(red: 48/255.0, green: 119/255.0, blue: 198/255.0, alpha: 1.0)
@IBInspectable var workColor = UIColor(red: 194/255, green: 49/255.0, blue: 52/255.0, alpha: 1.0)
// MARK: - Properties
private var timer = NSTimer()
private var schedule = [Interval]()
private let timerInterval: NSTimeInterval = 1.0
private var currentIntervalStartTime = NSDate()
private var remainingIntervalDuration: NSTimeInterval = 0.0
private var currentIntervalIndex = 0
// MARK: - Timer Methods
private func startTimer() { }
private func interruptTimer() { }
private func completeTimer() { }
private func resetTimer() { }
func timerFired() { }
// MARK: - Update Display
private func updateDisplay() { }
private func updateTimerButton() { }
private func updateBackground() { }
// MARK: - Navigation
@IBAction func timerButtonPressed(sender: AnyObject) { }
// MARK: - View Controller Lifecycle
override func viewDidLoad() { super.viewDidLoad() }
// MARK: - Notifications
func applicationWillResignActive() { }
func applicationWillEnterForeground() { }
func applicationWillTerminate() { }
func notificationActionNextInterval() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment