Latest 0.3.0
Homepage https://github.com/liip/LiipKit
License MIT
Platforms ios 8.0
Authors

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:

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.

Latest podspec

{
    "name": "LiipKit",
    "version": "0.3.0",
    "summary": "LiipKit regroups usefull classes/extensions used in many applications.",
    "description": "LiipKit provides usefull extensions forn* Intn* NSDaten* Stringn* UIBarItemn* UIButtonn* UIColorn* UILabeln* ...",
    "homepage": "https://github.com/liip/LiipKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Liip AG": "[email protected]"
    },
    "source": {
        "git": "https://github.com/liip/LiipKit.git",
        "tag": "0.3.0"
    },
    "social_media_url": "https://twitter.com/liip",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "LiipKit/Extensions/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This