Latest 1.0
Homepage https://github.com/tevelee/LTFramer
License MIT
Platforms ios 8.0
Authors

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, [email protected]

License

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

Latest podspec

{
    "name": "LTFramer",
    "version": "1.0",
    "summary": "LTFramer is a layout helper library to help setting frames of views using human-friendly syntax.",
    "description": "LTFramer helps setting frames of views and layers using simple human-readable syntax.nIt contains convenience methods to help you create absolute and relative layouts.",
    "homepage": "https://github.com/tevelee/LTFramer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Laszlo Teveli": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tevelee/LTFramer.git",
        "tag": "1.0"
    },
    "header_dir": "LTFramer",
    "module_name": "LTFramer",
    "default_subspecs": "Core",
    "platforms": {
        "ios": "8.0"
    },
    "subspecs": [
        {
            "name": "Core",
            "source_files": "LTFramer/Core/Common/**/*",
            "public_header_files": "LTFramer/Core/Common/Public/**/*.h",
            "frameworks": "Foundation",
            "ios": {
                "source_files": "LTFramer/Core/iOS/**/*",
                "public_header_files": "LTFramer/Core/iOS/Public/**/*.h",
                "frameworks": "UIKit"
            }
        },
        {
            "name": "Convenience",
            "source_files": "LTFramer/Convenience/Common/**/*",
            "public_header_files": "LTFramer/Convenience/Common/Public/**/*.h",
            "ios": {
                "source_files": "LTFramer/Convenience/iOS/**/*",
                "public_header_files": "LTFramer/Convenience/iOS/Public/**/*.h"
            }
        },
        {
            "name": "Stack",
            "dependencies": {
                "LTFramer/Core": []
            },
            "source_files": "LTFramer/Stack/Common/**/*",
            "public_header_files": "LTFramer/Stack/Common/Public/**/*.h",
            "ios": {
                "source_files": "LTFramer/Stack/iOS/**/*",
                "public_header_files": "LTFramer/Stack/iOS/Public/**/*.h"
            }
        }
    ]
}

Pin It on Pinterest

Share This