UICountDown
open class UICountDown : UIView
extension UICountDown: UICountDownDelegate
A customizable view that sets a timer and starts counting down towards zero from the given value.
-
The countdown view’s delegate.
Declaration
Swift
open var delegate: UICountDownDelegate? -
Decides what type of countdown to show.
Declaration
Swift
open var type: UICountDownType { get set } -
Sets colons to separate seconds from minutes from hours from days.
Declaration
Swift
open var setColonSeparators: Bool -
Sets the color of the separator colons.
Declaration
Swift
open var colonColor: UIColor { get set } -
Decides wether to hide the titles below the countdown.
Declaration
Swift
open var hideTitles: Bool { get set } -
Sets the time interval which the count down must obey. Must be set before countdown.
Declaration
Swift
open var timeInterval: Double -
Sets the time to countdown from.
Declaration
Swift
open var countDownFrom: Int { get set } -
Sets the time to countdown from.
Declaration
Swift
open func countdownFrom(days: Int, hours: Int, minutes: Int, seconds: Int)Parameters
daysDays left.
hoursHours left.
minutesMinutes left.
secondsSeconds left.
-
Converts the countdown numbers shown to Persian.
Declaration
Swift
open var convertToPersian: Bool { get set } -
Configures the layer of the countdown cells.
Declaration
Swift
open func setBorder(width: CGFloat, color: UIColor = #colorLiteral(red: 0.8252273202, green: 0.6826880574, blue: 0.9464033246, alpha: 1), cornerRadius: CGFloat? = 10)Parameters
widthSets the border width.
colorSets the border color.
cornerRadiusSets the corner radius of cells
-
customize(type:backgroundColor: numberColor: font: borderWidth: borderColor: cornerRadius: titleColor: titleFont: colonColor: ) Customize the appearance of the countdown view.
Declaration
Swift
open func customize(type: UICountDownType? = .doubleDigit, backgroundColor: UIColor? = #colorLiteral(red: 0.9322072864, green: 0.8707377911, blue: 0.9809352756, alpha: 1), numberColor: UIColor? = #colorLiteral(red: 0.5561129451, green: 0.1538559794, blue: 0.629018724, alpha: 1), font: UIFont? = .systemFont(ofSize: 15), borderWidth: CGFloat? = 0, borderColor: UIColor? = #colorLiteral(red: 0.8252273202, green: 0.6826880574, blue: 0.9464033246, alpha: 1), cornerRadius: CGFloat? = 10, titleColor: UIColor? = #colorLiteral(red: 0.8940555453, green: 0.8786097169, blue: 0.9770053029, alpha: 1), titleFont: UIFont? = .systemFont(ofSize: 12), colonColor: UIColor? = #colorLiteral(red: 0.8940555453, green: 0.8786097169, blue: 0.9770053029, alpha: 1))Parameters
typeDecides what type of countdown to show.
backgroundColorSets the background color of the timer cells.
numberColorSets the color of the timer numbers.
fontSets the font to use for the timer numbers.
borderWidthSets the border width of each timer cell.
borderColorSets the border color of each timer cell.
cornerRadiusSets the corner radius of each timer cell.
titleColorSets the color of the titles below the timer.
colonColorSets the color of the separator colons.
-
Sets the color of the text fields below the timer.
Declaration
Swift
open var textColor: UIColor { get set } -
Sets the font to use for the bottom titles.
Declaration
Swift
open var titleFont: UIFont? { get set } -
An array of 4 strings which sets the titles below the timer.
Declaration
Swift
open var titles: [String] { get set }
-
Returns an object initialized from data in a given unarchiver.
Declaration
Swift
required public init?(coder: NSCoder)Parameters
coderAn unarchiver object.
-
Initializes a UICountdown object and sets up its properties.
Declaration
Swift
public init(fromTime: Int, interval: Double? = 1.0, type: UICountDownType? = .doubleDigit)Parameters
IntervalThe time interval between each unit of time.
TypeThe type of UICountdown to use.
FromTimeThe time from which the countdown should start counting down to zero.
-
Returns the time remaining in the countdown in seconds.
Declaration
Swift
public func secondsRemaining(seconds: Int)Parameters
secondsThe seconds remaining from the countdown to end.
-
Gets called when the timer reaches zero.
Declaration
Swift
public func countDownFinished()
UICountDown Class Reference