TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by ghn, Noé Froidevaux.
Requires Swift3.
LiipKit is available through the Liip CocoaPods repo. To install it, simply add the following lines to your Podfile:
pod "LiipKit"
To run the example project, clone the repo, and run pod install
from the Example directory first.
Convert seconds (Int) to hours:minutes:seconds (String)
120.secondsToHoursMinutesSeconds() // => == "0:02:00"
Transform a date to a string
date.toString() // => "08-03-2016
date.toString("dd.MM.yyyy") // => "08.03.2016"
date.toString("yyyy") // => "2016"
Prefix tilde for localized string
~"test" // => == NSLocalizedString("test", comment: "No comment")
Method which return true if a string is empty or whitespace(s)
"".isEmptyOrWhitespace() // true
" ".isEmptyOrWhitespace() // true
"test".isEmptyOrWhitespace() // false
Convert string to DateTime object with .toDateTime
"2016-03-08T00:00:00.000+01:00".toDateTime()
Method show
to allow to show the alert without knowing the top view controller required to present an alert.
let alert = UIAlertController(title: "Alert", message: "Alert message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
alert.show(animated: true, completion: nil)
Provide a property localizedTitle
which is available in Interface Builder (see Main.storyboard in Example project).
Provide a property localizedTitleForNormal
and localizedTitleForHighlighted
which are available in Interface Builder (see Main.storyboard in Example project).
Hex initializers
UIColor(hex: 0x0099FF)
UIColor(hex: 0x0099FF, alpha: 0.3)
UIColor(hexString: "0x0099FF")
UIColor(hexString: "#0099FF")
UIColor(hexString: "0x0099FF", alpha: 0.3)
UIColor(hexString: "#0099FF", alpha: 0.3)
Simplified initializers
UIColor(r: 0, g: 127.5, b: 255)
UIColor(r: 0, g: 127.5, b: 255, a: 0.5)
Provide a property localizedText
which is available in Interface Builder (see Main.storyboard in Example project).
LiipKit is available under the MIT license. See the LICENSE file for more info.