Giter VIP home page Giter VIP logo

layoutkit's Introduction

🚨 UNMAINTAINED 🚨

This project is no longer used by LinkedIn and is currently unmaintained.

LayoutKit

CocoaPods GitHub release Build Status codecov

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.

Motivation

LinkedIn created LayoutKit because we have found that Auto Layout is not performant enough for complicated view hierarchies in scrollable views. For more background, read the blog post.

Benefits

LayoutKit has many benefits over using Auto Layout:

  • Fast: LayoutKit is as fast as manual layout code and is significantly faster than Auto Layout.
  • Asynchronous: Layouts can be computed in a background thread so user interactions are not interrupted.
  • Declarative: Layouts are declared with immutable data structures. This makes layout code easier to develop, document, code review, test, debug, profile, and maintain.
  • Cacheable: Layout results are immutable data structures so they can be precomputed in the background and cached to increase user perceived performance.

LayoutKit also provides benefits that make it as easy to use as Auto Layout:

  • UIKit friendly: LayoutKit produces UIViews and also provides an adapter that makes it easy to use with UITableView and UICollectionView.
  • Internationalization: LayoutKit automatically adjusts view frames for right-to-left languages.
  • Swift: LayoutKit can be used in Swift applications and playgrounds.
  • Tested and production ready: LayoutKit is covered by unit tests and is being used inside of recent versions of the LinkedIn and LinkedIn Job Search iOS apps.
  • Open-source: Not a black box like Auto Layout.
  • Apache License (v2): Your lawyers will be happy that there are no patent shenanigans.

Hello world

let image = SizeLayout<UIImageView>(width: 50, height: 50, config: { imageView in
    imageView.image = UIImage(named: "earth.jpg")
})

let label = LabelLayout(text: "Hello World!", alignment: .center)

let stack = StackLayout(
    axis: .horizontal,
    spacing: 4,
    sublayouts: [image, label])

let insets = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 8)
let helloWorld = InsetLayout(insets: insets, sublayout: stack)
helloWorld.arrangement().makeViews(in: rootView)

Hello world example layout

Limitations

We have found LayoutKit to be a useful tool, but you should be aware of what it is not.

  • LayoutKit is not a constraint based layout system. If you wish to express a constraint between views, then those views need to be children of a single layout that implements code to enforce that constraint.
  • LayoutKit is not flexbox, but you may find similarities.

Installation

LayoutKit can be installed with CocoaPods or Carthage.

CocoaPods

Add this to your Podspec:

pod 'LayoutKit'

Then run pod install.

Carthage

Add this to your Cartfile:

github "linkedin/LayoutKit"

Then run carthage update.

Documentation

Now you are ready to start building UI.

layoutkit's People

Contributors

bellebethcooper avatar brow avatar cooksimo avatar crleona avatar dgattey avatar drumnkyle avatar e-liu avatar evnik avatar franciscoamado avatar hqin-work avatar inamiy avatar jingwei-huang1 avatar li-eweng avatar li-svartak avatar muukii avatar nbadakh avatar nicksnyder avatar nixzhu avatar p-jadhav avatar pgherveou avatar premist avatar prkumarili avatar readmecritic avatar rocry avatar sergeimikhan avatar sol88 avatar staguer avatar tedgonzalez avatar thekirankumar avatar ynop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

layoutkit's Issues

min/max size constraints for layouts

Currently SizeLayout allows layouts to have a specific length along one or both dimensions.

It would be useful to be able to specify maximum width/height and minimum width/height for a nested layout.

One option would be to create a MinSizeLayout and a MaxSizeLayout. Unsure if it would make sense to combine these into one layout (e.,g. SizeRangeLayout), or even combine them with SizeLayout.

If we stick with separate layouts, then we might also want to rename SizeLayout to ExactSizeLayout

UIButton Layout

Hey there
Is there something equivalent to LabelLayout for views such as UIButton (or any other view that define an intrinsicContentSize)?

Right now I am using a SizeLayout but I am forced to define the size of my button

SizeLayout<UIButton>(
  width: 100, height: 50,
  alignment: .centerTrailing,
  flexibility: .flexible,
  config: { button in
    button.backgroundColor = UIColor.blue
    button.setTitle("Button", for: .normal)
    button.setTitleColor(.black, for: .normal)
  }
)

screen shot 2016-10-13 at 3 19 47 pm

How to handle orientation change?

Hi,

first of all thanks for open sourcing LayoutKit!

While experimenting with the Framework a bit I was wondering what'd be the best approach to handle orientation changes.

Suppose we have the following layout and we want to adapt it to landscape mode on tilting the device.

screen shot 2016-07-19 at 08 14 22

Right now I handle this by creating the layout again from scratch if an orientation change occurs.

    override func viewDidLoad() {
        super.viewDidLoad()

        title = "Layout Kit"

        let leftLayout = LabelLayout(text: "Left", alignment: LayoutKit.Alignment.topLeading) {label in
            label.backgroundColor = UIColor.purpleColor()
        }

        let rightLayout = LabelLayout(text: "Right", alignment: LayoutKit.Alignment.topTrailing ) { label in
            label.backgroundColor = UIColor.cyanColor()
        }

        let stackLayout = StackLayout(axis: .horizontal, spacing: 8, sublayouts: [leftLayout, rightLayout]) { (view) in
            view.backgroundColor = UIColor.blueColor()
        }

        insetLayout = InsetLayout(inset: 8, sublayout: stackLayout, config: nil)

        guard let insetLayout = insetLayout else { return }
        insetLayout.arrangement(width: view.bounds.size.width).makeViews(inView: containerView)
    }

    override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)

        coordinator.animateAlongsideTransition({ (context) -> Void in
            guard let insetLayout = self.insetLayout else { return }
            insetLayout.arrangement(width: self.view.bounds.size.width).makeViews(inView: self.containerView)
        }) { (context) -> Void in }
    }

However I am wondering if there might be a better approach to this issue.

Any help would be highly appreciated.

Cheers,
Riko

Subviews should be in a deterministic order, regardless of view reuse

As reported by @pgherveou in #56:

If I run twice the same layout with reuseIds set on some of my views, the order of the views changes

== test 2 ==

Unmanaged<AnyObject>(_value: <UIView: 0x7f92a56022c0; frame = (0 0; 350 250); layer = <CALayer: 0x610000033a20>>
   | <UIImageView: 0x7f92a5503e70; frame = (4 4; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x618000234ee0>>
   | <UILabel: 0x7f92a7104440; frame = (61 4; 36.5 20.5); text = 'hello'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000009edc0>>
   | <UILabel: 0x7f92a5406770; frame = (58 29; 42.5 20.5); text = 'world'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000009dd80>>)

== test 3x ==

Unmanaged<AnyObject>(_value: <UIView: 0x7f92a56022c0; frame = (0 0; 350 250); layer = <CALayer: 0x610000033a20>>
   | <UILabel: 0x7f92a7104440; frame = (61 4; 36.5 20.5); text = 'hello'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000009edc0>>
   | <UILabel: 0x7f92a5406770; frame = (58 29; 42.5 20.5); text = 'world'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000009dd80>>
   | <UIImageView: 0x7f92a560b770; frame = (4 4; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x610000036180>>)

This could have unexpected consequences for layering and tap handling if views overlap so LayoutKit should make sure views are in a deterministic order.

Features proposal

I started using this framework in a sample project. Great work and thanks for sharing.
I spent some time myself working on something similar, as a side project, and i'm considering to switch to LayoutKit cause it is far head on what I have.

Things that I'd like to add:

  • Label baseline alignment: Be able to align labels by baseline in an horizontal layout
  • Center on a specific element of the stack: Let's say a stack contains two layouts [A][B], if I set .center as aligment for the stack, than the stack's container will set the stack position based on the mid point of it's size. There are cases where I want to center the stack on a specifc element.

For example in this Stack I have to elements the dot and the text. That text should be centered.
Sample
A solution to this specific example could be to create an empty SizeLayout as third element of the stack with the same width than the first one. But this could be more complicated with dynamic elements and it should be possible without have to create more layout elements than necessary.

  • Action support: Now I can add a button as part of the layout and than regenerate the Layout in response to an user action. Could be useful to have a native support for states (Normal, Highlighted) in a way that the view could automatically update to reflect a given state. i.e. having a state parameter in the view config block
  • Traslation: Ability to apply a traslation to a view position after the layout phase by absolute value or by percentage on the container size.
  • Max/Min size constraints: Ability to apply a max/min size to a Layout, so that it can still adapt it's size to the size of it's content and at the same time allows to specify min/max constraints.

Please let me know if those features are on you list and if you think if they make sense or not.
From your architecture I see that I can develop those things has private layouts but I'd like to know your feedbacks, if you have similar things on your todo list and eventually share my changes if they can be useful.

Support Swift package manager

Documentation:
https://swift.org/package-manager/

  • Create Package.swift
import PackageDescription

let package = Package(
  name: "LayoutKit"
)
  • Move Library code to a Sources/ folder?
  • Anything else?
  • Test Unit Tests
  • Test Swift Package Manager by a sample project
  • Test Cocoapods
  • Test Carthage
  • Update Readme.md

Ability to translate the position of a view after layout phase

Ability to apply a traslation to a view position after the layout phase by absolute value or by percentage on the container size.

This could be handy in cases where we need to tweak the position of a element in a complex layout without have to create a custom Layout.

Layout of layoutkit.org home page

When I use the Safari browser to visit the layoutkit.org site with an 85% page zoom, the layout breaks. Many websites have this problem, but it's ironic that Layout Kit doesn't get this right. Let me know if you need details on my configuration. The page zoom is configurable in Safari's Advanced preference panel.

CocoaPods Version Problem

I tried pod 'LayoutKit'
The version is 0.2.1 and the project created by Florian Krüger
I think it is not the correct kit.
Any idea what should I do to get the updated LayoutKit?

LabelLayout alignment and numberOfLines issue

Hello,

I've created a layout to list a person's name and title like so:

class TeamMemberLayout: InsetLayout<View> {
    public init(person: Person) {        
        let nameLayout = LabelLayout(
            text: "Person Name",
            font: .boldSystemFont(ofSize: 16),
            alignment: .center
        )
        
        let titleLayout = LabelLayout(
            text: "Chief Executive Officer and Vice President",
            font: .systemFont(ofSize: 12),
            alignment: .center,
            config: { label in
                label.numberOfLines = 1
            }
        )
        
        super.init(
            insets: UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12),
            sublayout: StackLayout(
                axis: .vertical,
                spacing: 6,
                alignment: .topFill,
                viewReuseId: "teammemberlayout",
                sublayouts: [nameLayout, titleLayout]
            ),
            config: nil
        )
    }
}

As you can see, I am limiting the number of lines for the title label to be one, and for the alignment to be .center. However, my layout renders like so:

screen shot 2017-01-05 at 4 39 47 pm

Any idea what I'm doing wrong? Thanks!

Control actions and highlighted state on layouts

My team and I are trying out this library for a feed we are incorporating into our app and we really like LayoutKit so far. We would like to thank you for open sourcing this and we find that it's a really great way to build performant user interfaces. However, we are really missing interactivity on layouts that are not ButtonLayouts. We want to be able to control the highlighted state of any layout.

Here's an example use case we stumbled upon that caused our desire for this feature:

We have a feed with cells laid out vertically stacked. These cells have different layouts, one of which contains an ImageLayout as a sublayout. We are able to feign the highlighted state on the rest of the layout by making it transparent and making the views in a class extending UICollectionViewCell that has a highlighted state. Of course this does not pertain to the layout containing an image and it's a bit of a hack.

Is there a recommended practice for how to achieve this already using LayoutKit? We are able to identify the sublayouts of a given layout but the views they wrap are inaccessible to us.

Should there not be a recommended practice to achieve this kind of behavior we propose introducing two new protocols to LayoutKit, Actionable and Highlightable.

Actionable would allow the layout to respond to presses with an action and during the press highlight all children conforming to Highlightable until a descendant conforms to Actionable.

Highlightable allows a view/layout to assume a highlighted state, altering it's appearance without changing the layout, when passed an action from the closest parent conforming to Actionable. The properties of this highlighted state would preferably be specified in the config closure.

I should also add that we are willing to contribute to this project should you accept this proposal.

DWURecyclingAlert Red alert while rendering images and cells...

FeedTableView in sample app with the following FeedItemLayout causes red boxes around images as well as high latency alert from DWURecyclingAlert. Any thoughts on how I can optimize image loading and layout?

https://github.com/diwu/DWURecyclingAlert/blob/master/RecyclingAlert/DWURecyclingAlert/DWURecyclingAlert.m

` let actorCommentLayout = StackLayout(axis: .horizontal, sublayouts: [
SizeLayout(width: 50, height: 50, config: { imageView in

            imageView.image = UIImage(named: "Avatar\(imageIndex.instance.value)")
        }),
        LabelLayout(text: actorComment, alignment: .centerLeading)
    ])`

simulator screen shot oct 29 2016 1 00 44 pm

Alignment on a specific element of the stack

Let's say a stack contains two layouts [A][B], if I set .center as aligment for the stack, than the stack's container will set the stack position based on the mid point of it's size. There are cases where I want to center the stack on a specifc element.

For example in this Stack I have to elements the dot and the text. That text should be centered.
Sample
A solution to this specific example could be to create an empty SizeLayout as third element of the stack with the same width than the first one. But this could be more complicated with dynamic elements and it should be possible without have to create more layout elements than necessary.

BatchUpdates reloadItems has slow performance

I have built a horizontally scrolling control that uses a fixed number of fixed-size cells using LayoutKit. When the user taps a cell, I'd like to reload the previously selected cell and the newly selected cell in order to move the selection indicator. I attempted to do this by using BatchUpdates and setting the reloadItems property, but the performance is very slow.

Once I build BatchUpdates, I call layoutAdapter.reload() with a fixed width and height, passing in the BatchUpdates I just built, and returning a cached array of Layout items to the layoutProvider (with the 2 indexPaths already rebuilt and updated in the cache).

To work around this, I've instead just fetched each cell manually (cellForItemAtIndexPath), built the new layout, and arranged/made in the cell.contentView. This shows much faster performance. What's the intended use of BatchUpdates, and is there a way to get better performance out of it?

Label baseline alignment

I'd like to be able to align labels inside a horizontal stack based on their baseline.

We could Add a new Alignment properties: (Vertical.baseline). If the contained object doesn't have a baseline (not text) than it behaves like .center

Support option for custom cell type

Here is why I want this:

I need add time accessory view and using pan gesture to reveal it(imaging iMessage)

So, what I did for this:
register and dequeue custom cell which have a method to receive offset, and the Revealer will handle pan gesture and send the offset to visible cells.

If you guys think this will be helpful like I do, I would like to send a PR

labellayout textAlignment is not work

labellayout textAlignment is not work!
my code like this

let authorLayout = LabelLayout(
            text: author,
            font: UIFont.systemFontOfSize(20),
            config: { label in
                label.textAlignment = .Right
            }
        )

Animation doesn't work well for adding & removing views

Though animation works nicely for reused views, newly-added or removed views don't get any good visual effects since their frames are either miscalculated (when added) or not even calculated (when removed).

It would be nice to have some effects for them e.g. fade in/out, and also delaying purgeViews so that animation don't get interrupted.

Convert to Swift 3

Any idea when Swift3 support would be added, in particular for the latest Xcode 8 beta 6, which I am trying to build a project with (unsuccessfully)?

Support views with initializers that require arguments

ViewRecycler currently instantiates views with a no-argument constructor. This means that if you want to use a view that requires an initializer with an argument (e.g. UIButton), you need to create a subclass with a no-argument initializer.

ViewRecycler should use a view factory method provided by the layout to initialize new views. This will allow layouts to use initializers with arguments based on information in the layout.

Create `ConfigurableLayout` interface with generic view type parameter

Creating this issue to document @staguer 's idea to improve the interface w.r.t. animation support.

With the new ViewRecycler introduced in #12, the actual creation of the view no longer needs to happen inside of makeView() -> UIView?. It would be better if LayoutKit could instantiate the view automatically (reusing if necessary) and then the layout could just configure it.

@staguer Here is the prototype that you created

// Layout can't have a generic parameter so we can create arrays of Layouts.
protocol Layout {
    func generalConfigure(view view: UIView)
    var viewType: UIView.Type? { get }
    func makeView() -> UIView?
}

extension Layout {
    func makeView() -> UIView? {
        if let viewType = viewType {
            // Layouts that use views which don't have an appropriate default initializer
            // will need to override this implementation of makeView().
            return viewType.init()
        } else {
            return nil
        }
    }
}

// Layouts will extend this instead of Layout.
protocol ConfigurableLayout: Layout {
    associatedtype V: UIView
    func configure(view view: V)
}

extension ConfigurableLayout {
    func generalConfigure(view view: UIView) {
        guard let view = view as? V else {
            return
        }
        configure(view: view)
    }
    var viewType: UIView.Type? { return V.self }
}

// Example
class LabelLayout: ConfigurableLayout {
    func configure(view: UILabel) {
        // set the text and stuff
        view.text = "hi"
    }
}

collectionView Cell - recycling rendered subviews

Hey sorry for the avalanche of questions
I played with the example Feed Collection view and put a breakpoint here, to test whether cell subviews were recycled or not. It gave me the results below.

Each cell subviews are recreated each time collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) is called.

The only way to recycle the views is to use a viewReuseId for each layout/sub-layouts right?
Do you have any recommendation for using Layoutkit to render reusable CollectionView Cells?

// before makeView
(lldb) po cell.contentView.subviews[0].subviews
▿ 16 elements
  - 0 : <UILabel: 0x7f9dc947a5f0; frame = (8 8; 258 20.5); text = 'Sergei Tauger commented o...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286590>>
  - 1 : <UILabel: 0x7f9dc947a870; frame = (298 8; 14 20.5); text = '...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286630>>
  - 2 : <UIImageView: 0x7f9dc947aaf0; frame = (8 40.25; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x61000022a820>>
  - 3 : <UILabel: 0x7f9dc947aef0; frame = (62 32.5; 92 20.5); text = 'Nick Snyder'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286860>>
  - 4 : <UILabel: 0x7f9dc947b170; frame = (158 32.5; 22 20.5); text = '1st'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286900>>
  - 5 : <UILabel: 0x7f9dc947b3f0; frame = (62 55; 228 20.5); text = 'Software Engineer at Link...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6100002867c0>>
  - 6 : <UILabel: 0x7f9dc947b670; frame = (62 77.5; 108.5 20.5); text = '5 minutes ago'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6100002869a0>>
  - 7 : <UILabel: 0x7f9dc947b8f0; frame = (8 102; 92.5 20.5); text = 'Check it out'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286720>>
  - 8 : <UIImageView: 0x7f9dc947acd0; frame = (8 126.5; 304 200); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x61000022ae20>>
  - 9 : <UILabel: 0x7f9dc947bb70; frame = (8 326.5; 100.5 20.5); text = 'Chuck Norris'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286a90>>
  - 10 : <UILabel: 0x7f9dc947bdf0; frame = (8 347; 128 20.5); text = 'chucknorris.com'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286b30>>
  - 11 : <UILabel: 0x7f9dc947c070; frame = (8 371.5; 31 20.5); text = 'Like'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286bd0>>
  - 12 : <UILabel: 0x7f9dc947c2f0; frame = (122.5 371.5; 75 20.5); text = 'Comment'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286c70>>
  - 13 : <UILabel: 0x7f9dc947c570; frame = (267.5 371.5; 44.5 20.5); text = 'Share'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286d10>>
  - 14 : <UIImageView: 0x7f9dc947c7f0; frame = (8 396; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x61000022aca0>>
  - 15 : <UILabel: 0x7f9dc947c9d0; frame = (58 410.75; 78.5 20.5); text = 'Awesome!'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286e00>>

// after makeView
2016-10-16 11:32:11.432017 LayoutKitSampleApp[55714:4857519] subsystem: com.apple.coreanimation, category: CADebug, enable_level: 2, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 0, enable_private_data: 0
(lldb) po cell.contentView.subviews[0].subviews
▿ 16 elements
  - 0 : <UILabel: 0x7f9dc9726500; frame = (8 8; 258 20.5); text = 'Sergei Tauger commented o...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6080002852d0>>
  - 1 : <UILabel: 0x7f9dc9726780; frame = (298 8; 14 20.5); text = '...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x608000284bf0>>
  - 2 : <UIImageView: 0x7f9dc9726a00; frame = (8 40.25; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x60800002c760>>
  - 3 : <UILabel: 0x7f9dc947aef0; frame = (62 32.5; 92 20.5); text = 'Nick Snyder'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x610000286860>>
  - 4 : <UILabel: 0x7f9dc9726be0; frame = (158 32.5; 22 20.5); text = '1st'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x608000280000>>
  - 5 : <UILabel: 0x7f9dc9726e60; frame = (62 55; 228 20.5); text = 'Software Engineer at Link...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6080002808c0>>
  - 6 : <UILabel: 0x7f9dcb800480; frame = (62 77.5; 108.5 20.5); text = '5 minutes ago'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x600000284600>>
  - 7 : <UILabel: 0x7f9dc97a8fb0; frame = (8 102; 92.5 20.5); text = 'Check it out'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x608000284010>>
  - 8 : <UIImageView: 0x7f9dcbd02ee0; frame = (8 126.5; 304 200); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x61800002c2c0>>
  - 9 : <UILabel: 0x7f9dc9665b90; frame = (8 326.5; 100.5 20.5); text = 'Chuck Norris'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6000002843d0>>
  - 10 : <UILabel: 0x7f9dc9597ba0; frame = (8 347; 128 20.5); text = 'chucknorris.com'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x618000284380>>
  - 11 : <UILabel: 0x7f9dc9597e20; frame = (8 371.5; 31 20.5); text = 'Like'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x618000284d30>>
  - 12 : <UILabel: 0x7f9dc95980a0; frame = (122.5 371.5; 75 20.5); text = 'Comment'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x618000284c90>>
  - 13 : <UILabel: 0x7f9dc9598320; frame = (267.5 371.5; 44.5 20.5); text = 'Share'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6180002850a0>>
  - 14 : <UIImageView: 0x7f9dc9521210; frame = (8 396; 50 50); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x61800002a380>>
  - 15 : <UILabel: 0x7f9dc95985a0; frame = (58 410.75; 78.5 20.5); text = 'Awesome!'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x618000284fb0>>

Action support

Now I can add a button as part of the layout and than regenerate the Layout in response to an user action. Could be useful to have a native support for states (Normal, Highlighted) in a way that the view could automatically update to reflect a given state. i.e. having a state parameter in the view config block

TableView sample doesn´t work

Im getting "Extra argument synchronous in Call"

reloadableViewLayoutAdapter.reload(width: width, synchronous: synchronous, layoutProvider: { [weak self] in
            return [Section(header: nil, items: self?.getFeedItems() ?? [], footer: nil)]
            })

ReloadableViewLayoutAdapter animatable CRUD operations

Hey guys, just started using the library today and have enjoyed working with it. I'm a little stuck and was hoping you could shed some light. I've got my layouts created using a UICollectionView with the ReloadableViewLayoutAdapter. The behavior I'm looking for is to load an initial dataset and render the layouts, then be able to insert, delete, move or update items using the collectionview animations. I can't find anything in the docs that describes animating data, and when I try to it winds up doing a reload instead. When the update function is called within the adapter the incremental value is always true, so it calls reloadDataSync on the collectionview instead of proceeding to call insert.

After doing the initial load how should I proceed to insert more items?

not working for xcode 7.3.1 with swift 2.2

Hi,

I'm not able to install layoutkit using carthage.

Xcode Version : 7.3.1
Swift Version : Apple Swift version 2.2 (swiftlang-703.0.18.5 clang-703.0.31)
Target: x86_64-apple-macosx10.9
cartfile : github "linkedin/LayoutKit"

carthage update --platform iOS
** BUILD FAILED **

The following build commands failed:
CompileSwift normal arm64
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
A shell task (/usr/bin/xcrun xcodebuild -project "/Volumes/Workspace/Personal Projects/FrameworkPractices/Carthage/Checkouts/LayoutKit/LayoutKit.xcodeproj" -scheme LayoutKitExampleLayouts -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **

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.