GitXplorerGitXplorer
t

LTFramer

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
5db8333a0da1cf2755243708583643070da7e7ae

CI update

ttevelee committed 7 years ago
Verified
1a90b313737e3b7abc9800cb93cbc0426b92a5aa

CI update

ttevelee committed 7 years ago
Unverified
a706e0194de9fecfb3a81a94246ddb179c5d5c38

Updated README

ttevelee committed 8 years ago
Unverified
584738016fe5c82d0ccd41c6e8ea1a72e60a8cd5

Initial commit

ttevelee committed 8 years ago

README

The README file for this repository.

LTFramer

CI Status Version License Platform

LTFramer helps defining the frames of views and layer in your layout code with a descriptive syntax.

Installation with CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. You can install it with the following command:

$ sudo gem install cocoapods

To install LTFramer, simply add the following line to your Podfile:

pod "LTFramer"

then add

#import <LTFramer/LTFramerKit_UIKit.h>

USAGE

Normally you would describe a layout using the good old setFrame method, like this:

double padding = 16;
double height = 100;
[_view setFrame:CGRectMake(padding, (self.view.frame.size.height - height) / 2.0, 	self.view.frame.size.width - 2 * padding, height)];

Instead, you can use LTFramer to have something simple and easily readable:

[_view installFrame:^(LTFramer *framer) {
    framer.left(16).and.right(16);
    framer.alignCenterY.with.height(100);
}];

You have the possibility to define relative layouts, like this:

[_view installFrame:^(LTFramer *framer) {
    framer.width(50).and.height(50);
    framer.make.left.equalTo.the.right.of(_otherView).with.offset(8);
    framer.make.top.equalTo.the.same.of(_otherView);
}];

Or including the Stack subspec, you have a full-featured stack view implementation ready for use:

_stackView = [LTFramerStackView stackViewWithViews:@[_view1, _view2, _view3]];
[_stackView setProperties:[LTFramerStackProperties configureNew:^(LTFramerStackProperties* properties) {
    [properties setSpacing:16];
    [properties setDirection:LTFramerDirectionHorizontal];
    [properties setJustification:LTFramerJustifySpaceBetween];
    [properties setAlignment:LTFramerAlignCenter];
}]];
[self.view addSubview:_stackView];

See the included Example app for more.

Author

Laszlo Teveli, tevelee@gmail.com

License

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