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

UILayoutGuide support #268

Closed
inamiy opened this issue Oct 16, 2017 · 1 comment
Closed

UILayoutGuide support #268

inamiy opened this issue Oct 16, 2017 · 1 comment

Comments

@inamiy
Copy link

inamiy commented Oct 16, 2017

Hi 👋

Related to #267 where protocol LayoutItem is introduced (but not fully used yet), I think it is a good idea to further support arbitrary UILayoutGuide, i.e.

let space = UILayoutGuide()
view.addLayoutGuide(space)

constrain(view, space) { view, space in
    view.right == space.left
    ...
}

This will require other changes, e.g.:

public func constrain(_ view1: LayoutItem, _ view2: LayoutItem, replace group: ConstraintGroup? = nil, block: (LayoutProxy, LayoutProxy) -> ()) -> ConstraintGroup {
    ...
}

public struct LayoutProxy {
    ...
    internal let context: Context
    internal let layoutItem: LayoutItem

    init(_ context: Context, _ layoutItem: LayoutItem) {
        self.context = context
        self.layoutItem = layoutItem // `View` or `UILayoutGuide`
    }
}

What do you think?

@inamiy
Copy link
Author

inamiy commented Nov 9, 2017

Done in #269.

@inamiy inamiy closed this as completed Nov 9, 2017
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