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

    days

    Days left.

    hours

    Hours left.

    minutes

    Minutes left.

    seconds

    Seconds 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

    width

    Sets the border width.

    color

    Sets the border color.

    cornerRadius

    Sets the corner radius of cells

  • 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

    type

    Decides what type of countdown to show.

    backgroundColor

    Sets the background color of the timer cells.

    numberColor

    Sets the color of the timer numbers.

    font

    Sets the font to use for the timer numbers.

    borderWidth

    Sets the border width of each timer cell.

    borderColor

    Sets the border color of each timer cell.

    cornerRadius

    Sets the corner radius of each timer cell.

    titleColor

    Sets the color of the titles below the timer.

    colonColor

    Sets 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 }

DEFAULT INITIALIZE

  • Returns an object initialized from data in a given unarchiver.

    Declaration

    Swift

    required public init?(coder: NSCoder)

    Parameters

    coder

    An 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

    Interval

    The time interval between each unit of time.

    Type

    The type of UICountdown to use.

    FromTime

    The 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

    seconds

    The seconds remaining from the countdown to end.

  • Gets called when the timer reaches zero.

    Declaration

    Swift

    public func countDownFinished()