Latest 0.1.10
Homepage https://github.com/Liquicit/Lilith
License MIT
Platforms ios 8.0
Authors

Lilith Banner

CIStatus
Version
License
Platform

Lilith is a UI Library written in Swift designed to make working with UIKit faster and more user friendly.

Lilith is in early Alpha and is under heavy development. More features and full documentation coming soon. :heart:

Requirements

  • iOS 8.0+
  • Xcode 7.3+

Installation

Lilith is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Lilith"

Documentation

Full documentation is available over at Cocoadocs!

Usage

Text based classes

LFConfiguration

LFConfigurations are a set of appearance properties that can be applied to Lilith’s text based classes.

let config = LFConfiguration(font: UIFont(name: "Avenir Next", size: 20)!, textColor: .blackColor(), textAlignment: .Center, numberOfLines: 0, resize: true)

LFLabel

Once you’ve created a LFConfiguration, you can then use it to configure classes such as the LFLabel. This allows you to avoid having to retype excessive code. :smirk:

//A label made with Lilith
let frame = CGRect(x: 16, y: 32, width: view.frame.width-32, height: 64)
let label = LFLabel(frame: frame, configuration: config, text: "Hello world!")
view.addSubview(label)

Lilith LFLabel

Here is what the same label would look like using the default UIKit. Look at how much code it is! :astonished:

//Original label made with UIKit
let frame = CGRect(x: 16, y: 0, width: view.frame.width-32, height: 64)
let label = UILabel(frame: frame)
label.text = "Hello world!"
label.font = UIFont(named:"Avenir Next", size:20)
label.textColor = .BlackColor
label.textAlignment = .Left
label.numberOfLines = 0
label.sizeToFit()
view.addSubview(label)

LFButton

Remember, LFConfigurations can be used for all text based classes, for example LFButton. The same properties from the configuration that are applied to the above LFLabel can be directly applied to an LFButton without having to retype the same code. Oh, and should I mention Lilith has custom initializers to help speed up your coding :kissing_heart:.

//Create a LFButton with the full width of the view at a certain point and adjust the height automatically
let button = LFButton(text: "Click me", view: view, point: 0, configuration: config)  
button.below(label2, padding: 16) //Move's the button below a certain view with optional padding
button.target("doSomething", object: self) //Quickly Target a method (assumes the control event is TouchUpInside)  
view.addSubview(button)

Sexy Extras

Lilith’s text based classes come loaded with many different functions all with the one purpose of simplifying your UI code! :sunglasses:

// Sets the text color. For LFButtons it automatically lightens or darkens the color for the highlighted state
textColor(textColor: UIColor)

// Sets the font size of the current font
fontSize(size: CGFloat)

// Moves the object below a certain view with optional padding. (A fast replacement for CGRectGetMaxY)
below(view: UIView, padding: CGFloat)

// Moves the object above a certain view with optional padding. (A fast replacement for CGRectGetMinY)
above(view: UIView, padding: CGFloat)

// These functions will adjust the alignment of the text. Even for the LFButton.
leftText()
centerText()
rightText()

//Sets the number of lines for a label.
lines(lines: Int)

// Automatically adjusts the height of the object to fit it's text while maintaining the width.
resize()

// For LFButtons only. Sets the title for both the normal and highlighted state.
setText(text: String)

// Resets the objects entire configuration with a new one.
setConfiguration(configuration: LFConfiguration)

// For buttons only. Adds a target for the touch up inside event.
target(action: String, object: AnyObject)

Example

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

Author

Josh Arnold, [email protected]

License

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

Latest podspec

{
    "name": "Lilith",
    "version": "0.1.10",
    "summary": "Develope Swift UI, faster.",
    "description": "Lilith is an elegant framework for making tedious code, beautiful.",
    "homepage": "https://github.com/Liquicit/Lilith",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Josh Arnold": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Liquicit/Lilith.git",
        "tag": "0.1.10"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Lilith/Classes/**/*"
}

Pin It on Pinterest

Share This