liip/LiipKit

Name: LiipKit

Owner: Liip

Description: LiipKit regroups usefull classes/extensions used in many applications

Created: 2016-11-07 15:57:33.0

Updated: 2017-01-12 11:04:18.0

Pushed: 2016-11-15 07:31:05.0

Homepage:

Size: 35

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

LiipKit

Version License Platform Build Status

Requirements

Requires Swift3.

Installation

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

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

secondsToHoursMinutesSeconds() // => == "0:02:00"
NSDate extensions

Transform a date to a string

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

Prefix tilde for localized string

st" // => == NSLocalizedString("test", comment: "No comment")

Method which return true if a string is empty or whitespace(s)

sEmptyOrWhitespace() // true
.isEmptyOrWhitespace() // true
t".isEmptyOrWhitespace() // false

Convert string to DateTime object with .toDateTime

6-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.

alert = UIAlertController(title: "Alert", message: "Alert message", preferredStyle: UIAlertControllerStyle.alert)
t.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
t.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

lor(hex: 0x0099FF)
lor(hex: 0x0099FF, alpha: 0.3)
lor(hexString: "0x0099FF")
lor(hexString: "#0099FF")
lor(hexString: "0x0099FF", alpha: 0.3)
lor(hexString: "#0099FF", alpha: 0.3)

Simplified initializers

lor(r: 0, g: 127.5, b: 255)
lor(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
License

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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.