KDEDateLabel
  • November 24, 2023

KDEDateLabel is an UILabel subclass that saves you from refreshing it when using ‘time ago’ format.

Installation


You have multiple choices here:

  • Copy KDEDateLabel.swift in your project.
  • Adding it in your Podfile pod 'KDEDateLabel'

Usage


 

let label = KDEDateLabel(frame: CGRect(x: 0, y: 0, width: 100, height: 20))
label.date = NSDate()
label.dateFormatTextBlock = { date in
return “\(Int(fabs(date.timeIntervalSinceNow)))s ago”
}

KDEDateLabel is also compatible with Storyboard/XIB.

GitHub


View Github

#ios #storyboard #swift #uilabel
YOU MIGHT ALSO LIKE...
ViewCondition

✨ Super sweet syntactic sugar for SwiftUI.View initializers. At a Glance

SwiftUIX

SwiftUIX attempts to fill the gaps of SwiftUI, providing an extensive suite of components, extensions and utilities to complement the ...

SwiftUI Environment Overrides

A tiny library that adds a control panel for testing how SwiftUI app adapts for different color themes, accessibility settings, ...