CocoaPods trunk is moving to be read-only. Read more on the blog, there are 3 months to go.

LiipKit 0.3.0

LiipKit 0.3.0

TestsTested ✓
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2016
SwiftSwift Version 3.0
SPMSupports SPM ✗

Maintained by ghn, Noé Froidevaux.



LiipKit 0.3.0

Requirements

Requires Swift3.

Installation

LiipKit is available through the Liip CocoaPods repo. To install it, simply add the following lines to your Podfile:

pod "LiipKit"

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Documentation

Extensions

UI

Int extensions

Convert seconds (Int) to hours:minutes:seconds (String)

120.secondsToHoursMinutesSeconds() // => == "0:02:00"

NSDate extensions

Transform a date to a string

date.toString() // => "08-03-2016
date.toString("dd.MM.yyyy") // => "08.03.2016"
date.toString("yyyy") // => "2016"

String extensions

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()

UIAlertController extensions

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)

UIBarItem extensions

Provide a property localizedTitle which is available in Interface Builder (see Main.storyboard in Example project).

UIButton extensions

Provide a property localizedTitleForNormal and localizedTitleForHighlighted which are available in Interface Builder (see Main.storyboard in Example project).

UIColor extensions

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)

UILabel extensions

Provide a property localizedText which is available in Interface Builder (see Main.storyboard in Example project).

Author

  • Noé Froidevaux
  • Manuel Escrig
  • Germain Hugon

License

LiipKit is available under the MIT license. See the LICENSE file for more info.