Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Layout to use declarative NSLayoutAnchor #69

Open
alickbass opened this issue Apr 24, 2017 · 0 comments
Open

Refactor Layout to use declarative NSLayoutAnchor #69

alickbass opened this issue Apr 24, 2017 · 0 comments

Comments

@alickbass
Copy link
Contributor

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant