Open ghost opened 7 years ago
@pprevalon To ad more than 5, you can pass in an array of objects, and then unpack that array inside the closure. Here's an extreme example from the KA app:
constrain([container, googleButton, facebookButton, orLabel, textBackground, textSeparator, usernameField, passwordField, forgotButton, passwordManagerLoginButton, signInButton, errorLabel]) { proxies in
let (container, googleButton, facebookButton, orLabel, textBackground, textSeparator, usernameField, passwordField, forgotButton, passwordManagerLoginButton, signInButton, errorLabel) = (proxies[0], proxies[1], proxies[2], proxies[3], proxies[4], proxies[5], proxies[6], proxies[7], proxies[8], proxies[9], proxies[10], proxies[11])
let itemWidth: CGFloat = 256
let itemHeight: CGFloat = 48
let buttonSpacing = SignInDefaultView.buttonSpacing
let forgotButtonMargin: CGFloat = 14
errorLabel.centerX == container.centerX
errorLabel.width == itemWidth
errorLabel.bottom == googleButton.top - buttonSpacing
googleButton.centerX == container.centerX
googleButton.width == itemWidth
googleButton.height == itemHeight
// etc
}
See also the discussion over here: https://github.com/robb/Cartography/issues/197
Thank you a million
how can i add more than 5 views in the constrain