ryanmcgrath/cacao

Method to access the layout anchors of a view

Closed this issue · 3 comments

I'd like to attempt to write some helper methods that can take a list of views that have top, leading, etc properties on them and create the layout constraints for them automatically, at least for simple cases.
Write now this doesn't seem to be doable as those properties are not exposed in a way that can be accessed with generics.
Would it be possible to add some sort of HasLayout trait that would possess methods like

fn get_top(&self)->LayoutAnchorY;

please.
I'm happy to make a PR with this if needed.

Okay, I've got this trait working in my own code now with some basic functions that make use of it.
Let me know if you'd like a pull request

I'd be open to seeing the PR to better understand what you're after here, sure.

(Closed this one but feel free to just have further discussion in the PR for less clutter~)