Skip to content

Refactor Layout to use declarative NSLayoutAnchor #69

@alickbass

Description

@alickbass

With the NSLayoutAnchor, we can now use it to avoid the layout format language. Imagine, in your function that defines layout, we could pass the view and return an array of objects. Like this:

let title = "title".build(UILabel.self).style([.numberOfLines(0), .text("test")])
let subtitle = "subtitle".build(UILabel.self).style([.numberOfLines(0), .text("subtitle")])

let brick = "details".build().bricks(title) { container, title in
    return [
        title.centerXAnchor.constraint(equalTo: container.centerXAnchor),
        title.centerYAnchor.constraint(equalTo: container.centerYAnchor),
    ]
}

However, this approach will require some refactoring. I can volunteer, if you want :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions