You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there's a quick snippet handy which could illustrate the usage of the layout method accepting an arbitrary array of views (https://github.com/robb/Cartography/blob/master/Cartography/Layout.swift#L32) as opposed to a fixed amount. I'm still new to swift so I'm having trouble understanding how to use this method.
The text was updated successfully, but these errors were encountered:
Nevermind. Spoke to soon. Some more fooling around and I realized it was trivial. Sorry about that. Here's a quick snippet as an example.
layout([UIView(), UIView(), UIView(), UIView(), UIView()]) { (views) -> () in
// Pin first and last views to edges.
views[0].left == views[0].superview!.left
views[views.count-1].right == views[views.count-1].superview!.right
for (index, view) in enumerate(views) {
// All views should match the height of their parent
view.top == view.superview!.top
view.bottom == view.superview!.bottom
if(index > 0) {
// All views should be the same width.
view.width == views[index-1].width
// All views should be 2dp apart
view.left == views[index-1].right + 2 ~ 400
}
}
}
Hey there,
I was wondering if there's a quick snippet handy which could illustrate the usage of the layout method accepting an arbitrary array of views (https://github.com/robb/Cartography/blob/master/Cartography/Layout.swift#L32) as opposed to a fixed amount. I'm still new to swift so I'm having trouble understanding how to use this method.
The text was updated successfully, but these errors were encountered: