All Projects → wickwirew → Fluentlayout

wickwirew / Fluentlayout

Licence: mit

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Fluentlayout

Fapaginationlayout
Collection view pagination layout
Stars: ✭ 276 (+1100%)
Mutual labels:  cocoapods, layout
Greedo Layout For Ios
Full aspect ratio grid layout for iOS
Stars: ✭ 837 (+3539.13%)
Mutual labels:  cocoapods, layout
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+13734.78%)
Mutual labels:  cocoapods, layout
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+1086.96%)
Mutual labels:  cocoapods, layout
Manuallayout
✂ Easy to use and flexible library for manually laying out views and layers for iOS and tvOS. Supports AsyncDisplayKit.
Stars: ✭ 286 (+1143.48%)
Mutual labels:  cocoapods, layout
Snapkit
A Swift Autolayout DSL for iOS & OS X
Stars: ✭ 18,091 (+78556.52%)
Mutual labels:  cocoapods, layout
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+17952.17%)
Mutual labels:  cocoapods, layout
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (+3417.39%)
Mutual labels:  cocoapods
Webhere
HTML scraping for Objective-C.
Stars: ✭ 16 (-30.43%)
Mutual labels:  cocoapods
Parallaxheader
Simple way to add parallax header to UIScrollView/UITableView written in Swift.
Stars: ✭ 808 (+3413.04%)
Mutual labels:  cocoapods
Preferences
⚙ Add a preferences window to your macOS app in minutes
Stars: ✭ 898 (+3804.35%)
Mutual labels:  cocoapods
Sdwebimageflplugin
A SDWebImage plugin to support GIF using FLAnimatedImage and category
Stars: ✭ 16 (-30.43%)
Mutual labels:  cocoapods
Nimbus
The iOS framework that grows only as fast as its documentation
Stars: ✭ 6,496 (+28143.48%)
Mutual labels:  cocoapods
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+3426.09%)
Mutual labels:  cocoapods
Jwrefreshcontrol
A refresh control(header & footer of UIScrollview) for iOS app.
Stars: ✭ 17 (-26.09%)
Mutual labels:  cocoapods
Lcactionsheet
一款简约而不失强大的 ActionSheet,微博、微信和 QQ 都采用了极其类似的样式,完全支持 Swift。
Stars: ✭ 809 (+3417.39%)
Mutual labels:  cocoapods
Loaderbutton
LoaderButton is a very interesting animation loading button.
Stars: ✭ 19 (-17.39%)
Mutual labels:  cocoapods
Xlpagertabstrip
Android PagerTabStrip for iOS.
Stars: ✭ 6,671 (+28904.35%)
Mutual labels:  cocoapods
Styled System
⬢ Style props for rapid UI development
Stars: ✭ 7,126 (+30882.61%)
Mutual labels:  layout
Flexbox
CSS library for easier work with flex boxes
Stars: ✭ 17 (-26.09%)
Mutual labels:  layout

FluentLayout

Swift 3.0.1 CocoaPods compatible License

Overview

FluentLayout's primary goal is to provide a simple, readable way to write UI code in Swift. Not using storyboards and doing all UI work all in code can be very daunting and get very complex very quickly.

A Layout is just a UIStackView under the covers with some nicer syntax and helpers on top.

In FluentLayout there is the concept of a section in the UI. All a section is, is just a simple way of breaking up a section to the UI of related items into it's own part with a different background color.

Usage

For example if we were creating a new social media app and at the top of the want the following profile header:

First we would create the layout and controls. Then add the layout to the view and add constraints for its top, left, and right edges. Note: the controls are not added to the layout yet.

let layout = Layout()
view.addSubview(layout)
layout.pinToSuperview(top: 12, left: 12, right: 12)

let profilePicture = UIImageView()
profilePicture = UIImage(named: "ProfilePicture")

let name = UILabel()
name.text = "Wes Wickwire"
name.font = UIFont.systemFont(ofSize: 15)

let title = UILabel()
title.text = "Last online 8 hrs ago"
title.textColor = .lightGray
title.font = UIFont.systemFont(ofSize: 13, weight: UIFontWeightLight)

On the layout we can call layout.addSection then in a closure layout the section.

layout.addSection {
    $0.addStack(axis: .horizontal, alignment: .top, spacing: 8) {

        $0.add(view: profilePicture).pin(size: CGSize(width: 50, height: 50))

        $0.addStack(axis: .vertical, spacing: 0) {
            $0.add(view: name)
            $0.add(view: title)
        }
    }
}

All default colors, spacings, and insets can be changed from the LayoutDefaults class.

For customizing the default controls (e.g. using methods like layout.addLabel(text:)) create a new class that conforms to the protocol LayoutDefaultControls and set LayoutDefaults.defaultControls to an instance of your new class. It will then use that to create all controls. Use of this class is not needed at all, provided as a ease of use to quickly add UI elements.

Example

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

In the exmaple project, the following view is created.

The code below creates the view above.

layout.create(spacing: 12) {

    // Top Title
    $0.addSection(title: "Lorem Ipsum")

    // Main Image, keep ratio of image
    $0.addImage(named: "snow.png").pinImageAspectRatio()

    // This section holds post information
    $0.addSection {

        // Group to contain the title, time stamp and heart
        $0.addStack(alignment: .center, spacing: 0) {

            // Title and time stamp should be on top of each other
            $0.addStack(axis: .vertical, spacing: 0) {
                $0.addTitleLabel(text: "Neque Porro Quisquam")

                // Add custom label
                $0.add(view: createdTime)
            }

            // Add heart button but pin width to 44
            $0.add(view: heartButton).pin(width: 44)
        }

        // add post body
        $0.addLabel(text: loremIpsum)
    }
}

Requirements

  • Xcode 8.0
  • Swift 3.0+

Installation

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

pod 'FluentLayout'

Contributions

Contributions are welcome and encouraged!

Author

Wesley Wickwire, [email protected]

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].