Code Monkey home page Code Monkey logo

lilith's Introduction

Lilith Banner

CI Status Version License Platform

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

Usage

LFConfigurations are a set of appearance properties that can be applied to most of Lilith's text based classes, for example LFLabel and LFButton.

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

Once you've created a LFConfiguration, you can then use it to create certain classes such as LFLabel and LFButton. This allows you to avoid having to retype excessive code.

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

Here is what the same label would look like using the default UIKit.

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

Lilith configurations can be used for many text based classes, for example LFButton. The same properties from the configuration being 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.

//Create a LFButton with the full width of the view (adjusts height automatically)
let button = LFButton(text: "Click me", view: view, point: 0, configuration: config)  
button.below(label2, padding: 16)//Move button to the max Y of label2 + padding of 32  button.textColor(UIColor.orangeColor()) //Automatically set button's text color for normal & highlighted state  button.fontSize(15)  
button.target("doSomething", object: self) //Quickly Target a method (assumes the control event is TouchUpInside)  
view.addSubview(button)

Example

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

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"

Author

Josh Arnold, [email protected]

License

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

lilith's People

Contributors

josharnoldjosh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.