UIDatePicker-like picker what allow you to select time interval similar to .countDownTimer mode but not limited with 24 hours
TimeIntervalPicker works on iOS 8 and 9. It depends on the following Apple frameworks, which should already be included with most Xcode templates:
- Foundation
- UIKit
You can use CocoaPods to install TimeIntervalPicker
by adding it to your Podfile
:
platform :ios, '8.0'
use_frameworks!
pod 'CTTimeIntervalPicker'
- Download and drop
TimeIntervalPicker.swift
in your project. - Congratulations!
import UIKit
import TCTimeIntervalPicker
class ViewController: UIViewController {
@IBAction private func showButtonPressed(button: UIButton) {
let timePicker = TimeIntervalPicker()
timePicker.titleString = "Select time:"
timePicker.maxMinutes = 180
timePicker.completion = { (timeInterval) in
print(timeInterval)
}
timePicker.show(at: 0)
}
}
This code is distributed under the terms and conditions of the MIT license.